source: projects/specs/trunk/g/golang-github-jessevdk-go-flags/golang-github-jessevdk-go-flags-vl.spec @ 10753

Revision 10753, 4.3 KB checked in by iwaim, 8 years ago (diff)

golang-github-jessevdk-go-flags 0.1-3

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