diff --git a/golang-github-mesos-mesos-go.spec b/golang-github-mesos-mesos-go.spec index 1aa1b10..5e8b94f 100644 --- a/golang-github-mesos-mesos-go.spec +++ b/golang-github-mesos-mesos-go.spec @@ -18,20 +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} -%global isgccgoarch 1 -%endif -%endif - %global provider github %global provider_tld com %global project mesos @@ -44,24 +30,16 @@ Name: golang-%{provider}-%{project}-%{repo} Version: 0 -Release: 0.2.git%{shortcommit}%{?dist} +Release: 0.3.git%{shortcommit}%{?dist} Summary: Go language bindings for Apache Mesos License: ASL 2.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} @@ -118,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 @@ -158,14 +126,17 @@ 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 # *.proto files defines a golang package as well for file in $(find . -iname "*.proto") ; do + echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list done # find all *.go but no *_test.go files and generate unit-test.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 $file %{buildroot}/%{gopath}/src/%{import_path}/$file echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list @@ -173,56 +144,66 @@ 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 $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} -function gotest { %{gcc_go_test} "$@"; } -%else -%if 0%{?golang_test:1} -function gotest { %{golang_test} "$@"; } +%if ! 0%{?with_bundled} +export GOPATH=%{buildroot}/%{gopath}:%{gopath} %else -function gotest { go test "$@"; } +export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath} %endif + +%if ! 0%{?gotest:1} +%global gotest go test %endif -export GOPATH=%{buildroot}/%{gopath}:%{gopath} -gotest %{import_path}/auth/sasl -gotest %{import_path}/detector -#gotest %%{import_path}/detector/zoo -#gotest %%{import_path}/executor -gotest %{import_path}/healthchecker -gotest %{import_path}/mesosproto -gotest %{import_path}/mesosutil -gotest %{import_path}/messenger -#gotest %%{import_path}/scheduler -gotest %{import_path}/upid +%gotest %{import_path}/auth/sasl +%gotest %{import_path}/detector +#%%gotest %%{import_path}/detector/zoo +#%%gotest %%{import_path}/executor +%gotest %{import_path}/healthchecker +%gotest %{import_path}/mesosproto +%gotest %{import_path}/mesosutil +%gotest %{import_path}/messenger +#%%gotest %%{import_path}/scheduler +%gotest %{import_path}/upid %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 README.md Godeps/Godeps.json %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 README.md messenger/README.md %endif %changelog +* Sat Sep 12 2015 jchaloup - 0-0.3.git83b52d7 +- Update to spec-2.1 + related: #1250493 + * Mon Aug 24 2015 jchaloup - 0-0.2.git83b52d7 - Update ifarch for secondary architectures resolves: #1250493 @@ -230,3 +211,4 @@ gotest %{import_path}/upid * Tue Jul 28 2015 jchaloup - 0-0.1.git83b52d7 - First package for Fedora resolves: #1246740 +