223915d
%if 0%{?fedora} || 0%{?rhel} == 6
223915d
%global with_devel 1
223915d
%global with_bundled 0
223915d
%global with_debug 0
223915d
%global with_check 1
223915d
%global with_unit_test 1
223915d
%else
223915d
%global with_devel 0
223915d
%global with_bundled 0
223915d
%global with_debug 0
223915d
%global with_check 0
223915d
%global with_unit_test 0
223915d
%endif
223915d
223915d
%if 0%{?with_debug}
223915d
%global _dwz_low_mem_die_limit 0
223915d
%else
def4895
%global debug_package   %{nil}
223915d
%endif
223915d
223915d
%global isgccgoarch 0
223915d
%if 0%{?gccgo_arches:1}
223915d
%ifarch %{gccgo_arches}
223915d
%global isgccgoarch 1
223915d
%endif
223915d
%endif
223915d
def4895
%global provider        github
def4895
%global provider_tld    com
def4895
%global project         hashicorp
def4895
%global repo            serf
def4895
# https://github.com/hashicorp/serf
223915d
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
223915d
%global import_path     %{provider_prefix}
27a47bc
%global commit          a72c0453da2ba628a013e98bf323a76be4aa1443
def4895
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
def4895
def4895
Name:           golang-%{provider}-%{project}-%{repo}
27a47bc
Version:        0.6.4
37360eb
Release:        0.4.git%{shortcommit}%{?dist}
def4895
Summary:        Service orchestration and management tool http://www.serfdom.io
def4895
License:        MPLv2.0
223915d
URL:            https://%{provider_prefix}
223915d
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
def4895
3751d2d
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
3751d2d
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
3751d2d
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
3751d2d
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
def4895
def4895
%description
def4895
%{summary}
def4895
223915d
%if 0%{?with_devel}
def4895
%package devel
def4895
Summary:       %{summary}
223915d
BuildArch:     noarch
223915d
223915d
%if 0%{?with_check}
def4895
BuildRequires: golang(github.com/armon/circbuf)
def4895
BuildRequires: golang(github.com/armon/go-metrics)
def4895
BuildRequires: golang(github.com/hashicorp/go-msgpack/codec)
def4895
BuildRequires: golang(github.com/hashicorp/go-syslog)
def4895
BuildRequires: golang(github.com/hashicorp/logutils)
def4895
BuildRequires: golang(github.com/hashicorp/mdns)
def4895
BuildRequires: golang(github.com/hashicorp/memberlist)
def4895
#BuildRequires: golang(github.com/mitchellh/cli)
def4895
BuildRequires: golang-github-mitchellh-cli-devel-temporary
def4895
BuildRequires: golang(github.com/mitchellh/mapstructure)
def4895
BuildRequires: golang(github.com/ryanuber/columnize)
223915d
%endif
def4895
def4895
Requires:      golang(github.com/armon/circbuf)
def4895
Requires:      golang(github.com/armon/go-metrics)
def4895
Requires:      golang(github.com/hashicorp/go-msgpack/codec)
def4895
Requires:      golang(github.com/hashicorp/go-syslog)
def4895
Requires:      golang(github.com/hashicorp/logutils)
def4895
Requires:      golang(github.com/hashicorp/mdns)
def4895
Requires:      golang(github.com/hashicorp/memberlist)
def4895
#Requires:      golang(github.com/mitchellh/cli)
def4895
Requires:      golang-github-mitchellh-cli-devel-temporary
def4895
Requires:      golang(github.com/mitchellh/mapstructure)
def4895
Requires:      golang(github.com/ryanuber/columnize)
def4895
def4895
Provides:      golang(%{import_path}/client) = %{version}-%{release}
def4895
Provides:      golang(%{import_path}/command) = %{version}-%{release}
def4895
Provides:      golang(%{import_path}/command/agent) = %{version}-%{release}
27a47bc
Provides:      golang(%{import_path}/coordinate) = %{version}-%{release}
def4895
Provides:      golang(%{import_path}/serf) = %{version}-%{release}
def4895
Provides:      golang(%{import_path}/testutil) = %{version}-%{release}
def4895
def4895
%description devel
def4895
%{summary}
def4895
def4895
This package contains library source intended for
223915d
building other packages which use import path with
223915d
%{import_path} prefix.
223915d
%endif
223915d
3751d2d
%if 0%{?with_unit_test} && 0%{?with_devel}
223915d
%package unit-test
223915d
Summary:         Unit tests for %{name} package
3751d2d
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
3751d2d
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
223915d
223915d
%if 0%{?with_check}
223915d
#Here comes all BuildRequires: PACKAGE the unit tests
223915d
#in %%check section need for running
223915d
%endif
223915d
223915d
# test subpackage tests code from devel subpackage
223915d
Requires:        %{name}-devel = %{version}-%{release}
223915d
223915d
%description unit-test
223915d
%{summary}
223915d
223915d
This package contains unit tests for project
223915d
providing packages with %{import_path} prefix.
223915d
%endif
def4895
def4895
%prep
def4895
%setup -q -n %{repo}-%{commit}
def4895
def4895
%build
def4895
def4895
%install
223915d
# source codes for building projects
223915d
%if 0%{?with_devel}
def4895
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
3751d2d
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
223915d
# find all *.go but no *_test.go files and generate devel.file-list
223915d
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
3751d2d
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
223915d
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
223915d
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
223915d
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
223915d
done
223915d
%endif
def4895
223915d
# testing files for this project
3751d2d
%if 0%{?with_unit_test} && 0%{?with_devel}
223915d
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
223915d
# find all *_test.go files and generate unit-test.file-list
223915d
for file in $(find . -iname "*_test.go"); do
3751d2d
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
223915d
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
223915d
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
223915d
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
def4895
done
223915d
%endif
def4895
3751d2d
%if 0%{?with_devel}
3751d2d
sort -u -o devel.file-list devel.file-list
3751d2d
%endif
3751d2d
def4895
%check
223915d
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
223915d
%if %{isgccgoarch}
223915d
function gotest { %{gcc_go_test} "$@"; }
def4895
%else
223915d
%if 0%{?golang_test:1}
223915d
function gotest { %{golang_test} "$@"; }
223915d
%else
223915d
function gotest { go test "$@"; }
223915d
%endif
def4895
%endif
223915d
3751d2d
%if ! 0%{?with_bundled}
223915d
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
3751d2d
%else
3751d2d
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
3751d2d
%endif
3751d2d
3751d2d
%if ! 0%{?gotest:1}
3751d2d
%global gotest go test
3751d2d
%endif
3751d2d
3751d2d
%gotest %{import_path}
223915d
# --- FAIL: TestForceLeaveCommandRun (0.16s)
3751d2d
#%%gotest %%{import_path}/command
223915d
# --- FAIL: TestSyslogFilter (0.00s)
223915d
#	syslog_test.go:17: err: Unix syslog delivery error
3751d2d
#%%gotest %%{import_path}/command/agent
223915d
# --- FAIL: TestSerf_Join_IgnoreOld (0.08s)
223915d
# --- FAIL: TestSerf_SnapshotRecovery (0.72s)
3751d2d
#%%gotest %%{import_path}/serf
3751d2d
%gotest %{import_path}/testutil
223915d
%endif
223915d
3751d2d
#define license tag if not already defined
3751d2d
%{!?_licensedir:%global license %doc}
3751d2d
223915d
%if 0%{?with_devel}
223915d
%files devel -f devel.file-list
3751d2d
%license LICENSE
def4895
%doc CHANGELOG.md README.md
def4895
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
223915d
%endif
223915d
3751d2d
%if 0%{?with_unit_test} && 0%{?with_devel}
223915d
%files unit-test -f unit-test.file-list
3751d2d
%license LICENSE
223915d
%doc CHANGELOG.md README.md
223915d
%endif
def4895
def4895
%changelog
37360eb
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.4-0.4.gita72c045
37360eb
- https://fedoraproject.org/wiki/Changes/golang1.7
37360eb
a1fb06c
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.4-0.3.gita72c045
a1fb06c
- https://fedoraproject.org/wiki/Changes/golang1.6
a1fb06c
3a09c23
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.4-0.2.gita72c045
3a09c23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
3a09c23
27a47bc
* Wed Jan 13 2016 jchaloup <jchaloup@redhat.com> - 0.6.4-0.1.gita72c045
27a47bc
- Bump to upstream a72c0453da2ba628a013e98bf323a76be4aa1443
27a47bc
  related: #1250477
27a47bc
3751d2d
* Sat Sep 12 2015 jchaloup <jchaloup@redhat.com> - 0-0.4.git4bd6183
3751d2d
- Update to spec-2.1
3751d2d
  related: #1250477
3751d2d
223915d
* Mon Aug 24 2015 jchaloup <jchaloup@redhat.com> - 0-0.3.git4bd6183
223915d
- Update spec file to spec-2.0
223915d
  resolves: #1250477
223915d
63cb844
* Thu Jul 16 2015 jchaloup <jchaloup@redhat.com> - 0-0.2.git4bd6183
63cb844
- Disable command test
63cb844
  related: #1212318
63cb844
def4895
* Wed Apr 15 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.git4bd6183
def4895
- First package for Fedora
def4895
  resolves: #1212318
3751d2d