source: projects/specs/trunk/g/golang-github-pkg-errors/golang-github-pkg-errors-vl.spec @ 11107

Revision 11107, 3.9 KB checked in by iwaim, 7 years ago (diff)

new: golang-github-pkg-errors

Line 
1%global with_devel 1
2%global with_bundled 0
3%global with_debug 0
4%global with_check 1
5
6%if 0%{?with_debug}
7%global _dwz_low_mem_die_limit 0
8%else
9%global debug_package   %{nil}
10%endif
11
12%global gopath %{_datadir}/gocode
13
14%define copying() \
15%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \
16%license %{*} \
17%else \
18%doc %{*} \
19%endif
20
21%global provider        github
22%global provider_tld    com
23%global project         pkg
24%global repo            errors
25# https://github.com/pkg/errors
26%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
27%global import_path     %{provider_prefix}
28
29Name:           golang-%{provider}-%{project}-%{repo}
30Version:        0.8.0
31Release:        1%{?_dist_release}
32Summary:        Simple error handling primitives for Go
33License:        BSD
34URL:            https://%{import_path}
35Source0:        errors-%{version}.tar.gz
36
37BuildRequires:  golang
38
39Vendor: Project Vine
40Distribution: Vine Linux
41Packager: iwaim
42
43# If go_arches not defined fall through to implicit golang archs
44%if 0%{?go_arches:1}
45ExclusiveArch:  %{go_arches}
46%else
47ExclusiveArch:  %{ix86} x86_64 %{arm}
48%endif
49
50%description
51%{summary}.
52
53
54
55%if 0%{?with_devel}
56%package devel
57Summary:       %{summary}
58BuildArch:     noarch
59
60%if 0%{?with_check}
61%endif
62
63Provides:      golang(%{import_path}) = %{version}-%{release}
64
65%description devel
66%{summary}.
67
68This package contains library source intended for
69building other packages which use import path with
70%{import_path} prefix.
71%endif
72
73%if 0%{?with_unit_test}
74%package unit-test
75Summary:         Unit tests for %{name} package
76# If go_arches not defined fall through to implicit golang archs
77%if 0%{?go_arches:1}
78ExclusiveArch:  %{go_arches}
79%else
80ExclusiveArch:   %{ix86} x86_64 %{arm}
81%endif
82# If gccgo_arches does not fit or is not defined fall through to golang
83%ifarch 0%{?gccgo_arches}
84BuildRequires:   gcc-go >= %{gccgo_min_vers}
85%else
86BuildRequires:   golang
87%endif
88
89%if 0%{?with_check}
90#Here comes all BuildRequires: PACKAGE the unit tests
91#in %%check section need for running
92%endif
93
94# test subpackage tests code from devel subpackage
95Requires:        %{name}-devel = %{version}-%{release}
96
97%description unit-test
98%{summary}.
99
100This package contains unit tests for project
101providing packages with %{import_path} prefix.
102%endif
103
104%prep
105%setup -q -n %{repo}-%{version}
106
107%build
108
109%install
110# source codes for building projects
111%if 0%{?with_devel}
112install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
113# find all *.go but no *_test.go files and generate unit-test.file-list
114for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
115    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
116    cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file
117    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
118done
119%endif
120
121# testing files for this project
122%if 0%{?with_unit_test}
123install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
124# find all *_test.go files and generate unit-test.file-list
125for file in $(find . -iname "*_test.go"); do
126    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
127    cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file
128    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
129done
130%endif
131
132%check
133%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
134%ifarch 0%{?gccgo_arches}
135function gotest { %{gcc_go_test} "$@"; }
136%else
137%if 0%{?golang_test:1}
138function gotest { %{golang_test} "$@"; }
139%else
140function gotest { go test "$@"; }
141%endif
142%endif
143
144export GOPATH=%{buildroot}/%{gopath}:%{gopath}
145gotest %{import_path}
146%endif
147
148%if 0%{?with_devel}
149%files devel -f devel.file-list
150%copying LICENSE
151%doc README.md
152%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
153%dir %{gopath}/src/%{import_path}
154%endif
155
156%if 0%{?with_unit_test}
157%files unit-test -f unit-test.file-list
158%copying LICENSE
159%doc README.md AUTHORS
160%endif
161
162%changelog
163* Wed Jun  7 2017 IWAI, Masaharu <iwaim.sub@gmail.com> 0.8.0-1
164- initial build for Vine Linux
165
Note: See TracBrowser for help on using the repository browser.