- satisfy rpmlint so it only warns and no longer fails
[opensuse:build-service.git] / dist / obs-server.spec
1 #
2 # spec file for package obs-server
3 #
4 # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
5 # This file and all modifications and additions to the pristine
6 # package are under the same license as the package itself.
7 #
8 # Please submit bugfixes or comments via http://bugs.opensuse.org/
9 #
10
11 #Distribution:   %dist
12 #Packager:       %packager
13 #Vendor:         %vendor
14
15 Name:           obs-server
16 Summary:        The openSUSE Build Service -- Server Component
17
18 Version:        1.0.0
19
20 Release:        1
21 License:        GPL
22 Group:          Productivity/Networking/Web/Utilities
23 Url:            http://en.opensuse.org/Build_Service
24 Source:         buildservice-%version.tar.bz2
25 Source1:        obsworker
26 Source3:        obspublisher
27 Source4:        obsrepserver
28 Source5:        obssrcserver
29 Source6:        obsscheduler
30 Source7:        obs.conf
31 Source8:        cleanurl-v5.lua
32 Source9:        rails.include
33 Source11:       sysconfig.obs-worker
34 Source12:       sysconfig.obs-server
35 Source13:       obs_mirror_project
36 Source15:       obsdispatcher
37 Source20:       signd.init
38 Patch:          buildservice-1.0.0-signd-pid.patch
39 Patch1:         buildservice-1.0.0-sign_conf.patch
40 Patch2:         buildservice-1.0.0-BSConfig_sign.patch
41 Patch3:         webclient-EXTERNAL_FRONTEND_HOST.patch
42 Patch4:         webclient-RAILS_GEM_VERSION.patch
43 Autoreqprov:    on
44 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
45 BuildRequires:  rubygem-builder python-devel
46
47 %if 0%{?suse_version} >= 1030
48 BuildRequires:  fdupes
49 %endif
50
51 %if 0%{?suse_version:1}
52 PreReq:         %fillup_prereq %insserv_prereq
53 %endif
54
55 %if 0%{?suse_version} >= 1020
56 Recommends:     yum yum-metadata-parser repoview dpkg
57 Recommends:     createrepo >= 0.4.10
58 %else
59 Requires:       yum yum-metadata-parser repoview dpkg
60 Requires:       createrepo >= 0.4.10
61 %endif
62 Requires:       createrepo
63 Requires:       perl-Compress-Zlib perl-Net_SSLeay perl-Socket-MsgHdr perl-XML-Parser
64
65 #-------------------------------------------------------------------------------
66 %description
67 #-------------------------------------------------------------------------------
68 Authors:
69 --------
70     The openSUSE Team <opensuse-buildservice@opensuse.org>
71
72 --------------------------------------------------------------------------------
73 #-------------------------------------------------------------------------------
74 %package -n obs-worker
75 #-------------------------------------------------------------------------------
76 Summary:        The openSUSE Build Service -- Build Host Component
77 Group:          Productivity/Networking/Web/Utilities
78
79 %if 0%{?suse_version}
80 PreReq:         %fillup_prereq %insserv_prereq
81 %endif
82 %if 0%{?suse_version} <= 1030
83 Requires:       lzma
84 %endif
85
86 Requires:       perl-TimeDate screen curl perl-XML-Parser perl-Compress-Zlib
87
88 %ifarch x86_64
89 Requires:       linux32
90 %endif
91
92 %ifarch ppc64
93 Requires:       powerpc32
94 %endif
95
96 #-------------------------------------------------------------------------------
97 %description -n obs-worker
98 #-------------------------------------------------------------------------------
99
100 #-------------------------------------------------------------------------------
101 %package -n obs-api
102 #-------------------------------------------------------------------------------
103 Summary:        The openSUSE Build Service -- The Frontend part
104 Group:          Productivity/Networking/Web/Utilities
105
106 %if 0%{?suse_version}
107 PreReq:         %fillup_prereq %insserv_prereq
108 %endif
109
110 Requires:       lighttpd ruby-fcgi lighttpd-mod_magnet mysql ruby-mysql rubygem-rake
111 Requires:       rubygem-rails >= 2.0
112
113 #-------------------------------------------------------------------------------
114 %description -n obs-api
115 #-------------------------------------------------------------------------------
116
117 #-------------------------------------------------------------------------------
118 %package -n obs-signd
119 #-------------------------------------------------------------------------------
120 Summary:        The openSUSE Build Service -- gpg sign daemon
121 Group:          Productivity/Networking/Web/Utilities
122
123 BuildRequires:  gcc
124 Requires:       gnupg
125
126 #-------------------------------------------------------------------------------
127 %description -n obs-signd
128 #-------------------------------------------------------------------------------
129 signd is a little daemon that listens for sign requests from sign,
130 and either calls gpg to do the signing or forwards the request
131 to another signd. The -f option makes signd fork on startup.
132
133 signd uses the same configuration used for sign, /etc/sign.conf.
134 It needs a gpg implementation that understands the
135 "--files-are-digests" option to work correctly.
136
137   Author:       Michael Schroeder
138
139 --------------------------------------------------------------------------------
140
141
142 #-------------------------------------------------------------------------------
143 %prep
144 #-------------------------------------------------------------------------------
145 %setup -q -n buildservice-%version
146 %patch -p1
147 %patch1 -p1
148 %patch2 -p1
149 %patch3 -p2
150 %patch4 -p2
151
152 #-------------------------------------------------------------------------------
153 %build
154 #-------------------------------------------------------------------------------
155 #
156 # generate apidocs
157 #
158 cd docs/api/frontend
159 make apidocs
160 cd -
161 #
162 # make sign binary
163 #
164 cd src/sign
165 gcc -o sign sign.c
166 cd -
167
168 #-------------------------------------------------------------------------------
169 %install
170 #-------------------------------------------------------------------------------
171 #
172 # Install all web and frontend parts.
173 #
174 cd src
175 for i in common frontend webclient; do
176   mkdir -p $RPM_BUILD_ROOT/srv/www/obs/
177   cp -a $i $RPM_BUILD_ROOT/srv/www/obs/$i
178 done
179 # configure lighttpd web service
180 mkdir -p $RPM_BUILD_ROOT/etc/lighttpd/vhosts.d/
181 install -m 0644 %SOURCE7 $RPM_BUILD_ROOT/etc/lighttpd/vhosts.d/
182 install -m 0644 %SOURCE9 $RPM_BUILD_ROOT/etc/lighttpd/vhosts.d/rails.inc
183 install -m 0644 %SOURCE8 $RPM_BUILD_ROOT/etc/lighttpd/
184 rm $RPM_BUILD_ROOT/srv/www/obs/frontend/README_LOGIN
185 rm $RPM_BUILD_ROOT/srv/www/obs/frontend/files/specfiletemplate
186 # fix path
187 for i in $RPM_BUILD_ROOT/srv/www/obs/*/config/environment.rb; do
188   sed "s,/srv/www/opensuse/common/current/lib,/srv/www/obs/common/lib," \
189     "$i" > "$i"_ && mv "$i"_ "$i"
190 done
191
192 #
193 #set default api on localhost for the webclient
194
195 sed 's,FRONTEND_HOST.*,FRONTEND_HOST = "127.0.42.2",' \
196   $RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb > tmp-file \
197   && mv tmp-file "$RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb"
198 sed 's,FRONTEND_PORT.*,FRONTEND_PORT = 80,' \
199   $RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb > tmp-file \
200   && mv tmp-file "$RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb"
201 sed 's,api.opensuse.org,127.0.42.2,' \
202   $RPM_BUILD_ROOT/srv/www/obs/webclient/app/helpers/package_helper.rb > tmp-file \
203   && mv tmp-file "$RPM_BUILD_ROOT/srv/www/obs/webclient/app/helpers/package_helper.rb"
204
205 #
206 # install apidocs
207
208 mkdir -p $RPM_BUILD_ROOT/srv/www/obs/frontend/public/apidocs/html/
209 cp -a ../docs/api/html           $RPM_BUILD_ROOT/srv/www/obs/frontend/public/apidocs/
210 mkdir -p $RPM_BUILD_ROOT/srv/www/obs/frontend/public/schema/
211 cp -a ../docs/api/frontend/*.{rng,xsd}    $RPM_BUILD_ROOT/srv/www/obs/frontend/public/schema/
212 #
213 # Install all backend parts.
214 #
215 cd backend/
216 install -d -m 755 $RPM_BUILD_ROOT/usr/lib/obs/server/
217 install -d -m 755 $RPM_BUILD_ROOT/usr/sbin/
218 install -d -m 755 $RPM_BUILD_ROOT/etc/init.d/
219 install -d -m 755 $RPM_BUILD_ROOT/srv/obs/projects
220 install -d -m 755 $RPM_BUILD_ROOT/srv/obs/log
221 install -d -m 755 $RPM_BUILD_ROOT/srv/obs/run
222 # install executables and code
223 cp -a * $RPM_BUILD_ROOT/usr/lib/obs/server/
224 # install mirror script
225 install -m 0755 %SOURCE13 $RPM_BUILD_ROOT/usr/sbin/
226 # install  runlevel scripts
227 install -m 0755 %SOURCE1 %SOURCE3 %SOURCE4 %SOURCE5 %SOURCE6 %SOURCE15 \
228            $RPM_BUILD_ROOT/etc/init.d/
229 for i in obssrcserver obsrepserver obsscheduler obsworker obspublisher obsdispatcher ; do
230   ln -sf /etc/init.d/$i $RPM_BUILD_ROOT/usr/sbin/rc$i
231 done
232 # Ship latest version of build to be always in sync. do not use the symlink.
233 rm -rf $RPM_BUILD_ROOT/usr/lib/obs/server/build
234 cp -a ../build $RPM_BUILD_ROOT/usr/lib/obs/server/build
235 # install fillups
236 FILLUP_DIR=$RPM_BUILD_ROOT/var/adm/fillup-templates
237 mkdir -p $FILLUP_DIR
238 cp -a %SOURCE11 %SOURCE12 $FILLUP_DIR/
239
240 #
241 # turn duplicates into hard links
242 #
243 #%fdupes $RPM_BUILD_ROOT/srv/www/obs/frontend
244 #%fdupes $RPM_BUILD_ROOT/srv/www/obs/webclient
245 # There's dupes between webclient and frontend:
246 %fdupes $RPM_BUILD_ROOT/srv/www/obs
247 #
248 # Install sign stuff
249 #
250 cd ../sign/
251 install -d -m 0755 $RPM_BUILD_ROOT%{_mandir}/man{5,8}
252 install -d -m 0755 $RPM_BUILD_ROOT/usr/bin
253 install -m 0755 signd $RPM_BUILD_ROOT/usr/sbin/
254 install -m 0750 sign $RPM_BUILD_ROOT/usr/bin/
255 install -m 0644 sign.conf $RPM_BUILD_ROOT/etc/
256 install -m 0755 %{S:20} $RPM_BUILD_ROOT/etc/init.d/signd
257 for j in `ls sig*.{5,8}`; do
258   gzip -9 ${j}
259 done
260 for k in 5 8; do
261   install -m 0644 sig*.${k}.gz $RPM_BUILD_ROOT%{_mandir}/man${k}/
262 done
263
264 #-------------------------------------------------------------------------------
265 %pre
266 #-------------------------------------------------------------------------------
267 /usr/sbin/groupadd -r obsrun 2> /dev/null || :
268 /usr/sbin/useradd -r -o -s /bin/false -c "User for build service backend" -d /usr/lib/obs -g obsrun obsrun 2> /dev/null || :
269
270 #-------------------------------------------------------------------------------
271 %preun
272 #-------------------------------------------------------------------------------
273 for service in obssrcserver obsrepserver obsscheduler obspublisher; do
274 %stop_on_removal $service
275 done
276
277 #-------------------------------------------------------------------------------
278 %post -n obs-server
279 #-------------------------------------------------------------------------------
280 %{fillup_and_insserv -n obs-server}
281 for service in obssrcserver obsrepserver obsscheduler obspublisher; do
282 %restart_on_update $service
283 done
284
285 #-------------------------------------------------------------------------------
286 %post -n obs-worker
287 #-------------------------------------------------------------------------------
288 %{fillup_and_insserv -n obs-worker}
289 %restart_on_update obsworker
290
291 #-------------------------------------------------------------------------------
292 %post -n obs-api
293 #-------------------------------------------------------------------------------
294 touch /srv/www/obs/{webclient,frontend}/log/development.log
295 chown lighttpd:lighttpd /srv/www/obs/{webclient,frontend}/log/development.log
296 %restart_on_update lighttpd
297
298 #-------------------------------------------------------------------------------
299 %clean
300 #-------------------------------------------------------------------------------
301 #[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && %{__rm} -rf $RPM_BUILD_ROOT
302
303 #-------------------------------------------------------------------------------
304 %files
305 #-------------------------------------------------------------------------------
306 %defattr(-,root,root)
307 %dir /usr/lib/obs
308 %dir /usr/lib/obs/server
309 %config(noreplace) /etc/sign.conf
310 /etc/init.d/obsdispatcher
311 /etc/init.d/obspublisher
312 /etc/init.d/obsrepserver
313 /etc/init.d/obsscheduler
314 /etc/init.d/obssrcserver
315 /usr/sbin/rcobsdispatcher
316 /usr/sbin/rcobspublisher
317 /usr/sbin/rcobsrepserver
318 /usr/sbin/rcobsscheduler
319 /usr/sbin/rcobssrcserver
320 /usr/sbin/obs_mirror_project
321 %attr(4750,root,obsrun) /usr/bin/sign
322 /usr/lib/obs/server/BSBuild.pm
323 /usr/lib/obs/server/BSConfig.pm
324 /usr/lib/obs/server/BSEvents.pm
325 /usr/lib/obs/server/BSFileDB.pm
326 /usr/lib/obs/server/BSHTTP.pm
327 /usr/lib/obs/server/BSHandoff.pm
328 /usr/lib/obs/server/BSRPC.pm
329 /usr/lib/obs/server/BSServer.pm
330 /usr/lib/obs/server/BSServerEvents.pm
331 /usr/lib/obs/server/BSSrcdiff.pm
332 /usr/lib/obs/server/BSSSL.pm
333 /usr/lib/obs/server/BSStdServer.pm
334 /usr/lib/obs/server/BSUtil.pm
335 /usr/lib/obs/server/BSVerify.pm
336 /usr/lib/obs/server/BSDB.pm
337 /usr/lib/obs/server/BSDBIndex.pm
338 /usr/lib/obs/server/BSXPathKeys.pm
339 /usr/lib/obs/server/BSWatcher.pm
340 /usr/lib/obs/server/BSXML.pm
341 /usr/lib/obs/server/BSXPath.pm
342 /usr/lib/obs/server/COPYING
343 /usr/lib/obs/server/DESIGN
344 /usr/lib/obs/server/License
345 /usr/lib/obs/server/README
346 /usr/lib/obs/server/TODO
347 /usr/lib/obs/server/XML
348 /usr/lib/obs/server/bs_*
349 /usr/lib/obs/server/build
350 /usr/lib/obs/server/worker
351 /usr/lib/obs/server/BSHermes.pm
352 %attr(-,obsrun,obsrun) /srv/obs
353 /var/adm/fillup-templates/sysconfig.obs-server
354 %{_mandir}/man5/*
355 %{_mandir}/man8/sign.8.gz
356
357
358 #-------------------------------------------------------------------------------
359 %files -n obs-worker
360 #-------------------------------------------------------------------------------
361 %defattr(-,root,root)
362 /var/adm/fillup-templates/sysconfig.obs-worker
363 /etc/init.d/obsworker
364 /usr/sbin/rcobsworker
365
366 #-------------------------------------------------------------------------------
367 %files -n obs-api
368 #-------------------------------------------------------------------------------
369 %defattr(-,root,root)
370 %doc dist/README.UPDATERS dist/README.SETUP docs/openSUSE.org.xml ReleaseNotes-*
371 %dir /srv/www/obs
372 /srv/www/obs/common
373 %dir /srv/www/obs/frontend
374 /srv/www/obs/frontend/app
375 /srv/www/obs/frontend/Changelog
376 /srv/www/obs/frontend/components
377 /srv/www/obs/frontend/db
378 /srv/www/obs/frontend/doc
379 /srv/www/obs/frontend/files
380 /srv/www/obs/frontend/lib
381 /srv/www/obs/frontend/public
382 /srv/www/obs/frontend/Rakefile
383 /srv/www/obs/frontend/README
384 /srv/www/obs/frontend/script
385 /srv/www/obs/frontend/test
386 /srv/www/obs/frontend/vendor
387 %dir /srv/www/obs/webclient
388 /srv/www/obs/webclient/app
389 /srv/www/obs/webclient/Changelog
390 /srv/www/obs/webclient/components
391 /srv/www/obs/webclient/db
392 /srv/www/obs/webclient/doc
393 /srv/www/obs/webclient/lib
394 /srv/www/obs/webclient/public
395 /srv/www/obs/webclient/Rakefile
396 /srv/www/obs/webclient/README
397 /srv/www/obs/webclient/script
398 /srv/www/obs/webclient/test
399 /srv/www/obs/webclient/vendor
400 #
401 # some files below config actually are _not_ config files
402 # so here we go, file by file
403 #
404 /srv/www/obs/frontend/config/boot.rb
405 /srv/www/obs/frontend/config/routes.rb
406 /srv/www/obs/frontend/config/environments/development.rb
407
408 %config(noreplace) /srv/www/obs/frontend/config/database.yml
409 %config(noreplace) /srv/www/obs/frontend/config/environment.rb
410 %config(noreplace) /srv/www/obs/frontend/config/deploy.rb.template
411 %config(noreplace) /srv/www/obs/frontend/config/lighttpd.conf
412 %config(noreplace) /srv/www/obs/frontend/config/environments/production_slave.rb
413 %config(noreplace) /srv/www/obs/frontend/config/environments/development.L12.rb
414 %config(noreplace) /srv/www/obs/frontend/config/environments/production.rb
415 %config(noreplace) /srv/www/obs/frontend/config/environments/test.rb
416 %config(noreplace) /srv/www/obs/frontend/config/environments/stage.rb
417 %config(noreplace) /srv/www/obs/frontend/config/environments/development_base.rb
418 %config(noreplace) /srv/www/obs/frontend/config/active_rbac_config.rb
419
420 /srv/www/obs/webclient/config/routes.rb
421 /srv/www/obs/webclient/config/environments/development.rb
422
423 %config(noreplace) /srv/www/obs/webclient/config/database.yml
424 %config(noreplace) /srv/www/obs/webclient/config/boot.rb
425 %config(noreplace) /srv/www/obs/webclient/config/environment.rb
426 %config(noreplace) /srv/www/obs/webclient/config/deploy.rb.template
427 %config(noreplace) /srv/www/obs/webclient/config/environments/production_slave.rb
428 %config(noreplace) /srv/www/obs/webclient/config/environments/production.rb
429 %config(noreplace) /srv/www/obs/webclient/config/environments/test.rb
430 %config(noreplace) /srv/www/obs/webclient/config/environments/stage.rb
431 %config(noreplace) /srv/www/obs/webclient/config/environments/development_base.rb
432
433 %attr(-,lighttpd,lighttpd) /srv/www/obs/frontend/log
434 %attr(-,lighttpd,lighttpd) /srv/www/obs/frontend/tmp
435 %attr(-,lighttpd,lighttpd) /srv/www/obs/webclient/log
436 %attr(-,lighttpd,lighttpd) /srv/www/obs/webclient/tmp
437 %config(noreplace) /etc/lighttpd/vhosts.d/obs.conf
438 %config /etc/lighttpd/cleanurl-v5.lua
439 %config /etc/lighttpd/vhosts.d/rails.inc
440
441 #-------------------------------------------------------------------------------
442 %files -n obs-signd
443 #-------------------------------------------------------------------------------
444 %defattr(-,root,root)
445 %config(noreplace) /etc/sign.conf
446 /etc/init.d/signd
447 /usr/sbin/signd
448 %{_mandir}/man5/*
449 %{_mandir}/man8/signd.8.gz
450
451 #-------------------------------------------------------------------------------
452 %changelog -n obs-server