diff --git a/golang-gopkg-yaml.spec b/golang-gopkg-yaml.spec index b7bec5c..81023b1 100644 --- a/golang-gopkg-yaml.spec +++ b/golang-gopkg-yaml.spec @@ -1,42 +1,5 @@ -# 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 -# both tests failing -%global with_check 0 -# Generate unit-test rpm -%global with_unit_test 1 - -%if 0%{?with_debug} -%global _dwz_low_mem_die_limit 0 -%else -%global debug_package %{nil} -%endif - -%global provider github -%global provider_tld com -%global project go-yaml -%global repo yaml -%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} +%global goipath github.com/go-yaml/yaml %global commit cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b -%global shortcommit %(c=%{commit}; echo ${c:0:7}) %global import_path gopkg.in/v2/yaml %global import_path_sec gopkg.in/yaml.v2 @@ -48,33 +11,26 @@ %global devel_main golang-gopkg-yaml-devel-v2 +%gometa -i + Name: golang-gopkg-yaml Version: 1 -Release: 20%{?dist} +Release: 21%{?dist} Summary: Enables Go programs to comfortably encode and decode YAML values License: LGPLv3 with exceptions -URL: https://%{provider_prefix} -Source0: https://%{provider_prefix}/archive/%{commit}/yaml-%{shortcommit}.tar.gz -Source1: https://%{provider_prefix}/archive/%{v1_commit}/yaml-%{v1_commit}.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 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} +URL: %{gourl} +Source0: %{gosource} +Source1: https://%{goipath}/archive/%{v1_commit}/yaml-%{v1_commit}.tar.gz %description %{summary} -%if 0%{?with_devel} %package devel Summary: Enables Go programs to comfortably encode and decode YAML values BuildArch: noarch -%if 0%{?with_check} -%endif - -Provides: golang(%{v1_import_path}) = %{version}-%{release} -Provides: golang(%{v1_import_path_sec}) = %{version}-%{release} +BuildRequires: golang(gopkg.in/check.v1) +Requires: golang(gopkg.in/check.v1) %description devel The yaml package enables Go programs to comfortably encode and decode YAML @@ -95,12 +51,6 @@ building other packages which use import path with Summary: Enables Go programs to comfortably encode and decode YAML values BuildArch: noarch -%if 0%{?with_check} -%endif - -Provides: golang(%{import_path}) = %{version}-%{release} -Provides: golang(%{import_path_sec}) = %{version}-%{release} - %description devel-v2 The yaml package enables Go programs to comfortably encode and decode YAML values. It was developed within Canonical as part of the juju project, and @@ -115,126 +65,61 @@ from YAML 1.1 are purposefully not supported since they're a poor design This package contains library source intended for 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 0%{?with_check} -#Here comes all BuildRequires: PACKAGE the unit tests -#in %%check section need for running -BuildRequires: golang(gopkg.in/check.v1) -%endif - -Requires: golang(gopkg.in/check.v1) - -# test subpackage tests code from devel subpackage -Requires: %{name}-devel = %{version}-%{release} -Requires: %{name}-devel-v2 = %{version}-%{release} - -%description unit-test -%{summary} - -This package contains unit tests for project -providing packages with %{import_path} prefix. -%endif +%{goipath} prefix. %prep -%setup -q -n yaml-%{commit} +%gosetup %setup -q -n yaml-%{v1_commit} -T -b 1 -%build - %install -# source codes for building projects -%if 0%{?with_devel} -install -d -p %{buildroot}/%{gopath}/src/%{v1_import_path}/ -install -d -p %{buildroot}/%{gopath}/src/%{v1_import_path_sec}/ -# 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/%{v1_import_path}/$(dirname $file) - cp -pav $file %{buildroot}/%{gopath}/src/%{v1_import_path}/$file - echo "%%{gopath}/src/%%{v1_import_path}/$file" >> v1_devel.file-list - install -d -p %{buildroot}/%{gopath}/src/%{v1_import_path_sec}/$(dirname $file) - cp -pav $file %{buildroot}/%{gopath}/src/%{v1_import_path_sec}/$file - echo "%%{gopath}/src/%%{v1_import_path_sec}/$file" >> v1_devel.file-list -done -pushd ../yaml-%{commit} -install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ -install -d -p %{buildroot}/%{gopath}/src/%{import_path_sec}/ -# 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" >> ../yaml-%{v1_commit}/devel.file-list - install -d -p %{buildroot}/%{gopath}/src/%{import_path_sec}/$(dirname $file) - cp -pav $file %{buildroot}/%{gopath}/src/%{import_path_sec}/$file - echo "%%{gopath}/src/%%{import_path_sec}/$file" >> ../yaml-%{v1_commit}/devel.file-list -done -popd -%endif - -# testing files for this project -%if 0%{?with_unit_test} -install -d -p %{buildroot}/%{gopath}/src/%{v1_import_path}/ -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/%{v1_import_path}/$(dirname $file) - cp -pav $file %{buildroot}/%{gopath}/src/%{v1_import_path}/$file - echo "%%{gopath}/src/%%{v1_import_path}/$file" >> unit-test.file-list -done +%goinstall +%goinstall -i %{import_path} -o devel.file-list +%goinstall -i %{import_path_sec} -o devel.file-list + +cw=$(pwd) pushd ../yaml-%{commit} -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" >> ../yaml-%{v1_commit}/unit-test.file-list -done +%goinstall -i %{v1_import_path} -o ${cw}/v1_devel.file-list +%goinstall -i %{v1_import_path_sec} -o ${cw}/v1_devel.file-list + +# TODO(jchaloup): create rpm macros for this!!! +#github.com/go-yaml/yaml -> gopkg.in/v2/yaml +pushd %{buildroot}/%{gopath}/src/%{import_path}/ +sed -i 's/"github\.com\/go-yaml\/yaml/"gopkg\.in\/v2\/yaml/g' \ + $(find . -name '*.go') +#'github.com/go-yaml/yaml -> gopkg.in/yaml.v2 +cd %{buildroot}/%{gopath}/src/%{import_path_sec}/ +sed -i 's/"github\.com\/go-yaml\/yaml/"gopkg\.in\/yaml\.v2/g' \ + $(find . -name '*.go') +#gopkg.in/v1/yaml -> gopkg.in/yaml.v1 +cd %{buildroot}/%{gopath}/src/%{v1_import_path_sec}/ +sed -i 's/"gopkg\.in\/v1\/yaml/"gopkg\.in\/yaml\.v1/g' \ + $(find . -name '*.go') popd -%endif %check -%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} -export GOPATH=%{buildroot}/%{gopath}:%{gopath} - -%if ! 0%{?gotest:1} -%global gotest go test -%endif - -%gotest %{import_path} -pushd ../yaml-%{v1_commit} -%gotest %{v1_import_path} +%gochecks +pushd %{buildroot}/%{gopath}/src/%{import_path}/ +%gochecks -i %{import_path} +cd %{buildroot}/%{gopath}/src/%{import_path_sec}/ +%gochecks popd -%endif #define license tag if not already defined %{!?_licensedir:%global license %doc} -%if 0%{?with_devel} -%files devel -f v1_devel.file-list +%%files devel -f v1_devel.file-list %license LICENSE LICENSE.libyaml %doc README.md -%dir %{gopath}/src/gopkg.in/v1 -%dir %{gopath}/src/%{v1_import_path} -%dir %{gopath}/src/%{v1_import_path_sec} %files devel-v2 -f devel.file-list %license LICENSE LICENSE.libyaml %doc README.md -%dir %{gopath}/src/gopkg.in/v2 -%dir %{gopath}/src/%{import_path} -%dir %{gopath}/src/%{import_path_sec} -%endif - -%if 0%{?with_unit_test} -%files unit-test -f unit-test.file-list -%license LICENSE LICENSE.libyaml -%doc README.md -%endif %changelog +* Tue Mar 20 2018 Jan Chaloupka - 1-21.gitcd8b52f +- Update to spec 3.0 + Bump to cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b + * Wed Feb 07 2018 Fedora Release Engineering - 1-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild