Go CLI tool for mtree support
CentOS Sources
2018-03-07 499d313920332e482831915e6a36028529c9e0df
commit | author | age
d33d43 1 %if 0%{?fedora} || 0%{?rhel} == 6
CS 2 %global with_devel 1
3 %global with_bundled 0
4 %global with_debug 0
5 %global with_check 1
6 %global with_unit_test 1
7 %else
8 %global with_devel 0
17d068 9 %global with_bundled 1
d33d43 10 %global with_debug 1
CS 11 %global with_check 0
12 %global with_unit_test 0
13 %endif
14
15 %if 0%{?with_debug}
16 %global _dwz_low_mem_die_limit 0
17 %else
18 %global debug_package   %{nil}
19 %endif
20
21 %if ! 0%{?gobuild:1}
22 %define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
23 %endif
24
25 %global provider        github
26 %global provider_tld    com
27 %global project         vbatts
28 %global repo            go-mtree
29 # https://github.com/vbatts/go-mtree
30 %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
31 %global import_path     %{provider_prefix}
499d31 32 %global commit          16da0f86ee549d8949775bf3d555e7921a9caca9
d33d43 33 %global shortcommit     %(c=%{commit}; echo ${c:0:7})
CS 34
35 Name:           gomtree
499d31 36 Version:        0.5.0
CS 37 Release:        0.2.git%{shortcommit}%{?dist}
d33d43 38 Summary:        Go CLI tool for mtree support
CS 39 License:        BSD
40 URL:            https://%{provider_prefix}
41 Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
42 # If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
43 BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
44
45 %if ! 0%{?with_bundled}
46 BuildRequires: golang(golang.org/x/crypto/ripemd160)
47 %endif
48
49 %description
50 %{summary}
51
52 %if 0%{?with_devel}
53 %package devel
54 Summary:       %{summary}
55 BuildArch:     noarch
56
57 %if 0%{?with_check} && ! 0%{?with_bundled}
58 BuildRequires: golang(golang.org/x/crypto/ripemd160)
59 %endif
60
61 Requires:      golang(golang.org/x/crypto/ripemd160)
62
63 Provides:      golang(%{import_path}) = %{version}-%{release}
64 Provides:      golang(%{import_path}/xattr) = %{version}-%{release}
65
66 %description devel
67 %{summary}
68
69 This package contains library source intended for
70 building other packages which use import path with
71 %{import_path} prefix.
72 %endif
73
74 %if 0%{?with_unit_test} && 0%{?with_devel}
75 %package unit-test-devel
76 Summary:         Unit tests for %{name} package
77 %if 0%{?with_check}
78 #Here comes all BuildRequires: PACKAGE the unit tests
79 #in %%check section need for running
80 %endif
81
82 # test subpackage tests code from devel subpackage
83 Requires:        %{name}-devel = %{version}-%{release}
84
85 %description unit-test-devel
86 %{summary}
87
88 This package contains unit tests for project
89 providing packages with %{import_path} prefix.
90 %endif
91
92 %prep
93 %setup -q -n %{repo}-%{commit}
94
95 %build
96 mkdir -p src/github.com/vbatts
97 ln -s ../../../ src/github.com/vbatts/go-mtree
98
99 %if ! 0%{?with_bundled}
100 export GOPATH=$(pwd):%{gopath}
101 %else
102 export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
103 %endif
104
105 %gobuild -o bin/%{name} %{import_path}/cmd/%{name}
106
107 %install
108 install -d -p %{buildroot}%{_bindir}
109 install -p -m 0755 bin/%{name} %{buildroot}%{_bindir}
110
111 # source codes for building projects
112 %if 0%{?with_devel}
113 install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
114 echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
115 # find all *.go but no *_test.go files and generate devel.file-list
116 for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
117     echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
118     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
119     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
120     echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
121 done
122 %endif
123
124 # testing files for this project
125 %if 0%{?with_unit_test} && 0%{?with_devel}
126 install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
127 # find all *_test.go files and generate unit-test.file-list
128 for file in $(find . -iname "*_test.go"); do
129     echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
130     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
131     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
132     echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
133 done
134 %endif
135
136 %if 0%{?with_devel}
137 sort -u -o devel.file-list devel.file-list
138 %endif
139
140 %check
141 %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
142 %if ! 0%{?with_bundled}
143 export GOPATH=%{buildroot}/%{gopath}:%{gopath}
144 %else
145 export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
146 %endif
147
148 %if ! 0%{?gotest:1}
149 %global gotest go test
150 %endif
151
152 #%%gotest %%{import_path}
153 %gotest %{import_path}/xattr
154 %endif
155
156 #define license tag if not already defined
157 %{!?_licensedir:%global license %doc}
158
159 %files
160 %license LICENSE
161 %doc README.md
162 %{_bindir}/%{name}
163
164 %if 0%{?with_devel}
165 %files devel -f devel.file-list
166 %license LICENSE
167 %doc README.md
168 %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
169 %endif
170
171 %if 0%{?with_unit_test} && 0%{?with_devel}
172 %files unit-test-devel -f unit-test-devel.file-list
173 %license LICENSE
174 %doc README.md
175 %endif
176
177 %changelog
499d31 178 * Thu Feb 01 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.5.0-0.2.git16da0f8
CS 179 - rebase to 16da0f86ee549d8949775bf3d555e7921a9caca9
180
83e98d 181 * Mon Dec 11 2017 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.4.2-2.1
CS 182 - rebase to 0.4.2 - de69569d25a8611cfac834ac4801194bc352b448
183
2d46f3 184 * Wed Jul 12 2017 fkluknav <fkluknav@redhat.com> - 0.4.0-1.1
CS 185 - rebase to 0.4.0
186
17d068 187 * Mon Apr 03 2017 Lokesh Mandvekar <lsm5@redhat.com> - 0.3.1-2.1
CS 188 - build for all available arches on 7.4
189
190 * Tue Mar 21 2017 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.3.1-2
191 - golang arches: https://bugzilla.redhat.com/show_bug.cgi?id=1418480
192
7be1e4 193 * Mon Jan 23 2017 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.3.1-1
CS 194 - Resolves: #1415321 - rebase to v0.3.1
195
a86b39 196 * Wed Dec 14 2016 Lokesh Mandvekar <lsm5@redhat.com - 0.3.0-1
CS 197 - Resolves: #1404402 - rebase to v0.3.0
198 - built commit 58660bb
199
d33d43 200 * Thu Oct 20 2016 Frantisek Kluknavsky <fkluknav@redhat.com> - 0-0.3.git8c6b32c
CS 201 - add debuginfo package (rpmdiff complains about unstripped binary)
202
203 * Mon Oct 03 2016 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0-0.2.git8c6b32c
204 - Resolves: #1380420 - import into Fedora
205 - fix binary build step
206
207 * Thu Sep 29 2016 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0-0.1.git8c6b32c
208 - First package for Fedora