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