From da8263271b8995d86caed04ae63e6f0938d95d96 Mon Sep 17 00:00:00 2001 From: mosquito Date: Aug 24 2017 10:54:21 +0000 Subject: Initial import (#1480971) Signed-off-by: mosquito --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b8ab034 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/assert-561411b.tar.gz diff --git a/golang-github-alecthomas-assert.spec b/golang-github-alecthomas-assert.spec new file mode 100644 index 0000000..7aab495 --- /dev/null +++ b/golang-github-alecthomas-assert.spec @@ -0,0 +1,112 @@ +%global debug_package %{nil} + +%global provider github +%global provider_tld com +%global project alecthomas +%global repo assert +# https://github.com/alecthomas/assert +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} +%global import_path %{provider_prefix} +%global commit 561411bbb7e98b005e520f4c0f491c2d23782048 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +Name: golang-%{provider}-%{project}-%{repo} +Version: 0 +Release: 0.1.git%{shortcommit}%{?dist} +Summary: Units - Helpful unit multipliers and functions for Go +License: MIT +URL: https://%{provider_prefix} +Source0: %{url}/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}} +# 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}. + +%package devel +Summary: %{summary} +BuildArch: noarch +BuildRequires: golang(github.com/alecthomas/colour) +BuildRequires: golang(github.com/alecthomas/repr) +BuildRequires: golang(github.com/sergi/go-diff/diffmatchpatch) +BuildRequires: golang(github.com/stretchr/testify/require) +Requires: golang(github.com/alecthomas/colour) +Requires: golang(github.com/alecthomas/repr) +Requires: golang(github.com/sergi/go-diff/diffmatchpatch) +Provides: golang(%{import_path}) = %{version}-%{release} + +%description devel +%{summary}. + +This package contains library source intended for +building other packages which use import path with +%{import_path} prefix. + +%package unit-test-devel +Summary: Unit tests for %{name} package +BuildArch: noarch +# test subpackage tests code from devel subpackage +Requires: %{name}-devel = %{version}-%{release} + +%description unit-test-devel +%{summary}. + +This package contains unit tests for project +providing packages with %{import_path} prefix. + + +%prep +%setup -q -n %{repo}-%{commit} + +%build + +%install +# source codes for building projects +install -d -p %{buildroot}%{gopath}/src/%{import_path}/ +echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list +# find all *.go but no *_test.go files and generate devel.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 -pav $file %{buildroot}%{gopath}/src/%{import_path}/$file + echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list +done + +# testing files for this project +install -d %{buildroot}%{gopath}/src/%{import_path}/ +# find all *_test.go files and generate unit-test.file-list +for file in $(find . -iname "*_test.go"); do + dirprefix=$(dirname $file) + install -d -p %{buildroot}%{gopath}/src/%{import_path}/$dirprefix + cp -pav $file %{buildroot}%{gopath}/src/%{import_path}/$file + echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list + while [ "$dirprefix" != "." ]; do + echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list + dirprefix=$(dirname $dirprefix) + done +done + +sort -u -o devel.file-list devel.file-list + +%check +export GOPATH=%{buildroot}%{gopath}:%{gopath} + +%if ! 0%{?gotest:1} +%global gotest go test +%endif + +%gotest %{import_path}/_example ||: + +%files devel -f devel.file-list +%doc README.md +%license LICENCE.txt +%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} + +%files unit-test-devel -f unit-test-devel.file-list + +%changelog +* Fri Aug 11 2017 mosquito - 0-0.1.git561411b +- Initial package build diff --git a/sources b/sources new file mode 100644 index 0000000..5fb3a90 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (assert-561411b.tar.gz) = 5ac18f829d31f58015617860cc662917b542a0daccf30e9a37108ebc806f77abf442d3109a4657c018afbd1155f70d675e29b2a43028b00bd36b442a2762bca3