From 3751d2d03b1436c0f6f1a7f386cb2f3be8783cec Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Sep 12 2015 21:14:11 +0000 Subject: Update to spec-2.1 - related: #1250477 --- diff --git a/golang-github-hashicorp-serf.spec b/golang-github-hashicorp-serf.spec index 5420e25..b28114a 100644 --- a/golang-github-hashicorp-serf.spec +++ b/golang-github-hashicorp-serf.spec @@ -18,13 +18,6 @@ %global debug_package %{nil} %endif -%define copying() \ -%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \ -%license %{*} \ -%else \ -%doc %{*} \ -%endif - %global isgccgoarch 0 %if 0%{?gccgo_arches:1} %ifarch %{gccgo_arches} @@ -44,24 +37,16 @@ Name: golang-%{provider}-%{project}-%{repo} Version: 0 -Release: 0.3.git%{shortcommit}%{?dist} +Release: 0.4.git%{shortcommit}%{?dist} Summary: Service orchestration and management tool http://www.serfdom.io License: MPLv2.0 URL: https://%{provider_prefix} Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz -# If go_arches not defined fall through to implicit golang archs -%if 0%{?go_arches:1} -ExclusiveArch: %{go_arches} -%else -ExclusiveArch: %{ix86} x86_64 %{arm} -%endif -# If gccgo_arches does not fit or is not defined fall through to golang -%if %{isgccgoarch} -BuildRequires: gcc-go >= %{gccgo_min_vers} -%else -BuildRequires: golang -%endif +# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required +ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}} +# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} %description %{summary} @@ -111,21 +96,11 @@ building other packages which use import path with %{import_path} prefix. %endif -%if 0%{?with_unit_test} +%if 0%{?with_unit_test} && 0%{?with_devel} %package unit-test Summary: Unit tests for %{name} package -# If go_arches not defined fall through to implicit golang archs -%if 0%{?go_arches:1} -ExclusiveArch: %{go_arches} -%else -ExclusiveArch: %{ix86} x86_64 %{arm} -%endif -# If gccgo_arches does not fit or is not defined fall through to golang -%if %{isgccgoarch} -BuildRequires: gcc-go >= %{gccgo_min_vers} -%else -BuildRequires: golang -%endif +# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} %if 0%{?with_check} #Here comes all BuildRequires: PACKAGE the unit tests @@ -151,8 +126,10 @@ providing packages with %{import_path} prefix. # source codes for building projects %if 0%{?with_devel} install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list # find all *.go but no *_test.go files and generate devel.file-list for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do + echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list @@ -160,16 +137,21 @@ done %endif # testing files for this project -%if 0%{?with_unit_test} +%if 0%{?with_unit_test} && 0%{?with_devel} install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ # find all *_test.go files and generate unit-test.file-list for file in $(find . -iname "*_test.go"); do + echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list done %endif +%if 0%{?with_devel} +sort -u -o devel.file-list devel.file-list +%endif + %check %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} %if %{isgccgoarch} @@ -182,34 +164,49 @@ function gotest { go test "$@"; } %endif %endif +%if ! 0%{?with_bundled} export GOPATH=%{buildroot}/%{gopath}:%{gopath} -gotest %{import_path} +%else +export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath} +%endif + +%if ! 0%{?gotest:1} +%global gotest go test +%endif + +%gotest %{import_path} # --- FAIL: TestForceLeaveCommandRun (0.16s) -#gotest %%{import_path}/command +#%%gotest %%{import_path}/command # --- FAIL: TestSyslogFilter (0.00s) # syslog_test.go:17: err: Unix syslog delivery error -#gotest %%{import_path}/command/agent +#%%gotest %%{import_path}/command/agent # --- FAIL: TestSerf_Join_IgnoreOld (0.08s) # --- FAIL: TestSerf_SnapshotRecovery (0.72s) -#gotest %%{import_path}/serf -gotest %{import_path}/testutil +#%%gotest %%{import_path}/serf +%gotest %{import_path}/testutil %endif +#define license tag if not already defined +%{!?_licensedir:%global license %doc} + %if 0%{?with_devel} %files devel -f devel.file-list -%copying LICENSE +%license LICENSE %doc CHANGELOG.md README.md %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} -%dir %{gopath}/src/%{import_path} %endif -%if 0%{?with_unit_test} +%if 0%{?with_unit_test} && 0%{?with_devel} %files unit-test -f unit-test.file-list -%copying LICENSE +%license LICENSE %doc CHANGELOG.md README.md %endif %changelog +* Sat Sep 12 2015 jchaloup - 0-0.4.git4bd6183 +- Update to spec-2.1 + related: #1250477 + * Mon Aug 24 2015 jchaloup - 0-0.3.git4bd6183 - Update spec file to spec-2.0 resolves: #1250477 @@ -221,3 +218,4 @@ gotest %{import_path}/testutil * Wed Apr 15 2015 jchaloup - 0-0.1.git4bd6183 - First package for Fedora resolves: #1212318 +