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