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