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

Revision 9982, 4.2 KB checked in by iwaim, 8 years ago (diff)

golang-github-jessevdk-go-flags 0.1-2

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