From 1e1307873d1367c91e7e84938be48dd3723cf9d9 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Jul 29 2015 11:43:14 +0000 Subject: Update of spec file to spec-2.0 - related: #1230677 --- diff --git a/golang-googlecode-net.spec b/golang-googlecode-net.spec index 1d22ee1..1d8c4c1 100644 --- a/golang-googlecode-net.spec +++ b/golang-googlecode-net.spec @@ -1,25 +1,36 @@ -%if 0%{?fedora} +%if 0%{?fedora} || 0%{?rhel} == 6 %global with_devel 1 %global with_bundled 0 %global with_debug 0 %global with_check 1 +%global with_unit_test 1 %else %global with_devel 0 -%global with_bundled 1 +%global with_bundled 0 %global with_debug 0 %global with_check 0 +%global with_unit_test 0 %endif %if 0%{?with_debug} -# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12 %global _dwz_low_mem_die_limit 0 %else %global debug_package %{nil} %endif + +%define copying() \ +%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \ +%license %{*} \ +%else \ +%doc %{*} \ +%endif + %global provider_tld com %global provider github %global project golang %global repo net +# https://github.com/golang/net +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} %global import_path code.google.com/p/go.net %global commit 446d52dd4018303a13b36097e26d0888aca5d6ef %global shortcommit %(c=%{commit}; echo ${c:0:7}) @@ -35,15 +46,23 @@ Name: golang-googlecode-net Version: 0 -Release: 0.24.git%{shortcommit}%{?dist} +Release: 0.25.git%{shortcommit}%{?dist} Summary: Supplementary Go networking libraries License: BSD -URL: http://%{import_path} -Source0: https://github.com/%{project}/%{repo}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz -%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 -BuildArch: noarch +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} +ExclusiveArch: %{ix86} x86_64 %{arm} +%endif +# If gccgo_arches does not fit or is not defined fall through to golang +%ifarch 0%{?gccgo_arches} +BuildRequires: gcc-go >= %{gccgo_min_vers} +%else +BuildRequires: golang %endif %description @@ -51,7 +70,10 @@ ExclusiveArch: %{ix86} x86_64 %{arm} %if 0%{?with_devel} %package devel -BuildRequires: golang >= 1.2.1-3 +Summary: Supplementary Go networking libraries for code.google.com/p/ imports +BuildArch: noarch + +%if 0%{?with_check} BuildRequires: golang(code.google.com/p/go.text/encoding) BuildRequires: golang(code.google.com/p/go.text/encoding/charmap) BuildRequires: golang(code.google.com/p/go.text/encoding/japanese) @@ -60,6 +82,8 @@ BuildRequires: golang(code.google.com/p/go.text/encoding/simplifiedchinese) BuildRequires: golang(code.google.com/p/go.text/encoding/traditionalchinese) BuildRequires: golang(code.google.com/p/go.text/encoding/unicode) BuildRequires: golang(code.google.com/p/go.text/transform) +%endif + Requires: golang(code.google.com/p/go.text/encoding) Requires: golang(code.google.com/p/go.text/encoding/charmap) Requires: golang(code.google.com/p/go.text/encoding/japanese) @@ -68,7 +92,7 @@ Requires: golang(code.google.com/p/go.text/encoding/simplifiedchinese) Requires: golang(code.google.com/p/go.text/encoding/traditionalchinese) Requires: golang(code.google.com/p/go.text/encoding/unicode) Requires: golang(code.google.com/p/go.text/transform) -Summary: Supplementary Go networking libraries for code.google.com/p/ imports + Provides: golang(%{import_path}/context) = %{version}-%{release} Provides: golang(%{import_path}/dict) = %{version}-%{release} Provides: golang(%{import_path}/html) = %{version}-%{release} @@ -89,7 +113,10 @@ Provides: golang(%{import_path}/webdav) = %{version}-%{release} Provides: golang(%{import_path}/websocket) = %{version}-%{release} %package -n %{x_name}-devel -BuildRequires: golang >= 1.2.1-3 +Summary: Supplementary Go networking libraries for golang.org/x/ imports +BuildArch: noarch + +%if 0%{?with_unit_test} BuildRequires: golang(golang.org/x/text/encoding) BuildRequires: golang(golang.org/x/text/encoding/charmap) BuildRequires: golang(golang.org/x/text/encoding/japanese) @@ -98,6 +125,8 @@ BuildRequires: golang(golang.org/x/text/encoding/simplifiedchinese) BuildRequires: golang(golang.org/x/text/encoding/traditionalchinese) BuildRequires: golang(golang.org/x/text/encoding/unicode) BuildRequires: golang(golang.org/x/text/transform) +%endif + Requires: golang(golang.org/x/text/encoding) Requires: golang(golang.org/x/text/encoding/charmap) Requires: golang(golang.org/x/text/encoding/japanese) @@ -107,7 +136,6 @@ Requires: golang(golang.org/x/text/encoding/traditionalchinese) Requires: golang(golang.org/x/text/encoding/unicode) Requires: golang(golang.org/x/text/transform) -Summary: Supplementary Go networking libraries for golang.org/x/ imports Provides: golang(%{x_import_path}/context) = %{version}-%{release} Provides: golang(%{x_import_path}/dict) = %{version}-%{release} Provides: golang(%{x_import_path}/html) = %{version}-%{release} @@ -139,64 +167,134 @@ This package contains library source intended for building other packages which use the supplementary Go text libraries with golang.org/x/ imports. %endif -%prep +%if 0%{?with_unit_test} +%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 +%ifarch 0%{?gccgo_arches} +BuildRequires: gcc-go >= %{gccgo_min_vers} +%else +BuildRequires: golang +%endif + +%if 0%{?with_check} +#Here comes all BuildRequires: PACKAGE the unit tests +#in %%check section need for running +%endif + +# test subpackage tests code from devel subpackage +Requires: %{name}-devel = %{version}-%{release} +%description unit-test +%{summary} + +This package contains unit tests for project +providing packages with %{x_import_path} prefix. +%endif + +%prep %setup -q -n %{repo}-%{commit} %build %install +# source codes for building projects %if 0%{?with_devel} -install -dp %{buildroot}/%{gopath}/src/%{import_path} -install -dp %{buildroot}/%{gopath}/src/%{x_import_path} -for dir in */ ; do - cp -rpav $dir %{buildroot}/%{gopath}/src/%{import_path}/ - cp -rpav $dir %{buildroot}/%{gopath}/src/%{x_import_path}/ +install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/ +# 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) + 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) + cp $file %{buildroot}/%{gopath}/src/%{x_import_path}/$file + echo "%%{gopath}/src/%%{x_import_path}/$file" >> x_devel.file-list + done done -cd %{buildroot}/%{gopath}/src/%{import_path}/ +pushd %{buildroot}/%{gopath}/src/%{import_path}/ sed -i 's/"golang\.org\/x\//"code\.google\.com\/p\/go\./g' \ $(find . -name '*.go') +popd %endif -%check -%if 0%{?with_check} -export GOPATH=%{buildroot}%{gopath}:%{gopath} -go test %{import_path}/html -go test %{import_path}/html/atom -%if 0%{?fedora} == 20 || 0%{?fedora} == 21 -go test %{import_path}/html/charset +# testing files for this project +%if 0%{?with_unit_test} +install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/ +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 +# 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) + cp $file %{buildroot}/%{gopath}/src/%{x_import_path}/$file + echo "%%{gopath}/src/%%{x_import_path}/$file" >> unit-test.file-list +done %endif -go test %{import_path}/idna -go test %{import_path}/internal/timeseries -#go test %{import_path}/ipv4 -%if 0%{?fedora} == 20 || 0%{?fedora} == 21 -go test %{import_path}/ipv6 + +%check +%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} +%ifarch 0%{?gccgo_arches} +function gotest { %{gcc_go_test} "$@"; } +%else +%if 0%{?golang_test:1} +function gotest { %{golang_test} "$@"; } +%else +function gotest { go test "$@"; } %endif -go test %{import_path}/netutil -go test %{import_path}/proxy -go test %{import_path}/publicsuffix -go test %{import_path}/trace -#go test %{import_path}/webdav -go test %{import_path}/websocket %endif -rm -rf %{buildroot}%{gopath}/src/%{import_path}/html/testdata -rm -rf %{buildroot}%{gopath}/src/%{import_path}/html/charset/testdata -rm -rf %{buildroot}%{gopath}/src/%{x_import_path}/html/testdata -rm -rf %{buildroot}%{gopath}/src/%{x_import_path}/html/charset/testdata +export GOPATH=%{buildroot}%{gopath}:%{gopath} +go test %{x_import_path}/html +go test %{x_import_path}/html/atom +go test %{x_import_path}/html/charset +go test %{x_import_path}/idna +go test %{x_import_path}/internal/timeseries +go test %{x_import_path}/ipv4 +go test %{x_import_path}/ipv6 +go test %{x_import_path}/netutil +go test %{x_import_path}/proxy +go test %{x_import_path}/publicsuffix +go test %{x_import_path}/trace +go test %{x_import_path}/webdav +go test %{x_import_path}/websocket +%endif %if 0%{?with_devel} -%files devel -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS README -%{gopath}/src/%{import_path} +%files devel -f devel.file-list +%copying LICENSE +%doc AUTHORS CONTRIBUTORS PATENTS README CONTRIBUTING.md +%dir %{gopath}/src/%{import_path} + +%files -n %{x_name}-devel -f x_devel.file-list +%copying LICENSE +%doc AUTHORS CONTRIBUTORS PATENTS README CONTRIBUTING.md +%dir %{gopath}/src/%{x_import_path} +%endif -%files -n %{x_name}-devel -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS README -%{gopath}/src/%{x_import_path} +%if 0%{?with_unit_test} +%files unit-test -f unit-test.file-list +%copying LICENSE +%doc AUTHORS CONTRIBUTORS PATENTS README CONTRIBUTING.md %endif %changelog +* Wed Jul 29 2015 jchaloup - 0-0.25.git446d52d +- Update of spec file to spec-2.0 + related: #1230677 + * Thu Jul 23 2015 jchaloup - 0-0.24.git446d52d - No debuginfo related: #1230677