From bb7934d746b44c7eeaa0fb9314cee70092742ce6 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Dec 14 2016 21:41:50 +0000 Subject: Polish the spec file - related: #1326890 --- diff --git a/golang-googlecode-net.spec b/golang-googlecode-net.spec index 6b038d2..ac49ba3 100644 --- a/golang-googlecode-net.spec +++ b/golang-googlecode-net.spec @@ -1,15 +1,32 @@ -%if 0%{?fedora} || 0%{?rhel} == 6 +# If any of the following macros should be set otherwise, +# you can wrap any of them with the following conditions: +# - %%if 0%%{centos} == 7 +# - %%if 0%%{?rhel} == 7 +# - %%if 0%%{?fedora} == 23 +# Or just test for particular distribution: +# - %%if 0%%{centos} +# - %%if 0%%{?rhel} +# - %%if 0%%{?fedora} +# +# Be aware, on centos, both %%rhel and %%centos are set. If you want to test +# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition. +# (Don't forget to replace double percentage symbol with single one in order to apply a condition) + +# Generate devel rpm %global with_devel 1 +# Build project from bundled dependencies %global with_bundled 0 +# Build with debug info rpm %global with_debug 0 +# Run tests in check section %global with_check 1 +# Generate unit-test rpm %global with_unit_test 1 + +%if 0%{?with_debug} +%global _dwz_low_mem_die_limit 0 %else -%global with_devel 1 -%global with_bundled 0 -%global with_debug 0 -%global with_check 1 -%global with_unit_test 1 +%global debug_package %{nil} %endif %if 0%{?with_debug} @@ -39,14 +56,14 @@ Name: golang-googlecode-net Version: 0 -Release: 0.34.git%{shortcommit}%{?dist} +Release: 0.35.git%{shortcommit}%{?dist} Summary: Supplementary Go networking libraries License: BSD URL: https://%{provider_prefix} Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz # 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}} +ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{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} @@ -146,7 +163,7 @@ which use the supplementary Go text libraries with golang.org/x/ imports. %endif %if 0%{?with_unit_test} -%package unit-test +%package unit-test-devel Summary: Unit tests for %{name} package %if 0%{?with_check} @@ -157,7 +174,7 @@ Summary: Unit tests for %{name} package # test subpackage tests code from devel subpackage Requires: %{name}-devel = %{version}-%{release} -%description unit-test +%description unit-test-devel %{summary} This package contains unit tests for project @@ -173,17 +190,26 @@ providing packages with %{x_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 install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/ +echo "%%dir %%{gopath}/src/%%{x_import_path}/." >> x_devel.file-list # find all *.go but no *_test.go files and generate devel.file-list for ext in go s; do for file in $(find . -iname "*.${ext}" \! -iname "*_test.go") ; do - install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) + dirprefix=$(dirname $file) + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list - install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/$(dirname $file) + install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/$dirprefix cp $file %{buildroot}/%{gopath}/src/%{x_import_path}/$file echo "%%{gopath}/src/%%{x_import_path}/$file" >> x_devel.file-list + + while [ "$dirprefix" != "." ]; do + echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list + echo "%%dir %%{gopath}/src/%%{x_import_path}/$dirprefix" >> x_devel.file-list + dirprefix=$(dirname $dirprefix) + done done done @@ -200,14 +226,27 @@ install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/html/testdata install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/html/charset/testdata cp -rpav html/testdata %{buildroot}/%{gopath}/src/%{x_import_path}/html cp -rpav html/charset/testdata %{buildroot}/%{gopath}/src/%{x_import_path}/html/charset -echo "%%{gopath}/src/%%{x_import_path}/html/testdata" >> unit-test.file-list -echo "%%{gopath}/src/%%{x_import_path}/html/charset/testdata" >> unit-test.file-list +echo "%%{gopath}/src/%%{x_import_path}/html/testdata" >> unit-test-devel.file-list +echo "%%{gopath}/src/%%{x_import_path}/html/charset/testdata" >> unit-test-devel.file-list # find all files with $ext prefix and generate unit-test.file-list for file in $(find . -iname "*_test.go"); do - install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/$(dirname $file) + dirprefix=$(dirname $file) + install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/$dirprefix cp $file %{buildroot}/%{gopath}/src/%{x_import_path}/$file - echo "%%{gopath}/src/%%{x_import_path}/$file" >> unit-test.file-list + echo "%%{gopath}/src/%%{x_import_path}/$file" >> unit-test-devel.file-list + + while [ "$dirprefix" != "." ]; do + echo "%%dir %%{gopath}/src/%%{x_import_path}/$dirprefix" >> devel.file-list + dirprefix=$(dirname $dirprefix) + done done + + +%endif + +%if 0%{?with_devel} +sort -u -o devel.file-list devel.file-list +sort -u -o x_devel.file-list x_devel.file-list %endif %check @@ -215,7 +254,9 @@ done %if ! 0%{?with_bundled} export GOPATH=%{buildroot}/%{gopath}:%{gopath} %else -export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath} +# No dependency directories so far + +export GOPATH=%{buildroot}/%{gopath}:%{gopath} %endif %if ! 0%{?gotest:1} @@ -249,21 +290,23 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath} %files devel -f devel.file-list %license LICENSE %doc AUTHORS CONTRIBUTORS PATENTS README CONTRIBUTING.md -%dir %{gopath}/src/%{import_path} %files -n %{x_name}-devel -f x_devel.file-list %license LICENSE %doc AUTHORS CONTRIBUTORS PATENTS README CONTRIBUTING.md -%dir %{gopath}/src/%{x_import_path} %endif %if 0%{?with_unit_test} -%files unit-test -f unit-test.file-list +%files unit-test-devel -f unit-test-devel.file-list %license LICENSE %doc AUTHORS CONTRIBUTORS PATENTS README CONTRIBUTING.md %endif %changelog +* Wed Dec 14 2016 Jan Chaloupka - 0-0.35.git4d38db7 +- Polish the spec file + related: #1326890 + * Tue Aug 09 2016 jchaloup - 0-0.34.git4d38db7 - Enable devel and unit-test for epel7 related: #1326890