- prepare obs 1.0->1.0.1 update:
[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.1
19
20 Release:        0
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 BuildArch:      noarch
44 Autoreqprov:    on
45 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
46 BuildRequires:  rubygem-builder python-devel
47
48 %if 0%{?suse_version:1}
49 PreReq:         %fillup_prereq %insserv_prereq
50 %endif
51
52 %if 0%{?suse_version} >= 1020
53 Recommends:     yum yum-metadata-parser repoview dpkg
54 Recommends:     createrepo >= 0.4.10
55 %else
56 Requires:       yum yum-metadata-parser repoview dpkg
57 Requires:       createrepo >= 0.4.10
58 %endif
59 Requires:       createrepo
60 Requires:       perl-Compress-Zlib perl-Net_SSLeay perl-Socket-MsgHdr perl-XML-Parser
61
62 #-------------------------------------------------------------------------------
63 %description
64 #-------------------------------------------------------------------------------
65 Authors:
66 --------
67     The openSUSE Team <opensuse-buildservice@opensuse.org>
68
69 --------------------------------------------------------------------------------
70 #-------------------------------------------------------------------------------
71 %package -n obs-worker
72 #-------------------------------------------------------------------------------
73 Summary:        The openSUSE Build Service -- Build Host Component
74 Group:          Productivity/Networking/Web/Utilities
75
76 %if 0%{?suse_version}
77 PreReq:         %fillup_prereq %insserv_prereq
78 %endif
79 %if 0%{?suse_version} <= 1030
80 Requires:       lzma
81 %endif
82
83 Requires:       perl-TimeDate screen curl perl-XML-Parser perl-Compress-Zlib
84
85 %ifarch x86_64
86 Requires:       linux32
87 %endif
88
89 %ifarch ppc64
90 Requires:       powerpc32
91 %endif
92
93 #-------------------------------------------------------------------------------
94 %description -n obs-worker
95 #-------------------------------------------------------------------------------
96
97 #-------------------------------------------------------------------------------
98 %package -n obs-api
99 #-------------------------------------------------------------------------------
100 Summary:        The openSUSE Build Service -- The Frontend part
101 Group:          Productivity/Networking/Web/Utilities
102
103 %if 0%{?suse_version}
104 PreReq:         %fillup_prereq %insserv_prereq
105 %endif
106
107 Requires:       lighttpd ruby-fcgi lighttpd-mod_magnet mysql ruby-mysql rubygem-rake
108 Requires:       rubygem-rails >= 2.0
109
110 #-------------------------------------------------------------------------------
111 %description -n obs-api
112 #-------------------------------------------------------------------------------
113
114 #-------------------------------------------------------------------------------
115 %package -n obs-signd
116 #-------------------------------------------------------------------------------
117 Summary:        The openSUSE Build Service -- gpg sign daemon
118 Group:          Productivity/Networking/Web/Utilities
119
120 BuildRequires:  gcc
121 Requires:       gnupg
122
123 #-------------------------------------------------------------------------------
124 %description -n obs-signd
125 #-------------------------------------------------------------------------------
126 signd is a little daemon that listens for sign requests from sign,
127 and either calls gpg to do the signing or forwards the request
128 to another signd. The -f option makes signd fork on startup.
129
130 signd uses the same configuration used for sign, /etc/sign.conf.
131 It needs a gpg implementation that understands the
132 "--files-are-digests" option to work correctly.
133
134   Author:       Michael Schroeder
135
136 --------------------------------------------------------------------------------
137
138
139 #-------------------------------------------------------------------------------
140 %prep
141 #-------------------------------------------------------------------------------
142 %setup -q -n buildservice-%version
143 %patch -p1
144 %patch1 -p1
145 %patch2 -p1
146 %patch3 -p2
147 %patch4 -p2
148
149 #-------------------------------------------------------------------------------
150 %build
151 #-------------------------------------------------------------------------------
152 #
153 # generate apidocs
154 #
155 cd docs/api/frontend
156 make apidocs
157 cd -
158 cd src/sign
159 gcc -o sign sign.c
160 cd -
161
162 #-------------------------------------------------------------------------------
163 %install
164 #-------------------------------------------------------------------------------
165 #
166 # Install all web and frontend parts.
167 #
168 cd src
169 for i in common frontend webclient; do
170   mkdir -p $RPM_BUILD_ROOT/srv/www/obs/
171   cp -a $i $RPM_BUILD_ROOT/srv/www/obs/$i
172 done
173 # configure lighttpd web service
174 mkdir -p $RPM_BUILD_ROOT/etc/lighttpd/vhosts.d/
175 install -m 0644 %SOURCE7 $RPM_BUILD_ROOT/etc/lighttpd/vhosts.d/
176 install -m 0644 %SOURCE9 $RPM_BUILD_ROOT/etc/lighttpd/vhosts.d/rails.inc
177 install -m 0644 %SOURCE8 $RPM_BUILD_ROOT/etc/lighttpd/
178 rm $RPM_BUILD_ROOT/srv/www/obs/frontend/README_LOGIN
179 rm $RPM_BUILD_ROOT/srv/www/obs/frontend/files/specfiletemplate
180 # fix path
181 for i in $RPM_BUILD_ROOT/srv/www/obs/*/config/environment.rb; do
182   sed "s,/srv/www/opensuse/common/current/lib,/srv/www/obs/common/lib," \
183     "$i" > "$i"_ && mv "$i"_ "$i"
184 done
185
186 #
187 #set default api on localhost for the webclient
188
189 sed 's,FRONTEND_HOST.*,FRONTEND_HOST = "127.0.42.2",' \
190   $RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb > tmp-file \
191   && mv tmp-file "$RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb"
192 sed 's,FRONTEND_PORT.*,FRONTEND_PORT = 80,' \
193   $RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb > tmp-file \
194   && mv tmp-file "$RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb"
195 sed 's,api.opensuse.org,127.0.42.2,' \
196   $RPM_BUILD_ROOT/srv/www/obs/webclient/app/helpers/package_helper.rb > tmp-file \
197   && mv tmp-file "$RPM_BUILD_ROOT/srv/www/obs/webclient/app/helpers/package_helper.rb"
198
199 #
200 # install apidocs
201
202 mkdir -p $RPM_BUILD_ROOT/srv/www/obs/frontend/public/apidocs/html/
203 cp -a ../docs/api/html           $RPM_BUILD_ROOT/srv/www/obs/frontend/public/apidocs/
204 mkdir -p $RPM_BUILD_ROOT/srv/www/obs/frontend/public/schema/
205 cp -a ../docs/api/frontend/*.{rng,xsd}    $RPM_BUILD_ROOT/srv/www/obs/frontend/public/schema/
206 #
207 # Install all backend parts.
208 #
209 cd backend/
210 install -d -m 755 $RPM_BUILD_ROOT/usr/lib/obs/server/
211 install -d -m 755 $RPM_BUILD_ROOT/usr/sbin/
212 install -d -m 755 $RPM_BUILD_ROOT/etc/init.d/
213 install -d -m 755 $RPM_BUILD_ROOT/srv/obs/projects
214 install -d -m 755 $RPM_BUILD_ROOT/srv/obs/log
215 install -d -m 755 $RPM_BUILD_ROOT/srv/obs/run
216 # install executables and code
217 cp -a * $RPM_BUILD_ROOT/usr/lib/obs/server/
218 # install mirror script
219 install -m 0755 %SOURCE13 $RPM_BUILD_ROOT/usr/sbin/
220 # install  runlevel scripts
221 install -m 0755 %SOURCE1 %SOURCE3 %SOURCE4 %SOURCE5 %SOURCE6 %SOURCE15 \
222            $RPM_BUILD_ROOT/etc/init.d/
223 for i in obssrcserver obsrepserver obsscheduler obsworker obspublisher obsdispatcher ; do
224   ln -sf /etc/init.d/$i $RPM_BUILD_ROOT/usr/sbin/rc$i
225 done
226 # Ship latest version of build to be always in sync. do not use the symlink.
227 rm -rf $RPM_BUILD_ROOT/usr/lib/obs/server/build
228 cp -a ../build $RPM_BUILD_ROOT/usr/lib/obs/server/build
229 # install fillups
230 FILLUP_DIR=$RPM_BUILD_ROOT/var/adm/fillup-templates
231 mkdir -p $FILLUP_DIR
232 cp -a %SOURCE11 %SOURCE12 $FILLUP_DIR/
233
234 #
235 # Install sign stuff
236 #
237 cd ../sign/
238 install -d -m 0755 $RPM_BUILD_ROOT%{_mandir}/man{5,8}
239 install -d -m 0755 $RPM_BUILD_ROOT/usr/bin
240 install -m 0755 signd $RPM_BUILD_ROOT/usr/sbin/
241 install -m 0750 sign $RPM_BUILD_ROOT/usr/bin/
242 install -m 0644 sign.conf $RPM_BUILD_ROOT/etc/
243 install -m 0755 %{S:20} $RPM_BUILD_ROOT/etc/init.d/signd
244 for j in `ls sig*.{5,8}`; do
245   gzip -9 ${j}
246 done
247 for k in 5 8; do
248   install -m 0644 sig*.${k}.gz $RPM_BUILD_ROOT%{_mandir}/man${k}/
249 done
250
251 #-------------------------------------------------------------------------------
252 %pre
253 #-------------------------------------------------------------------------------
254 /usr/sbin/groupadd -r obsrun 2> /dev/null || :
255 /usr/sbin/useradd -r -o -s /bin/false -c "User for build service backend" -d /usr/lib/obs -g obsrun obsrun 2> /dev/null || :
256
257 #-------------------------------------------------------------------------------
258 %preun
259 #-------------------------------------------------------------------------------
260 for service in obssrcserver obsrepserver obsscheduler obspublisher; do
261 %stop_on_removal $service
262 done
263
264 #-------------------------------------------------------------------------------
265 %post -n obs-server
266 #-------------------------------------------------------------------------------
267 %{fillup_and_insserv -n obs-server}
268 for service in obssrcserver obsrepserver obsscheduler obspublisher; do
269 %restart_on_update $service
270 done
271
272 #-------------------------------------------------------------------------------
273 %post -n obs-worker
274 #-------------------------------------------------------------------------------
275 %{fillup_and_insserv -n obs-worker}
276 %restart_on_update obsworker
277
278 #-------------------------------------------------------------------------------
279 %post -n obs-api
280 #-------------------------------------------------------------------------------
281 touch /srv/www/obs/{webclient,frontend}/log/development.log
282 chown lighttpd:lighttpd /srv/www/obs/{webclient,frontend}/log/development.log
283 %restart_on_update lighttpd
284
285 #-------------------------------------------------------------------------------
286 %clean
287 #-------------------------------------------------------------------------------
288 [ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && %{__rm} -rf $RPM_BUILD_ROOT
289
290 #-------------------------------------------------------------------------------
291 %files
292 #-------------------------------------------------------------------------------
293 %defattr(-,root,root)
294 %dir /usr/lib/obs
295 %dir /usr/lib/obs/server
296 %config(noreplace) /etc/sign.conf
297 /etc/init.d/obsdispatcher
298 /etc/init.d/obspublisher
299 /etc/init.d/obsrepserver
300 /etc/init.d/obsscheduler
301 /etc/init.d/obssrcserver
302 /usr/sbin/rcobsdispatcher
303 /usr/sbin/rcobspublisher
304 /usr/sbin/rcobsrepserver
305 /usr/sbin/rcobsscheduler
306 /usr/sbin/rcobssrcserver
307 /usr/sbin/obs_mirror_project
308 %attr(4750,root,obsrun) /usr/bin/sign
309 /usr/lib/obs/server/BSBuild.pm
310 /usr/lib/obs/server/BSConfig.pm
311 /usr/lib/obs/server/BSEvents.pm
312 /usr/lib/obs/server/BSFileDB.pm
313 /usr/lib/obs/server/BSHTTP.pm
314 /usr/lib/obs/server/BSHandoff.pm
315 /usr/lib/obs/server/BSRPC.pm
316 /usr/lib/obs/server/BSServer.pm
317 /usr/lib/obs/server/BSServerEvents.pm
318 /usr/lib/obs/server/BSSrcdiff.pm
319 /usr/lib/obs/server/BSSSL.pm
320 /usr/lib/obs/server/BSStdServer.pm
321 /usr/lib/obs/server/BSUtil.pm
322 /usr/lib/obs/server/BSVerify.pm
323 /usr/lib/obs/server/BSDB.pm
324 /usr/lib/obs/server/BSDBIndex.pm
325 /usr/lib/obs/server/BSXPathKeys.pm
326 /usr/lib/obs/server/BSWatcher.pm
327 /usr/lib/obs/server/BSXML.pm
328 /usr/lib/obs/server/BSXPath.pm
329 /usr/lib/obs/server/COPYING
330 /usr/lib/obs/server/DESIGN
331 /usr/lib/obs/server/License
332 /usr/lib/obs/server/README
333 /usr/lib/obs/server/TODO
334 /usr/lib/obs/server/XML
335 /usr/lib/obs/server/bs_*
336 /usr/lib/obs/server/build
337 /usr/lib/obs/server/worker
338 /usr/lib/obs/server/BSHermes.pm
339 %attr(-,obsrun,obsrun) /srv/obs
340 /var/adm/fillup-templates/sysconfig.obs-server
341 %{_mandir}/man5/*
342 %{_mandir}/man8/sign.8.gz
343
344
345 #-------------------------------------------------------------------------------
346 %files -n obs-worker
347 #-------------------------------------------------------------------------------
348 %defattr(-,root,root)
349 /var/adm/fillup-templates/sysconfig.obs-worker
350 /etc/init.d/obsworker
351 /usr/sbin/rcobsworker
352
353 #-------------------------------------------------------------------------------
354 %files -n obs-api
355 #-------------------------------------------------------------------------------
356 %defattr(-,root,root)
357 %doc dist/README.UPDATERS dist/README.SETUP docs/openSUSE.org.xml ReleaseNotes-*
358 %dir /srv/www/obs
359 /srv/www/obs/common
360 %dir /srv/www/obs/frontend
361 /srv/www/obs/frontend/app
362 /srv/www/obs/frontend/Changelog
363 /srv/www/obs/frontend/components
364 /srv/www/obs/frontend/db
365 /srv/www/obs/frontend/doc
366 /srv/www/obs/frontend/files
367 /srv/www/obs/frontend/lib
368 /srv/www/obs/frontend/public
369 /srv/www/obs/frontend/Rakefile
370 /srv/www/obs/frontend/README
371 /srv/www/obs/frontend/script
372 /srv/www/obs/frontend/test
373 /srv/www/obs/frontend/vendor
374 %dir /srv/www/obs/webclient
375 /srv/www/obs/webclient/app
376 /srv/www/obs/webclient/Changelog
377 /srv/www/obs/webclient/components
378 /srv/www/obs/webclient/db
379 /srv/www/obs/webclient/doc
380 /srv/www/obs/webclient/lib
381 /srv/www/obs/webclient/public
382 /srv/www/obs/webclient/Rakefile
383 /srv/www/obs/webclient/README
384 /srv/www/obs/webclient/script
385 /srv/www/obs/webclient/test
386 /srv/www/obs/webclient/vendor
387 %config(noreplace) /srv/www/obs/frontend/config
388 %config(noreplace) /srv/www/obs/webclient/config
389 %attr(-,lighttpd,lighttpd) /srv/www/obs/frontend/log
390 %attr(-,lighttpd,lighttpd) /srv/www/obs/frontend/tmp
391 %attr(-,lighttpd,lighttpd) /srv/www/obs/webclient/log
392 %attr(-,lighttpd,lighttpd) /srv/www/obs/webclient/tmp
393 %config(noreplace) /etc/lighttpd/vhosts.d/obs.conf
394 %config /etc/lighttpd/cleanurl-v5.lua
395 %config /etc/lighttpd/vhosts.d/rails.inc
396
397 #-------------------------------------------------------------------------------
398 %files -n obs-signd
399 #-------------------------------------------------------------------------------
400 %defattr(-,root,root)
401 %config(noreplace) /etc/sign.conf
402 /etc/init.d/signd
403 /usr/sbin/signd
404 %{_mandir}/man5/*
405 %{_mandir}/man8/signd.8.gz
406
407 #-------------------------------------------------------------------------------
408 %changelog -n obs-server