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