Merge 0.30.214.
[util-vserver.git] / util-vserver.spec
1 # $Id: util-vserver.spec.in 2575 2007-08-05 18:35:40Z dhozac $
2
3 ## This package understands the following switches:
4 ## --without dietlibc        ...   disable usage of dietlibc
5 ## --with xalan              ...   require/use the xalan xslt processor
6 ## --without doc             ...   disable doc generation
7 ## --with legacy             ...   enable the legacy APIs
8
9 %global confdir         %_sysconfdir/vservers
10 %global confdefaultdir  %confdir/.defaults
11 %global pkglibdir       %_libdir/%name
12 %global chkconfig       /sbin/chkconfig
13
14 %global _localstatedir  %_var
15
16 %global ver             %( echo 0.30.214 | sed 's/-.*//' )
17 %global subver          %( s=`echo 0.30.214 | grep -- - | sed 's/.*-/./'`; echo ${s:-.1} )
18 %global fullver         0.30.214
19
20
21 %define name util-vserver
22 %define version 0.30.214
23 %{!?release_func:%global release_func() 1%{?pldistro:.%{pldistro}}%{?date:.%{date}}}
24
25 %global python_sitearch %( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" )
26
27 %define _without_dietlibc 1
28 %define _without_xalan 1
29
30 # don't build debuginfo RPM
31 %define debug_package %{nil}
32
33 Vendor: PlanetLab
34 Packager: PlanetLab Central <support@planet-lab.org>
35 Distribution: PlanetLab 3.0
36 URL: http://cvs.planet-lab.org/cvs/util-vserver
37
38 Summary:        Linux virtual server utilities
39 Name:           util-vserver
40 Version:        %ver
41 Release:        %release_func 0%subver
42 License:        GPL
43 Group:          System Environment/Base
44 #URL:           http://savannah.nongnu.org/projects/util-vserver/
45 Source0:        http://ftp.linux-vserver.org/pub/utils/util-vserver/%name-%version.tar.bz2
46 #Source1:       http://ftp.linux-vserver.org/pub/utils/util-vserver/%name-%version.tar.bz2.asc
47 BuildRoot:      %_tmppath/%name-%version-%release-root
48 Requires:       init(%name)
49 Requires:       %name-core = %version-%release
50 Requires:       %name-lib  = %version-%release
51 Requires:       diffutils mktemp sed
52 Provides:       vserver = %version-%release
53 Obsoletes:      vserver < %version
54 BuildRequires:  mount vconfig gawk iproute iptables
55 BuildRequires:  gcc-c++ wget which diffutils
56 BuildRequires:  e2fsprogs-devel beecrypt-devel
57 %{!?_without_doc:BuildRequires: doxygen tetex-latex}
58 Requires(post):         %name-core
59 Requires(pre):          %pkglibdir
60 Requires(postun):       %pkglibdir
61 %{!?_without_dietlibc:BuildRequires:    dietlibc >= 0:0.25}
62 %{?_with_xalan:BuildRequires:   xalan-j}
63
64 %package lib
65 Summary:                Dynamic libraries for util-vserver
66 Group:                  System Environment/Libraries
67
68 %package core
69 Summary:                The core-utilities for util-vserver
70 Group:                  Applications/System
71 Requires:               util-linux
72
73 %package build
74 Summary:                Tools which can be used to build vservers
75 Group:                  Applications/System
76 Requires:               rpm wget tar
77 Requires:               %name = %version-%release
78 Requires(pre):          %confdir
79 Requires(postun):       %confdir
80 Requires(post):         %name-core
81
82 %package sysv
83 Summary:                SysV-initscripts for vserver
84 Group:                  System Environment/Base
85 Provides:               init(%name) = sysv
86 Requires:               make diffutils
87 Requires:               initscripts
88 Requires:               %name = %version-%release
89 Requires(post):         %chkconfig
90 Requires(preun):        %chkconfig
91 Requires(pre):          %_initrddir %pkglibdir
92 requires(postun):       %_initrddir %pkglibdir
93
94 %package legacy
95 Summary:                Legacy utilities for util-vserver
96 Group:                  Applications/System
97 Requires:               %name = %version-%release
98 Requires(post):         %chkconfig
99 Requires(preun):        %chkconfig
100 Requires(pre):          %_initrddir %pkglibdir
101 requires(postun):       %_initrddir %pkglibdir
102
103 %package devel
104 Summary:                Header-files and libraries needed to develop vserver based applications
105 Group:                  Development/Libraries
106 Requires:               pkgconfig
107 Requires:               %name-lib = %version-%release
108
109 %package python
110 Summary:                Python modules for manipulating vservers
111 Group:                  Applications/System
112 Requires:               python
113 Obsoletes:              util-vserver-py23 resman
114
115
116 %description
117 util-vserver provides the components and a framework to setup virtual
118 servers.  A virtual server runs inside a linux server. It is nevertheless
119 highly independent. As such, you can run various services with normal
120 configuration. The various vservers can't interact with each other and
121 can't interact with services in the main server.
122
123 This requires a special kernel supporting the new new_s_context and
124 set_ipv4root system call.
125
126 %description lib
127 util-vserver provides the components and a framework to setup virtual
128 servers.  A virtual server runs inside a linux server. It is nevertheless
129 highly independent. As such, you can run various services with normal
130 configuration. The various vservers can't interact with each other and
131 can't interact with services in the main server.
132
133 This package contains the shared libraries needed by all other
134 'util-vserver' subpackages.
135
136 %description core
137 util-vserver provides the components and a framework to setup virtual
138 servers.  A virtual server runs inside a linux server. It is nevertheless
139 highly independent. As such, you can run various services with normal
140 configuration. The various vservers can't interact with each other and
141 can't interact with services in the main server.
142
143 This package contains utilities which are required to communicate with
144 the Linux-Vserver enabled kernel.
145
146
147 %description build
148 util-vserver provides the components and a framework to setup virtual
149 servers.  A virtual server runs inside a linux server. It is nevertheless
150 highly independent. As such, you can run various services with normal
151 configuration. The various vservers can't interact with each other and
152 can't interact with services in the main server.
153
154 This package contains utilities which assist in building Vservers.
155
156 %description sysv
157 util-vserver provides the components and a framework to setup virtual
158 servers.  A virtual server runs inside a linux server. It is nevertheless
159 highly independent. As such, you can run various services with normal
160 configuration. The various vservers can't interact with each other and
161 can't interact with services in the main server.
162
163 This package contains the SysV initscripts which start and stop
164 VServers and related tools.
165
166
167 %description legacy
168 util-vserver provides the components and a framework to setup virtual
169 servers.  A virtual server runs inside a linux server. It is nevertheless
170 highly independent. As such, you can run various services with normal
171 configuration. The various vservers can't interact with each other and
172 can't interact with services in the main server.
173
174 This package contains the tools which are needed to work with VServers
175 having an old-style configuration.
176
177
178 %description devel
179 util-vserver provides the components and a framework to setup virtual
180 servers.  A virtual server runs inside a linux server. It is nevertheless
181 highly independent. As such, you can run various services with normal
182 configuration. The various vservers can't interact with each other and
183 can't interact with services in the main server.
184
185 This package contains header files and libraries which are needed to
186 develop VServer related applications.
187
188
189 %description python
190 Python modules for manipulating vservers.  Provides a superset of the
191 functionality of the vserver script (at least will do in the future),
192 but more readily accessible from Python code.
193
194
195 %prep
196 %setup -q -n %name-%fullver
197
198 aclocal -I m4
199 autoconf
200 automake --add-missing
201
202 %build
203 %configure --with-initrddir=%_initrddir --enable-release \
204            %{?_without_dietlibc:--disable-dietlibc} \
205            %{!?_without_legacy:--enable-apis=NOLEGACY} \
206            --with-initscripts=sysv
207
208 %__make %{?_smp_mflags} all
209 %{!?_without_doc:%__make %{?_smp_mflags} doc}
210
211 %install
212 rm -rf $RPM_BUILD_ROOT
213 %__make DESTDIR="$RPM_BUILD_ROOT" install install-distribution
214
215 rm -f $RPM_BUILD_ROOT/%_libdir/*.la $RPM_BUILD_ROOT%{python_sitearch}/*.{la,a}
216
217 MANIFEST_CONFIG='%config' \
218 MANIFEST_CONFIG_NOREPLACE='%config(noreplace)' \
219 contrib/make-manifest %name $RPM_BUILD_ROOT contrib/manifest.dat
220
221 # Generate file list for python package
222 find "%{buildroot}" -name '*.py' | { while read FILE; do
223         f="${FILE#%{buildroot}}"
224         echo "${f}"
225         # need to touch these files, as they are not produced on FC4 or below
226         touch ${FILE}c
227         touch ${FILE}o
228         echo %%ghost "${f}c"
229         echo %%ghost "${f}o"
230 done } > %name-python.list
231
232
233 %check || :
234 #%__make check
235
236
237 %clean
238 rm -rf $RPM_BUILD_ROOT
239
240
241 %post
242 test -d /vservers      || mkdir -m0000 /vservers
243 test -d /vservers/.pkg || mkdir -m0755 /vservers/.pkg
244
245 f="%confdefaultdir/vdirbase";  test -L "$f" -o -e "$f" || ln -s /vservers                        "$f"
246 f="%confdefaultdir/run.rev";   test -L "$f" -o -e "$f" || ln -s %_localstatedir/run/vservers.rev "$f"
247 f="%confdefaultdir/cachebase"; test -L "$f" -o -e "$f" || ln -s %_localstatedir/cache/vservers   "$f"
248
249 %_sbindir/setattr --barrier /vservers /vservers/.pkg || :
250
251
252 %preun
253 test "$1" != 0 || rm -rf %_localstatedir/cache/vservers/* 2>/dev/null || :
254
255 # add /bin/vsh to list of secure shells
256 if [ ! -f /etc/shells ] || ! grep -q '^/bin/vsh$' /etc/shells ; then
257     echo /bin/vsh >> /etc/shells
258 fi
259
260
261 %postun
262 # 0 = erase, 1 = upgrade
263 if [ "$1" = 0 ] ; then
264     perl -i -n -e 'next if /^\/bin\/vsh$/; print' /etc/shells
265 fi
266
267
268 %post   lib -p /sbin/ldconfig
269 %postun lib -p /sbin/ldconfig
270
271
272 %post sysv
273 #%chkconfig --add vservers-default
274 #%chkconfig --add vprocunhide
275 # PlanetLab Node Manager takes care of starting and stopping VServers
276 %chkconfig --del vservers-default
277 %chkconfig --del util-vserver
278 # PlanetLab does not require /proc security
279 %chkconfig --del vprocunhide
280 # vip6-autod handles IPv6 auto-assignments
281 %chkconfig --add vip6-autod
282
283
284 %preun sysv
285 #test "$1" != 0 || %_initrddir/vprocunhide stop &>/dev/null || :
286
287 #test "$1" != 0 || %chkconfig --del vprocunhide
288 #test "$1" != 0 || %chkconfig --del vservers-default
289 #test "$1" != 0 || %chkconfig --del util-vserver
290 test "$1" != 0 || %chkconfig --del vip6-autod
291
292
293 %postun sysv
294 #test "$1" = 0  || %_initrddir/vprocunhide condrestart >/dev/null || :
295
296
297 %triggerin build -- fedora-release, centos-release
298 function copy()
299 {
300     base=$1
301     shift
302
303     for i; do
304         test -r "$i" || continue
305
306         target=%confdir/.distributions/.common/pubkeys/$base-$(basename "$i")
307         cp -a "$i" "$target"
308     done
309 }
310 copy fedora /usr/share/doc/fedora-release-*/RPM-GPG-*
311 copy fedora /etc/pki/rpm-gpg/RPM-GPG-*
312 copy centos /usr/share/doc/centos-*/RPM-GPG-KEY-*
313
314
315 %post build
316 test -d /vservers/.hash || mkdir -m0700 /vservers/.hash
317
318 f="%confdefaultdir/apps/vunify/hash"; test -e "$f"/method -o -e "$f"/00 || \
319         ln -s /vservers/.hash "$f"/00
320
321 %_sbindir/setattr --barrier /vservers/.hash || :
322
323
324 %preun build
325 test "$1" != 0 || rm -f %confdir/.distributions/.common/pubkeys/fedora-*
326
327
328 ## Temporary workaround to remove old v_* files; it will conflict
329 ## somehow with the -legacy package but can be fixed by reinstalling
330 ## this package.
331 ## TODO: remove me in the final .spec file
332 %define v_services      httpd named portmap sendmail smb sshd xinetd gated
333 %triggerun sysv -- util-vserver-sysv < 0.30.198
334 for i in %v_services; do
335         %chkconfig --del v_$i || :
336 done
337
338
339 %post legacy
340 # PlanetLab Node Manager takes care of starting and stopping VServers
341 #%chkconfig --add rebootmgr
342 #%chkconfig --add vservers-legacy
343
344 # PlanetLab does not require these legacy services
345 #for i in %v_services; do
346 #       %chkconfig --add v_$i
347 #done
348
349
350 %preun legacy
351 #test "$1" != 0 || %_initrddir/rebootmgr   stop &>/dev/null || :
352
353 #test "$1" != 0 || for i in %v_services; do
354 #       %chkconfig --del v_$i
355 #done
356
357 #test "$1" != 0 || %chkconfig --del rebootmgr
358 #test "$1" != 0 || %chkconfig --del vservers-legacy
359
360 %postun legacy
361 #test "$1" = 0  || %_initrddir/rebootmgr   condrestart >/dev/null || :
362
363
364 %files -f %name-base.list
365 %defattr(-,root,root,-)
366 %doc AUTHORS COPYING ChangeLog NEWS README THANKS
367 %doc doc/*.html doc/*.css
368 /sbin/vshelper
369 %dir %confdir
370 %dir %confdefaultdir
371 %dir %confdefaultdir/apps
372 %dir %confdefaultdir/files
373 %dir %pkglibdir/defaults
374 %ghost %confdefaultdir/cachebase
375 %ghost %confdefaultdir/vdirbase
376 %ghost %confdefaultdir/run.rev
377
378 %dir %_localstatedir/cache/vservers
379 %dir %_localstatedir/run/vservers
380 %dir %_localstatedir/run/vservers.rev
381 %dir %_localstatedir/run/vshelper
382
383
384 %files lib -f %name-lib.list
385 %files sysv -f %name-sysv.list
386
387
388 %files core -f %name-core.list
389 %defattr(-,root,root,-)
390 %dir %pkglibdir
391
392
393 %files build -f %name-build.list
394 %defattr(-,root,root,-)
395 %doc contrib/yum*.patch
396 %dir %confdir/.distributions
397 %dir %confdir/.distributions/*
398 %dir %confdir/.distributions/*/apt
399 %dir %confdir/.distributions/.common
400 %dir %confdir/.distributions/.common/pubkeys
401 %dir %confdefaultdir/apps/vunify
402 %dir %confdefaultdir/apps/vunify/hash
403
404
405 %files legacy -f %name-legacy.list
406 %defattr(-,root,root,-)
407 %dir %pkglibdir/legacy
408
409
410 %files devel -f %name-devel.list
411 %defattr(-,root,root,-)
412 %{!?_without_doc:%doc lib/apidoc/latex/refman.pdf}
413 %{!?_without_doc:%doc lib/apidoc/html}
414
415
416 %files python -f %name-python.list
417 %{_sbindir}/bwlimit
418 %{_sbindir}/disklimit
419 %{python_sitearch}/vserverimpl.so
420
421
422 %changelog
423 * Wed Oct 03 2007 Daniel Hokka Zakrisson <daniel@hozac.com>
424 - build python code as part of the regular build process
425
426 * Mon Jul 30 2007 Daniel Hokka Zakrisson <daniel@hozac.com>
427 - add vip6-autod
428
429 * Mon Jun 25 2007 Daniel Hokka Zakrisson <daniel@hozac.com> - 0.30.214-0
430 - updated URLs
431 - get rid of e2fsprogs requirement
432
433 * Fri Dec 29 2006 Daniel Hokka Zakrisson <daniel@hozac.com> - 0.30.213-0
434 - add --with legacy and --without doc switches
435 - add util-vserver initscript
436
437 * Fri Feb 17 2006 Steve Muir <smuir@cs.princeton.edu>
438 - add support for setting guaranteed CPU share flag in rspec
439
440 * Sun Jan 22 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.30.210-0
441 - do not require 'xalan' anymore by default
442 - removed 'Requires: apt'; apt-rpm is not maintained upstream anymore
443 - removed 'chattr' leftovers
444 - create the '/etc/vservers/.defaults/cachebase' symlink
445 - added /var/cache/vservers and the needed support
446 - set barrier attribute on /vservers/.pkg and /vservers/.hash
447 - added 'centos-release' to the list of packages in the copy-the-keys
448   trigger script
449 - create '/vservers/.hash' and add initial configuration for it
450
451 * Fri Jan 13 2006 Steve Muir <smuir@cs.princeton.edu>
452 - fix bug in python/vserverimpl.c where attempting to adjust CPU share
453   for a context that didn't exist would cause an error (it should be a
454   safe no-op)
455
456 * Fri Dec  2 2005 Steve Muir <smuir@cs.princeton.edu>
457 - fix bugs in python/vserverimpl.c where exceptions were not raised when
458   they should be and thus occured later at unexpected times
459 - add support for stopping a vserver
460
461 * Wed Nov  9 2005 Steve Muir <smuir@cs.princeton.edu>
462 - add support for removing resource limits e.g., when a slice is deleted
463
464 * Mon Nov  7 2005 Steve Muir <smuir@cs.princeton.edu>
465 - fix file descriptor leak in vduimpl
466 - clean up handling of network parameters
467 - don't rely upon /etc/vservers/foo.conf to initialise vserver object
468
469 * Wed Nov  2 2005 Steve Muir <smuir@cs.princeton.edu>
470 - fix Python modules to handling scheduling parameters correctly
471
472 * Sun Oct 30 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.209-0
473 - version 0.30.209
474 - copy centos keys
475
476 * Fri Oct 28 2005 Steve Muir <smuir@cs.princeton.edu>
477 - raise exception about being over disk limit after setting usage values
478
479 * Fri Oct  7 2005 Steve Muir <smuir@cs.princeton.edu>
480 - create common function to be used for entering a vserver and applying
481   resource limits
482
483 * Thu Aug 21 2005 Mark Huang <mlhuang@cs.princeton.edu>
484 - restore build of python modules
485
486 * Sat Aug 20 2005 Mark Huang <mlhuang@cs.princeton.edu>
487 - upgrade to util-vserver-0.30.208
488 - forward-port vbuild and legacy support until we can find a suitable
489   replacement
490 - make vsh use new vc_create_context() call
491
492 * Thu Jul 28 2005 Steve Muir <smuir@cs.princeton.edu>
493 - add support for static vserver IDs to vuseradd and vuserdel
494
495 * Thu Jul 21 2005 Steve Muir <smuir@cs.princeton.edu>
496 - add bwlimit and cpulimit modules
497
498 * Sat Jul 16 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.208-2
499 - updated URLs
500
501 * Fri Jul 15 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.208-1
502 - version 0.30.208
503 - require the -lib subpackage by -devel
504 - copy GPG keys from /etc/pki/rpm-gpg/
505
506 * Mon Jun 20 2005 Steve Muir <smuir@cs.princeton.edu>
507 - import Marc's vdu implementation
508
509 * Wed Jun 15 2005 Steve Muir <smuir@cs.princeton.edu>
510 - 'vserver-init start' functionality subsumed by Node Manager
511
512 * Thu Jun 02 2005 Marc E. Fiuczynski <mef@cs.princeton.edu>
513 - Fixed vlimit command
514
515 * Wed May 25 2005 Steve Muir <smuir@cs.princeton.edu>
516 - add Python modules for manipulating vservers
517
518 * Fri Apr 15 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.206-1
519 - added patches to make yum work in chroot environments
520 - version 0.30.206
521
522 * Thu Apr  7 2005 Steve Muir <smuir@cs.princeton.edu>
523 - vuserdel changes: don't shutdown vserver, just kill all processes;
524   unmount all mountpoints in vserver before deleting
525
526 * Thu Mar 24 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.205-0
527 - added some %%descriptions
528 - copy GPG keys from the system into the confdir
529 - buildrequire dietlibc-0.25
530 - BuildRequire beecrypt-devel
531 - cleanups
532 - use %%global instead of %%define
533 - removed 'run.rev' as a vserver-local variable and made it a system-wide setting
534
535 * Wed Jan 26 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.198-0.3
536 - updated BuildRequires:
537 - use 'setattr --barrier' instead of 'chattr +t' in the %%post scriptlet
538 - moved the v_* initscripts to legacy
539 - do not ship the /vservers directory itself; as it is immutable, the
540   extraction will fail else
541
542 * Fri Nov 19 2004 Mark Huang <mlhuang@cs.princeton.edu>
543 - vcached no longer runs as a daemon
544 - do not restart vservers when package is upgraded
545
546 * Wed Nov 17 2004 Mark Huang <mlhuang@cs.princeton.edu> 0.30-6.planetlab
547 + planetlab-3_0-rc4
548 - PL2445
549 - Both vcached and vuseradd now print a warning message when vbuild
550   succeeds but the resulting new vserver image is smaller in size than
551   the vserver-reference image.
552 - vuseradd: clean up some more junk on failure
553
554 * Tue Nov 16 2004 Mark Huang <mlhuang@cs.princeton.edu> 0.30-5.planetlab
555 + planetlab-3_0-rc3
556 - PL3026: This is the upgraded version of vdu that maintains an
557   internal hash table of files with a nlink count > 1.  Only if vdu
558   sees all hard links to a particular inode does it add its size and
559   block count to the total.
560
561 * Fri Nov 12 2004 Mark Huang <mlhuang@cs.princeton.edu> 0.30-4.planetlab
562 - PL2445 Use -b option to du to avoid rounding errors.
563
564 * Sat Nov  6 2004 Mark Huang <mlhuang@cs.princeton.edu> 0.30-3.planetlab
565 + planetlab-3_0-rc2
566 - don't create the symbolic link /home/slice/.ssh, this is not how
567   pl_sshd works
568
569 * Mon Oct 11 2004 Marc E. Fiuczynski <mef@cs.princeton.edu>
570 - added vsh
571
572 * Thu Sep  9 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.194-0
573 - documented switches for 'rpmbuild'
574
575 * Wed Aug 11 2004 Mark Huang <mlhuang@cs.princeton.edu> 0.29-1.planetlab
576 - initial PlanetLab 3.0 build.
577
578 * Wed May 26 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.215-0
579 - (re)added the MANIFEST_* variables which were lost some time ago;
580   this will preserve %%config files...
581
582 * Mon Mar 15 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.202-0
583 - use file-list for sysv scripts also
584
585 * Sat Mar  6 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.198-0
586 - added vprocunhide-service support
587 - added doxygen support
588 - updated Requires:
589
590 * Wed Oct  1 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.23.5-0
591 - Initial build.