diff --git a/.gitignore b/.gitignore index fd1cfaf..8ac0ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/77a5f324d8f52bc9a7116aab8ed7136f08ea5310.tar.gz +/exp-e1eb486.tar.gz diff --git a/golang-googlecode-go-exp.spec b/golang-googlecode-go-exp.spec index 2539e51..5646052 100644 --- a/golang-googlecode-go-exp.spec +++ b/golang-googlecode-go-exp.spec @@ -1,119 +1,241 @@ +%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 0 +%global with_debug 0 +%global with_check 0 +%global with_unit_test 0 +%endif + +%if 0%{?with_debug} +%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_prefix code -%global provider google +%global provider github %global provider_tld com -%global project p -%global repo go.exp -%global commit 77a5f324d8f52bc9a7116aab8ed7136f08ea5310 -%global shortcommit %(c=%{commit}; echo ${c:0:12}) -%global import_path %{provider_prefix}.%{provider}.%{provider_tld}/%{project}/%{repo} - -%global x_provider golang -%global x_provider_tld org -%global x_project x -%global x_repo exp -%global x_import_path %{x_provider}.%{x_provider_tld}/x/%{x_repo} -%global x_name golang-%{x_provider}%{x_provider_tld}-%{x_repo} +%global project golang +%global repo exp +# https://github.com/golang/exp +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} +%global import_path golang.org/x/exp +%global commit e1eb486a5dd97885433e5fc85a751313af1df3cc +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +%global gi_name golang-%{provider}-%{project}-%{repo} +%global gc_import_path code.google.com/p/go.exp Name: golang-googlecode-go-exp Version: 0 -Release: 0.5.hg%{shortcommit}%{?dist} +Release: 0.6.git%{shortcommit}%{?dist} Summary: Experimental tools and packages for Go License: BSD -URL: http://%{import_path} -Source0: https://exp.go.googlecode.com/archive/%{commit}.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} +%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 -ExclusiveArch: %{ix86} x86_64 %{arm} +BuildRequires: golang %endif %description -%{summary}. +%{summary} +%if 0%{?with_devel} %package devel -BuildRequires: golang >= 1.2.1-3 -BuildRequires: golang(code.google.com/p/go.text/language) -BuildRequires: golang(code.google.com/p/go.text/collate/colltab) -Requires: golang >= 1.2.1-3 -Requires: golang(code.google.com/p/go.text/language) -Requires: golang(code.google.com/p/go.text/collate/colltab) -Summary: %{summary} -Provides: golang(%{import_path}) = %{version}-%{release} -Provides: golang(%{import_path}/ebnf) = %{version}-%{release} -Provides: golang(%{import_path}/ebnflint) = %{version}-%{release} -Provides: golang(%{import_path}/fsnotify) = %{version}-%{release} -Provides: golang(%{import_path}/inotify) = %{version}-%{release} -Provides: golang(%{import_path}/locale) = %{version}-%{release} -Provides: golang(%{import_path}/locale/search) = %{version}-%{release} -Provides: golang(%{import_path}/old) = %{version}-%{release} -Provides: golang(%{import_path}/old/netchan) = %{version}-%{release} -Provides: golang(%{import_path}/utf8string) = %{version}-%{release} - -%package -n %{x_name}-devel -BuildRequires: golang >= 1.2.1-3 -BuildRequires: golang(golang.org/x/text/language) -BuildRequires: golang(golang.org/x/text/collate/colltab) -Requires: golang >= 1.2.1-3 -Requires: golang(golang.org/x/text/language) -Requires: golang(golang.org/x/text/collate/colltab) -Summary: %{summary} -Provides: golang(%{x_import_path}) = %{version}-%{release} -Provides: golang(%{x_import_path}/ebnf) = %{version}-%{release} -Provides: golang(%{x_import_path}/ebnflint) = %{version}-%{release} -Provides: golang(%{x_import_path}/fsnotify) = %{version}-%{release} -Provides: golang(%{x_import_path}/inotify) = %{version}-%{release} -Provides: golang(%{x_import_path}/locale) = %{version}-%{release} -Provides: golang(%{x_import_path}/locale/search) = %{version}-%{release} -Provides: golang(%{x_import_path}/old) = %{version}-%{release} -Provides: golang(%{x_import_path}/old/netchan) = %{version}-%{release} -Provides: golang(%{x_import_path}/utf8string) = %{version}-%{release} - -# winfsnotify is for Windows only +Summary: %{summary} +BuildArch: noarch + +%if 0%{?with_check} +BuildRequires: golang(golang.org/x/text/collate/colltab) +BuildRequires: golang(golang.org/x/text/language) +%endif + +Requires: golang(golang.org/x/text/collate/colltab) +Requires: golang(golang.org/x/text/language) + +Provides: golang(%{gc_import_path}/ebnf) = %{version}-%{release} +Provides: golang(%{gc_import_path}/fsnotify) = %{version}-%{release} +Provides: golang(%{gc_import_path}/inotify) = %{version}-%{release} +Provides: golang(%{gc_import_path}/locale/search) = %{version}-%{release} +Provides: golang(%{gc_import_path}/old/netchan) = %{version}-%{release} +Provides: golang(%{gc_import_path}/utf8string) = %{version}-%{release} +Provides: golang(%{gc_import_path}/winfsnotify) = %{version}-%{release} %description devel -%{summary}. +%{summary} This package contains library source intended for -building other packages which use %{project}/%{repo}. +building other packages which use import path with +%{gc_import_path} prefix. + +%package -n %{gi_name}-devel +Summary: %{summary} +BuildArch: noarch + +%if 0%{?with_check} +BuildRequires: golang(golang.org/x/text/collate/colltab) +BuildRequires: golang(golang.org/x/text/language) +%endif + +Requires: golang(golang.org/x/text/collate/colltab) +Requires: golang(golang.org/x/text/language) -%description -n %{x_name}-devel -%{summary}. +Provides: golang(%{import_path}/ebnf) = %{version}-%{release} +Provides: golang(%{import_path}/fsnotify) = %{version}-%{release} +Provides: golang(%{import_path}/inotify) = %{version}-%{release} +Provides: golang(%{import_path}/locale/search) = %{version}-%{release} +Provides: golang(%{import_path}/old/netchan) = %{version}-%{release} +Provides: golang(%{import_path}/utf8string) = %{version}-%{release} +Provides: golang(%{import_path}/winfsnotify) = %{version}-%{release} + +%description -n %{gi_name}-devel +%{summary} This package contains library source intended for -building other packages which use %{x_project}/%{x_repo}. +building other packages which use import path with +%{import_path} prefix. +%endif + +%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 +%if 0%{?fedora} >= 23 +BuildRequires: golang-docs +%endif +%endif + +# test subpackage tests code from devel subpackage +Requires: %{name}-devel = %{version}-%{release} +%if 0%{?fedora} >= 23 +Requires: golang-docs +%endif + +%description unit-test +%{summary} + +This package contains unit tests for project +providing packages with %{import_path} prefix. +%endif %prep -%setup -q -n exp.go-%{shortcommit} +%setup -q -n %{repo}-%{commit} %build %install +# source codes for building projects +%if 0%{?with_devel} +install -d -p %{buildroot}/%{gopath}/src/%{gc_import_path}/ install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ -install -d -p %{buildroot}/%{gopath}/src/%{x_import_path}/ -for d in ebnf ebnflint fsnotify inotify locale old utf8string; do - cp -pav $d %{buildroot}/%{gopath}/src/%{import_path}/ - cp -pav $d %{buildroot}/%{gopath}/src/%{x_import_path}/ +# find all *.go but no *_test.go files and generate devel.file-list +for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do + 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 + install -d -p %{buildroot}/%{gopath}/src/%{gc_import_path}/$(dirname $file) + cp -pav $file %{buildroot}/%{gopath}/src/%{gc_import_path}/$file + echo "%%{gopath}/src/%%{gc_import_path}/$file" >> gc_devel.file-list done +%endif -cd %{buildroot}/%{gopath}/src/%{import_path} -# from https://groups.google.com/forum/#!topic/golang-nuts/eD8dh3T9yyA, first post -sed -i 's/"golang\.org\/x\//"code\.google\.com\/p\/go\./g' \ - $(find . -name '*.go') +# testing files for this project +%if 0%{?with_unit_test} +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 + 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 %check -GOPATH=%{buildroot}/%{gopath}:%{gopath} go test %{import_path}/{ebnf,ebnflint,fsnotify,inotify,locale/search,old/netchan,utf8string} +%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 +%endif + +export GOPATH=%{buildroot}/%{gopath}:%{gopath} +gotest %{import_path}/ebnf +%if 0%{?fedora} >= 23 +gotest %{import_path}/ebnflint +%endif +# fails in arm +#gotest %%{import_path}/fsnotify +gotest %{import_path}/inotify +gotest %{import_path}/locale/search +gotest %{import_path}/old/netchan +gotest %{import_path}/utf8string +#gotest %%{import_path}/winfsnotify +%endif + +%if 0%{?with_devel} +%files devel -f gc_devel.file-list +%copying LICENSE +%doc README AUTHORS CONTRIBUTORS PATENTS +%dir %{gopath}/src/%{gc_import_path} -%files devel -%doc LICENSE PATENTS README -%{gopath}/src/%{import_path} +%files devel -f devel.file-list +%copying LICENSE +%doc README AUTHORS CONTRIBUTORS PATENTS +%dir %{gopath}/src/%{import_path} +%endif -%files -n %{x_name}-devel -%doc LICENSE PATENTS README -%{gopath}/src/%{x_import_path} +%if 0%{?with_unit_test} +%files unit-test -f unit-test.file-list +%copying LICENSE +%doc README AUTHORS CONTRIBUTORS PATENTS +%endif %changelog +* Wed Aug 19 2015 jchaloup +- Update spec file to spec-2.0 + resolves: #1250519 + * Wed Jun 17 2015 Fedora Release Engineering - 0-0.5.hg77a5f324d8f5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild @@ -131,4 +253,3 @@ GOPATH=%{buildroot}/%{gopath}:%{gopath} go test %{import_path}/{ebnf,ebnflint,fs * Mon Sep 15 2014 Eric Paris