A tool for building artifacts from source and injecting into docker images
CentOS Sources
2019-01-08 9b2d87f3d26fca5308f42c9a9b5eeca56f8875f8
commit | author | age
b836de 1 %if 0%{?fedora} || 0%{?rhel} == 6
CS 2 %global with_devel 1
3 %global with_bundled 1
9b2d87 4 %global with_debug 0
b836de 5 %global with_check 1
CS 6 %global with_unit_test 1
7 %else
8 %global with_devel 0
9 %global with_bundled 1
10 %global with_debug 0
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         openshift
28 %global repo            source-to-image
29 # https://github.com/openshift/source-to-image
30 %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
31 %global import_path     %{provider_prefix}
9b2d87 32 %global commit          b54d75d3de92d123e68a79c6ee09c2c5fe44e720
b836de 33 %global shortcommit     %(c=%{commit}; echo ${c:0:7})
CS 34
35 %global majorFromGit    1
9b2d87 36 %global minorFromGit    1+
CS 37 %global versionFromGit  v1.1.13
b836de 38 %global commitFromGit   %{commit}
CS 39
40
41 Name:           %{repo}
9b2d87 42 Version:        1.1.13
47e51b 43 Release:        1%{?dist}
b836de 44 Summary:        A tool for building artifacts from source and injecting into docker images
CS 45 License:        ASL 2.0
46 URL:            https://%{provider_prefix}
9b2d87 47 Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{version}.tar.gz
b836de 48
CS 49 # e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
50 ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
9b2d87 51 # there is no docker on ppc64, only on ppc64le
CS 52 # https://bugzilla.redhat.com/show_bug.cgi?id=1465159
53 ExcludeArch: ppc64
b836de 54 # If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
CS 55 BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
56
57 %if ! 0%{?with_bundled}
58 BuildRequires: golang(github.com/fsouza/go-dockerclient)
59 BuildRequires: golang(github.com/golang/glog)
60 BuildRequires: golang(github.com/spf13/cobra)
61 BuildRequires: golang(github.com/spf13/pflag)
62 %endif
63
64 Requires:      docker
65 Requires:      git
66 Requires:      tar
67
9b2d87 68 Provides:      s2i = %{version}-%{release}
CS 69
b836de 70 %description
CS 71 %{summary}
72
73 %if 0%{?with_devel}
74 %package devel
75 Summary:       %{summary}
76 BuildArch:     noarch
77
78 %if 0%{?with_check}
79 BuildRequires: golang(github.com/fsouza/go-dockerclient)
80 BuildRequires: golang(github.com/golang/glog)
81 BuildRequires: golang(github.com/spf13/cobra)
82 BuildRequires: golang(github.com/spf13/pflag)
83 %endif
84
85 Requires:      golang(github.com/fsouza/go-dockerclient)
86 Requires:      golang(github.com/golang/glog)
87 Requires:      golang(github.com/spf13/cobra)
88 Requires:      golang(github.com/spf13/pflag)
89
90 Provides:      golang(%{import_path}) = %{version}-%{release}
91 Provides:      golang(%{import_path}/pkg/api) = %{version}-%{release}
92 Provides:      golang(%{import_path}/pkg/api/describe) = %{version}-%{release}
93 Provides:      golang(%{import_path}/pkg/api/validation) = %{version}-%{release}
94 Provides:      golang(%{import_path}/pkg/build) = %{version}-%{release}
95 Provides:      golang(%{import_path}/pkg/build/ignore) = %{version}-%{release}
96 Provides:      golang(%{import_path}/pkg/build/strategies) = %{version}-%{release}
97 Provides:      golang(%{import_path}/pkg/build/strategies/layered) = %{version}-%{release}
98 Provides:      golang(%{import_path}/pkg/build/strategies/onbuild) = %{version}-%{release}
99 Provides:      golang(%{import_path}/pkg/build/strategies/sti) = %{version}-%{release}
9b2d87 100 Provides:      golang(%{import_path}/pkg/cmd) = %{version}-%{release}
b836de 101 Provides:      golang(%{import_path}/pkg/config) = %{version}-%{release}
CS 102 Provides:      golang(%{import_path}/pkg/create) = %{version}-%{release}
103 Provides:      golang(%{import_path}/pkg/create/templates) = %{version}-%{release}
104 Provides:      golang(%{import_path}/pkg/docker) = %{version}-%{release}
105 Provides:      golang(%{import_path}/pkg/docker/test) = %{version}-%{release}
106 Provides:      golang(%{import_path}/pkg/errors) = %{version}-%{release}
107 Provides:      golang(%{import_path}/pkg/ignore) = %{version}-%{release}
108 Provides:      golang(%{import_path}/pkg/run) = %{version}-%{release}
9b2d87 109 Provides:      golang(%{import_path}/pkg/scm) = %{version}-%{release}
CS 110 Provides:      golang(%{import_path}/pkg/scm/empty) = %{version}-%{release}
111 Provides:      golang(%{import_path}/pkg/scm/file) = %{version}-%{release}
112 Provides:      golang(%{import_path}/pkg/scm/git) = %{version}-%{release}
b836de 113 Provides:      golang(%{import_path}/pkg/scripts) = %{version}-%{release}
CS 114 Provides:      golang(%{import_path}/pkg/tar) = %{version}-%{release}
115 Provides:      golang(%{import_path}/pkg/test) = %{version}-%{release}
116 Provides:      golang(%{import_path}/pkg/util) = %{version}-%{release}
117 Provides:      golang(%{import_path}/pkg/util/user) = %{version}-%{release}
118 Provides:      golang(%{import_path}/pkg/version) = %{version}-%{release}
119 Provides:      golang(%{import_path}/test/integration) = %{version}-%{release}
120
121 %description devel
122 %{summary}
123
124 This package contains library source intended for
125 building other packages which use import path with
126 %{import_path} prefix.
127 %endif
128
129 %if 0%{?with_unit_test} && 0%{?with_devel}
130 %package unit-test
131 Summary:         Unit tests for %{name} package
132 # If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
9b2d87 133 # If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
b836de 134 BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
CS 135
136 %if 0%{?with_check}
137 #Here comes all BuildRequires: PACKAGE the unit tests
138 #in %%check section need for running
139 %endif
140
141 # test subpackage tests code from devel subpackage
142 Requires:        %{name}-devel = %{version}-%{release}
143
144 %description unit-test
145 %{summary}
146
147 This package contains unit tests for project
148 providing packages with %{import_path} prefix.
149 %endif
150
151 %prep
9b2d87 152 %setup -q -n %{repo}-%{version}
b836de 153
CS 154 %build
155 mkdir -p src/github.com/openshift
156 ln -s ../../../ src/github.com/openshift/source-to-image
157
158 %if ! 0%{?with_bundled}
159 export GOPATH=$(pwd):%{gopath}
160 %else
161 export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
162 %endif
163
164 export STI_GIT_MAJOR=1.0
165 export STI_GIT_MINOR=2
166 export STI_GIT_VERSION=%{commit}
167
9b2d87 168 export LDFLAGS="\
CS 169     -X %{import_path}/pkg/version.majorFromGit=%{majorFromGit} \
170     -X %{import_path}/pkg/version.minorFromGit=%{minorFromGit} \
171     -X %{import_path}/pkg/version.versionFromGit=%{versionFromGit} \
172     -X %{import_path}/pkg/version.commitFromGit=%{commitFromGit}"
173 %gobuild -o bin/s2i %{import_path}/cmd/s2i
b836de 174
CS 175 %install
176 install -d -p %{buildroot}%{_bindir}
177 install -p -m 0755 bin/s2i %{buildroot}%{_bindir}
178
179 # source codes for building projects
180 %if 0%{?with_devel}
181 install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
182 echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
183 # find all *.go but no *_test.go files and generate devel.file-list
9b2d87 184 for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
b836de 185     echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
CS 186     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
187     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
188     echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
189 done
190 %endif
191
192 # testing files for this project
193 %if 0%{?with_unit_test} && 0%{?with_devel}
194 install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
195 # find all *_test.go files and generate unit-test.file-list
9b2d87 196 for file in $(find . -iname "*_test.go"); do
b836de 197     echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
CS 198     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
199     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
200     echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
201 done
202 %endif
203
204 %if 0%{?with_devel}
205 sort -u -o devel.file-list devel.file-list
206 %endif
207
208 %check
209 %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
210 %if ! 0%{?with_bundled}
211 export GOPATH=%{buildroot}/%{gopath}:%{gopath}
212 %else
213 export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
214 %endif
215
216 %if ! 0%{?gotest:1}
217 %global gotest go test
218 %endif
219
9b2d87 220 %gotest %{import_path}/pkg/api
CS 221 %gotest %{import_path}/pkg/api/validation
b836de 222 %gotest %{import_path}/pkg/build/strategies/layered
CS 223 %gotest %{import_path}/pkg/build/strategies/onbuild
224 %gotest %{import_path}/pkg/build/strategies/sti
225 %gotest %{import_path}/pkg/docker
226 %gotest %{import_path}/pkg/ignore
9b2d87 227 #%%gotest %%{import_path}/pkg/scm
CS 228 #%gotest %{import_path}/pkg/scm/git
b836de 229 %gotest %{import_path}/pkg/scripts
CS 230 %gotest %{import_path}/pkg/tar
231 %gotest %{import_path}/pkg/util
232 %gotest %{import_path}/pkg/util/user
233 %gotest %{import_path}/test/integration
234 %endif
235
236 #define license tag if not already defined
237 %{!?_licensedir:%global license %doc}
238
239 %files
240 %license LICENSE
241 %doc README.md CONTRIBUTING.md AUTHORS
242 %{_bindir}/s2i
243
244 %if 0%{?with_devel}
245 %files devel -f devel.file-list
246 %license LICENSE
247 %doc README.md CONTRIBUTING.md AUTHORS
248 %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
249 %endif
250
251 %if 0%{?with_unit_test} && 0%{?with_devel}
252 %files unit-test -f unit-test.file-list
253 %license LICENSE
254 %doc README.md CONTRIBUTING.md AUTHORS
255 %endif
256
257 %changelog
9b2d87 258 * Wed Dec 12 2018 Honza Horak <hhorak@redhat.com> - 1.1.13-1
CS 259 - Update to 1.1.13
260   Also fixes CVE-2018-1102
261   Resolves: #1654243
262
263 * Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.7-3
264 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
265
266 * Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.7-2
267 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
268
269 * Tue Nov 07 2017 Jan Chaloupka <jchaloup@redhat.com> - 1.1.7-1
270 - Update to v1.1.7
271   resolves: #1510476
272
273 * Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.9-7
274 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
275
276 * Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.9-6
277 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
278
279 * Mon Jun 26 2017 Till Maas <opensource@till.name> - 1.0.9-5
280 - Do not build on ppc64 (does not contain docker)
281
282 * Mon May 15 2017 Jan Chaloupka <jchaloup@redhat.com> - 1.0.9-4
283 - Fix go-1.8 -X importpath/name=value syntax
284
285 * Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.9-3
286 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
287
288 * Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.9-2
289 - https://fedoraproject.org/wiki/Changes/golang1.7
290
291 * Sat May 21 2016 jchaloup <jchaloup@redhat.com> - 1.0.9-1
292 - Update to v1.0.9
293   resolves: #1273677
294
295 * Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.4-3
296 - https://fedoraproject.org/wiki/Changes/golang1.6
297
298 * Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-2
299 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
300
301 * Thu Dec 10 2015 Tomas Hrcka <thrcka@redhat.com> - 1.0.4-1
302 - New upstream release
303 - https://github.com/openshift/source-to-image/releases/tag/v1.0.4
304
305 * Thu Oct 22 2015 Tomas Hrcka <thrcka@redhat.com> - 1.0.3-2
306 - Rebase to new upstream version
307 - Package now provides s2i
308 - Disable tests removed by upstream
47e51b 309
b836de 310 * Thu Sep 17 2015 Tomas Hrcka <thrcka@redhat.com> - 1.0.2-4
CS 311 - Fix dependencies
312 - Remove -devel sub package
313
314 * Tue Sep 15 2015 Tomas Hrcka <thrcka@redhat.com> - 1.0.2-2
315 - Build the right directory
316
317 * Mon Sep 14 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.git00d1cb3
318 - First package for Fedora
319
320