Blame consul.spec

23a9fbf
%if 0%{?fedora}
23a9fbf
%global with_devel 1
23a9fbf
# no bundled dependencies so far
23a9fbf
%global with_bundled 0
23a9fbf
%global with_debug 1
23a9fbf
%global with_check 1
23a9fbf
%else
23a9fbf
%global with_devel 0
23a9fbf
# no bundled dependencies so far
23a9fbf
%global with_bundled 0
23a9fbf
%global with_debug 0
23a9fbf
%global with_check 0
23a9fbf
%endif
23a9fbf
23a9fbf
%if 0%{?with_debug}
23a9fbf
%global _dwz_low_mem_die_limit 0
23a9fbf
%else
23a9fbf
%global debug_package   %{nil}
23a9fbf
%endif
7e05b5c
7e05b5c
%if ! 0%{?gobuild:1}
7e05b5c
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
7e05b5c
%endif
7e05b5c
23a9fbf
%global provider        github
23a9fbf
%global provider_tld    com
23a9fbf
%global project         hashicorp
23a9fbf
%global repo            consul
23a9fbf
# https://github.com/hashicorp/consul
7e05b5c
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
7e05b5c
%global import_path     %{provider_prefix}
dcb6ac9
%global commit          46499d6e7237ca8547c15ce44e9b93bea48a455b
23a9fbf
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
23a9fbf
23a9fbf
Name:           consul
dcb6ac9
Version:        0.6.0
09ec316
Release:        0.6.git%{shortcommit}%{?dist}
23a9fbf
Summary:        Tool for service discovery, monitoring and configuration http://www.consul.io
23a9fbf
License:        MPLv2.0
7e05b5c
URL:            https://%{provider_prefix}
7e05b5c
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
23a9fbf
7e05b5c
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
7e05b5c
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
7e05b5c
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
7e05b5c
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
23a9fbf
23a9fbf
%if ! 0%{?with_bundled}
7e05b5c
# commands.go
7e05b5c
#BuildRequires: golang(github.com/mitchellh/cli)
7e05b5c
BuildRequires: golang-github-mitchellh-cli-devel-temporary
7e05b5c
7e05b5c
# main.go
23a9fbf
#BuildRequires: golang(github.com/mitchellh/cli)
23a9fbf
BuildRequires: golang-github-mitchellh-cli-devel-temporary
23a9fbf
%endif
23a9fbf
23a9fbf
%description
23a9fbf
%{summary}
23a9fbf
7e05b5c
%if 0%{?with_devel} || ! 0%{?with_bundled}
23a9fbf
%package -n golang-%{provider}-%{project}-%{repo}-devel
23a9fbf
Summary:       %{summary}
23a9fbf
BuildArch:      noarch
7e05b5c
7e05b5c
%if 0%{?with_check} && ! 0%{?with_bundled}
23a9fbf
BuildRequires: golang(github.com/armon/circbuf)
23a9fbf
BuildRequires: golang(github.com/armon/go-metrics)
2743965
BuildRequires: golang(github.com/armon/go-metrics/datadog)
23a9fbf
BuildRequires: golang(github.com/armon/go-radix)
2743965
BuildRequires: golang(github.com/fsouza/go-dockerclient)
23a9fbf
BuildRequires: golang(github.com/hashicorp/go-checkpoint)
2743965
BuildRequires: golang(github.com/hashicorp/go-cleanhttp)
2743965
BuildRequires: golang(github.com/hashicorp/go-memdb)
23a9fbf
BuildRequires: golang(github.com/hashicorp/go-msgpack/codec)
23a9fbf
BuildRequires: golang(github.com/hashicorp/go-syslog)
23a9fbf
BuildRequires: golang(github.com/hashicorp/golang-lru)
23a9fbf
BuildRequires: golang(github.com/hashicorp/hcl)
23a9fbf
BuildRequires: golang(github.com/hashicorp/logutils)
23a9fbf
BuildRequires: golang(github.com/hashicorp/memberlist)
2743965
BuildRequires: golang(github.com/hashicorp/net-rpc-msgpackrpc)
23a9fbf
BuildRequires: golang(github.com/hashicorp/raft)
23a9fbf
BuildRequires: golang(github.com/hashicorp/raft-boltdb)
23a9fbf
BuildRequires: golang(github.com/hashicorp/scada-client)
2743965
BuildRequires: golang(github.com/hashicorp/serf/coordinate)
23a9fbf
BuildRequires: golang(github.com/hashicorp/serf/serf)
23a9fbf
BuildRequires: golang(github.com/hashicorp/yamux)
23a9fbf
BuildRequires: golang(github.com/inconshreveable/muxado)
23a9fbf
BuildRequires: golang(github.com/miekg/dns)
23a9fbf
#BuildRequires: golang(github.com/mitchellh/cli)
23a9fbf
BuildRequires: golang-github-mitchellh-cli-devel-temporary
23a9fbf
BuildRequires: golang(github.com/mitchellh/mapstructure)
23a9fbf
BuildRequires: golang(github.com/ryanuber/columnize)
7e05b5c
# indirect dep
7e05b5c
BuildRequires: golang(github.com/docker/go-units)
7e05b5c
BuildRequires: golang(github.com/opencontainers/runc/libcontainer/user)
7e05b5c
%endif
2743965
23a9fbf
Requires:      golang(github.com/armon/circbuf)
23a9fbf
Requires:      golang(github.com/armon/go-metrics)
2743965
Requires:      golang(github.com/armon/go-metrics/datadog)
23a9fbf
Requires:      golang(github.com/armon/go-radix)
2743965
Requires:      golang(github.com/fsouza/go-dockerclient)
23a9fbf
Requires:      golang(github.com/hashicorp/go-checkpoint)
2743965
Requires:      golang(github.com/hashicorp/go-cleanhttp)
2743965
Requires:      golang(github.com/hashicorp/go-memdb)
23a9fbf
Requires:      golang(github.com/hashicorp/go-msgpack/codec)
23a9fbf
Requires:      golang(github.com/hashicorp/go-syslog)
23a9fbf
Requires:      golang(github.com/hashicorp/golang-lru)
23a9fbf
Requires:      golang(github.com/hashicorp/hcl)
23a9fbf
Requires:      golang(github.com/hashicorp/logutils)
23a9fbf
Requires:      golang(github.com/hashicorp/memberlist)
2743965
Requires:      golang(github.com/hashicorp/net-rpc-msgpackrpc)
23a9fbf
Requires:      golang(github.com/hashicorp/raft)
23a9fbf
Requires:      golang(github.com/hashicorp/raft-boltdb)
23a9fbf
Requires:      golang(github.com/hashicorp/scada-client)
2743965
Requires:      golang(github.com/hashicorp/serf/coordinate)
23a9fbf
Requires:      golang(github.com/hashicorp/serf/serf)
23a9fbf
Requires:      golang(github.com/hashicorp/yamux)
23a9fbf
Requires:      golang(github.com/inconshreveable/muxado)
23a9fbf
Requires:      golang(github.com/miekg/dns)
23a9fbf
#Requires:      golang(github.com/mitchellh/cli)
23a9fbf
Requires:      golang-github-mitchellh-cli-devel-temporary
23a9fbf
Requires:      golang(github.com/mitchellh/mapstructure)
23a9fbf
Requires:      golang(github.com/ryanuber/columnize)
7e05b5c
# Indirect dep
7e05b5c
Requires:      golang(github.com/docker/go-units)
7e05b5c
Requires:      golang(github.com/opencontainers/runc/libcontainer/user)
2743965
23a9fbf
Provides:      golang(%{import_path}/acl) = %{version}-%{release}
23a9fbf
Provides:      golang(%{import_path}/api) = %{version}-%{release}
23a9fbf
Provides:      golang(%{import_path}/command) = %{version}-%{release}
23a9fbf
Provides:      golang(%{import_path}/command/agent) = %{version}-%{release}
23a9fbf
Provides:      golang(%{import_path}/consul) = %{version}-%{release}
2743965
Provides:      golang(%{import_path}/consul/state) = %{version}-%{release}
23a9fbf
Provides:      golang(%{import_path}/consul/structs) = %{version}-%{release}
23a9fbf
Provides:      golang(%{import_path}/testutil) = %{version}-%{release}
23a9fbf
Provides:      golang(%{import_path}/tlsutil) = %{version}-%{release}
23a9fbf
Provides:      golang(%{import_path}/watch) = %{version}-%{release}
23a9fbf
23a9fbf
%description -n golang-%{provider}-%{project}-%{repo}-devel
23a9fbf
%{summary}
23a9fbf
23a9fbf
This package contains library source intended for
23a9fbf
building other packages which use %{project}/%{repo}.
23a9fbf
%endif
23a9fbf
7e05b5c
%if 0%{?with_unit_test} && 0%{?with_devel}
7e05b5c
%package -n golang-%{provider}-%{project}-%{repo}-unit-test-devel
7e05b5c
Summary:         Unit tests for %{name} package
7e05b5c
%if 0%{?with_check}
7e05b5c
#Here comes all BuildRequires: PACKAGE the unit tests
7e05b5c
#in %%check section need for running
7e05b5c
%endif
7e05b5c
7e05b5c
# test subpackage tests code from devel subpackage
7e05b5c
Requires:        %{name}-devel = %{version}-%{release}
7e05b5c
7e05b5c
%if 0%{?with_check} && ! 0%{?with_bundled}
7e05b5c
%endif
7e05b5c
7e05b5c
%description -n golang-%{provider}-%{project}-%{repo}-unit-test-devel
7e05b5c
%{summary}
7e05b5c
7e05b5c
This package contains unit tests for project
7e05b5c
providing packages with %{import_path} prefix.
7e05b5c
%endif
7e05b5c
23a9fbf
%prep
23a9fbf
%setup -q -n %{repo}-%{commit}
23a9fbf
23a9fbf
%build
23a9fbf
mkdir -p src/github.com/hashicorp
7e05b5c
ln -s ../../../ src/github.com/hashicorp/consul
23a9fbf
7e05b5c
%if ! 0%{?with_bundled}
23a9fbf
export GOPATH=$(pwd):%{gopath}
23a9fbf
%else
7e05b5c
export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
23a9fbf
%endif
7e05b5c
7e05b5c
%gobuild -o bin/%{name} %{import_path}
23a9fbf
23a9fbf
%install
23a9fbf
# consul subpackage
23a9fbf
install -D -p -m 0755 bin/%{name} %{buildroot}%{_bindir}/%{name}
23a9fbf
7e05b5c
%if 0%{?with_devel} || ! 0%{?with_bundled}
23a9fbf
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
7e05b5c
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
7e05b5c
# find all *.go but no *_test.go files and generate devel.file-list
7e05b5c
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
7e05b5c
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
7e05b5c
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
7e05b5c
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
7e05b5c
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
7e05b5c
done
7e05b5c
%endif
23a9fbf
7e05b5c
# testing files for this project
7e05b5c
%if 0%{?with_unit_test} && 0%{?with_devel}
7e05b5c
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
7e05b5c
# find all *_test.go files and generate unit-test-devel.file-list
7e05b5c
for file in $(find . -iname "*_test.go"); do
7e05b5c
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
7e05b5c
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
7e05b5c
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
7e05b5c
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
23a9fbf
done
23a9fbf
%endif
23a9fbf
7e05b5c
%if 0%{?with_devel} || ! 0%{?with_bundled}
7e05b5c
sort -u -o devel.file-list devel.file-list
7e05b5c
%endif
7e05b5c
23a9fbf
%check
7e05b5c
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
7e05b5c
%if ! 0%{?with_bundled}
23a9fbf
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
7e05b5c
%else
7e05b5c
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
7e05b5c
%endif
7e05b5c
7e05b5c
%if ! 0%{?gotest:1}
7e05b5c
%global gotest go test
7e05b5c
%endif
7e05b5c
7e05b5c
%gotest %{import_path}
7e05b5c
%gotest %{import_path}/acl
7e05b5c
%gotest %{import_path}/api
7e05b5c
#%%gotest %{import_path}/command
7e05b5c
#%%gotest %{import_path}/command/agent
7e05b5c
#%%gotest %{import_path}/consul
7e05b5c
%gotest %{import_path}/consul/state
7e05b5c
%gotest %{import_path}/consul/structs
7e05b5c
%gotest %{import_path}/testutil
7e05b5c
#%%gotest %{import_path}/tlsutil
7e05b5c
%gotest %{import_path}/watch
23a9fbf
%endif
23a9fbf
7e05b5c
#define license tag if not already defined
7e05b5c
%{!?_licensedir:%global license %doc}
7e05b5c
23a9fbf
%files
23a9fbf
%license LICENSE
23a9fbf
%doc CHANGELOG.md README.md
23a9fbf
%{_bindir}/%{name}
23a9fbf
7e05b5c
%if 0%{?with_devel} || ! 0%{?with_bundled}
7e05b5c
%files -n golang-%{provider}-%{project}-%{repo}-devel -f devel.file-list
23a9fbf
%license LICENSE
23a9fbf
%doc CHANGELOG.md README.md
23a9fbf
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
7e05b5c
%endif
7e05b5c
7e05b5c
%if 0%{?with_unit_test} && 0%{?with_devel}
7e05b5c
%files -n golang-%{provider}-%{project}-%{repo}-unit-test-devel -f unit-test-devel.file-list
7e05b5c
%license LICENSE
7e05b5c
%doc CHANGELOG.md README.md
23a9fbf
%endif
23a9fbf
23a9fbf
%changelog
09ec316
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.0-0.6.git46499d6
09ec316
- https://fedoraproject.org/wiki/Changes/golang1.7
09ec316
7e05b5c
* Thu Mar 17 2016 jchaloup <jchaloup@redhat.com> - 0.6.0-0.5.git46499d6
7e05b5c
- Polish the spec file
7e05b5c
  resolves: #1318556
7e05b5c
5db151f
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.0-0.4.git46499d6
5db151f
- https://fedoraproject.org/wiki/Changes/golang1.6
5db151f
0853ef3
* Tue Feb 16 2016 jchaloup <jchaloup@redhat.com> - 0.6.0-0.3.git46499d6
0853ef3
- Add deps missing in docker (temporary fix)
0853ef3
  related: #1290013
0853ef3
f089485
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-0.2.git46499d6
f089485
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
f089485
dcb6ac9
* Wed Dec 09 2015 jchaloup <jchaloup@redhat.com> - 0.6.0-0.1.git46499d6
dcb6ac9
- Update to 0.6.0
2743965
  resolves: #1290013
dcb6ac9
23a9fbf
* Wed Apr 15 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.git5079177
23a9fbf
- First package for Fedora
23a9fbf
  resolves: #1208616
23a9fbf