start to track Daniel's version
[util-vserver.git] / util-vserver.spec
1 # $Id: util-vserver.spec.in 2807 2008-10-30 01:59:52Z dhozac $
2
3 %if "%{?_without_python:1}" != "1"
4 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
5 %endif
6
7 ## This package understands the following switches:
8 ## --without dietlibc        ...   disable usage of dietlibc
9 ## --with xalan              ...   require/use the xalan xslt processor
10 ## --without doc             ...   disable doc generation
11 ## --with legacy             ...   enable the legacy APIs
12
13 %global confdir         %_sysconfdir/vservers
14 %global confdefaultdir  %confdir/.defaults
15 %global pkglibdir       %_libdir/%name
16 %global chkconfig       /sbin/chkconfig
17
18 %global _localstatedir  %_var
19
20 %global fullver         0.30.216-pre2883
21 %global ver             %( echo %fullver | sed 's/-.*//' )
22 %global subver          %( s=`echo %fullver | grep -- - | sed 's/.*-/./'`; echo ${s:-.1} )
23
24 # for module-tools
25 %global module_version_varname fullver
26 %global taglevel 0
27
28 %{!?release_func:%global release_func() %1%{?dist}}
29
30 Summary:        Linux virtual server utilities
31 Name:           util-vserver
32 Version:        %ver
33 Release:        %taglevel
34 License:        GPL
35 Group:          System Environment/Base
36 URL:            http://savannah.nongnu.org/projects/util-vserver/
37 Source0:        http://ftp.linux-vserver.org/pub/utils/util-vserver/%name-%fullver.tar.bz2
38 #Source1:       http://ftp.linux-vserver.org/pub/utils/util-vserver/%name-%fullver.tar.bz2.asc
39 BuildRoot:      %_tmppath/%name-%version-%release-root
40 Requires:       init(%name)
41 Requires:       %name-core = %version-%release
42 Requires:       %name-lib  = %version-%release
43 Requires:       diffutils mktemp sed
44 Provides:       vserver = %version-%release
45 Obsoletes:      vserver < %version
46 BuildRequires:  mount vconfig gawk /sbin/ip iptables
47 BuildRequires:  gcc-c++ wget which diffutils
48 BuildRequires:  e2fsprogs-devel e2fsprogs
49 %{!?_without_beecrypt:BuildRequires: beecrypt-devel}
50 %{?_without_beecrypt:BuildRequires: nss-devel}
51 BuildRequires:  e2fsprogs
52 %{!?_without_doc:BuildRequires: doxygen tetex-latex}
53 %{!?_without_python:BuildRequires: python python-devel ctags}
54 Requires(post):         %name-core
55 Requires(pre):          %pkglibdir
56 Requires(postun):       %pkglibdir
57 %{!?_without_dietlibc:BuildRequires:    dietlibc >= 0:0.25}
58 %{?_with_xalan:BuildRequires:   xalan-j}
59
60 %package lib
61 Summary:                Dynamic libraries for util-vserver
62 Group:                  System Environment/Libraries
63
64 %package core
65 Summary:                The core-utilities for util-vserver
66 Group:                  Applications/System
67 Requires:               util-linux
68
69 %package build
70 Summary:                Tools which can be used to build vservers
71 Group:                  Applications/System
72 Requires:               rpm wget binutils tar
73 Requires:               %name = %version-%release
74 Requires(pre):          %confdir
75 Requires(postun):       %confdir
76 Requires(post):         %name-core
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 bindings to develop vserver-based applications
107 Group:                  Development/Libraries
108 Requires:               %name-lib = %version-%release
109
110
111 %description
112 util-vserver provides the components and a framework to setup virtual
113 servers.  A virtual server runs inside a linux server. It is nevertheless
114 highly independent. As such, you can run various services with normal
115 configuration. The various vservers can't interact with each other and
116 can't interact with services in the main server.
117
118 This requires a special kernel supporting the new new_s_context and
119 set_ipv4root system call.
120
121 %description lib
122 util-vserver provides the components and a framework to setup virtual
123 servers.  A virtual server runs inside a linux server. It is nevertheless
124 highly independent. As such, you can run various services with normal
125 configuration. The various vservers can't interact with each other and
126 can't interact with services in the main server.
127
128 This package contains the shared libraries needed by all other
129 'util-vserver' subpackages.
130
131 %description core
132 util-vserver provides the components and a framework to setup virtual
133 servers.  A virtual server runs inside a linux server. It is nevertheless
134 highly independent. As such, you can run various services with normal
135 configuration. The various vservers can't interact with each other and
136 can't interact with services in the main server.
137
138 This package contains utilities which are required to communicate with
139 the Linux-Vserver enabled kernel.
140
141
142 %description build
143 util-vserver provides the components and a framework to setup virtual
144 servers.  A virtual server runs inside a linux server. It is nevertheless
145 highly independent. As such, you can run various services with normal
146 configuration. The various vservers can't interact with each other and
147 can't interact with services in the main server.
148
149 This package contains utilities which assist in building Vservers.
150
151 %description sysv
152 util-vserver provides the components and a framework to setup virtual
153 servers.  A virtual server runs inside a linux server. It is nevertheless
154 highly independent. As such, you can run various services with normal
155 configuration. The various vservers can't interact with each other and
156 can't interact with services in the main server.
157
158 This package contains the SysV initscripts which start and stop
159 VServers and related tools.
160
161
162 %description legacy
163 util-vserver provides the components and a framework to setup virtual
164 servers.  A virtual server runs inside a linux server. It is nevertheless
165 highly independent. As such, you can run various services with normal
166 configuration. The various vservers can't interact with each other and
167 can't interact with services in the main server.
168
169 This package contains the tools which are needed to work with VServers
170 having an old-style configuration.
171
172
173 %description devel
174 util-vserver provides the components and a framework to setup virtual
175 servers.  A virtual server runs inside a linux server. It is nevertheless
176 highly independent. As such, you can run various services with normal
177 configuration. The various vservers can't interact with each other and
178 can't interact with services in the main server.
179
180 This package contains header files and libraries which are needed to
181 develop VServer related applications.
182
183 %description python
184 util-vserver provides the components and a framework to setup virtual
185 servers.  A virtual server runs inside a linux server. It is nevertheless
186 highly independent. As such, you can run various services with normal
187 configuration. The various vservers can't interact with each other and
188 can't interact with services in the main server.
189
190 This package contains the files needed to interface with the
191 Linux-VServer API from Python.
192
193
194 %prep
195 %setup -q -n %name-%fullver
196
197
198 %build
199 %configure --with-initrddir=%_initrddir --enable-release \
200            %{?_without_dietlibc:--disable-dietlibc} \
201            %{?_with_legacy:--enable-apis=NOLEGACY} \
202            --with-initscripts=sysv \
203            %{?_without_python:--without-python}
204
205 %__make %{?_smp_mflags} all
206 %{!?_without_doc:%__make %{?_smp_mflags} doc}
207
208
209 %install
210 rm -rf $RPM_BUILD_ROOT
211 %__make DESTDIR="$RPM_BUILD_ROOT" install install-distribution
212
213 rm -f $RPM_BUILD_ROOT/%_libdir/*.la
214
215 MANIFEST_CONFIG='%config' \
216 MANIFEST_CONFIG_NOREPLACE='%config(noreplace)' \
217 contrib/make-manifest %name $RPM_BUILD_ROOT contrib/manifest.dat
218
219
220 %check
221 %__make check
222
223
224 %clean
225 rm -rf $RPM_BUILD_ROOT
226
227
228 %post
229 test -d /vservers      || mkdir -m0000 /vservers
230 test -d /vservers/.pkg || mkdir -m0755 /vservers/.pkg
231
232 f="%confdefaultdir/vdirbase";  test -L "$f" -o -e "$f" || ln -s /vservers                        "$f"
233 f="%confdefaultdir/run.rev";   test -L "$f" -o -e "$f" || ln -s %_localstatedir/run/vservers.rev "$f"
234 f="%confdefaultdir/cachebase"; test -L "$f" -o -e "$f" || ln -s %_localstatedir/cache/vservers   "$f"
235
236 %_sbindir/setattr --barrier /vservers /vservers/.pkg || :
237
238
239 %preun
240 test "$1" != 0 || rm -rf %_localstatedir/cache/vservers/* 2>/dev/null || :
241
242
243 %post   lib -p /sbin/ldconfig
244 %postun lib -p /sbin/ldconfig
245
246
247 %post sysv
248 %chkconfig --add vservers-default
249 %chkconfig --add vprocunhide
250 %chkconfig --add util-vserver
251 %chkconfig util-vserver on
252
253
254 %preun sysv
255 test "$1" != 0 || %_initrddir/vprocunhide stop &>/dev/null || :
256
257 test "$1" != 0 || %chkconfig --del vprocunhide
258 test "$1" != 0 || %chkconfig --del vservers-default
259 test "$1" != 0 || %chkconfig --del util-vserver
260
261
262 %postun sysv
263 test "$1" = 0  || %_initrddir/vprocunhide condrestart >/dev/null || :
264
265
266 %triggerin build -- fedora-release, centos-release
267 function copy()
268 {
269     base=$1
270     shift
271
272     for i; do
273         test -r "$i" || continue
274
275         target=%confdir/.distributions/.common/pubkeys/$base-$(basename "$i")
276         cp -a "$i" "$target"
277     done
278 }
279 copy fedora /usr/share/doc/fedora-release-*/RPM-GPG-*
280 copy fedora /etc/pki/rpm-gpg/RPM-GPG-*
281 copy centos /usr/share/doc/centos-*/RPM-GPG-KEY-*
282
283
284 %pre build
285 x="%_libdir/util-vserver/distributions/etch"
286 test -d "$x" && mv "$x" "$x.rpmsave" || :
287
288
289 %post build
290 test -d /vservers/.hash || mkdir -m0700 /vservers/.hash
291
292 f="%confdefaultdir/apps/vunify/hash"; test -e "$f"/method -o -e "$f"/00 || \
293         ln -s /vservers/.hash "$f"/00
294
295 %_sbindir/setattr --barrier /vservers/.hash || :
296
297
298 %preun build
299 test "$1" != 0 || rm -f %confdir/.distributions/.common/pubkeys/fedora-*
300
301
302 ## Temporary workaround to remove old v_* files; it will conflict
303 ## somehow with the -legacy package but can be fixed by reinstalling
304 ## this package.
305 ## TODO: remove me in the final .spec file
306 %define v_services      httpd named portmap sendmail smb sshd xinetd gated
307 %triggerun sysv -- util-vserver-sysv < 0.30.198
308 for i in %v_services; do
309         %chkconfig --del v_$i || :
310 done
311
312
313 %post legacy
314 %chkconfig --add rebootmgr
315 %chkconfig --add vservers-legacy
316
317 for i in %v_services; do
318         %chkconfig --add v_$i
319 done
320
321
322 %preun legacy
323 test "$1" != 0 || %_initrddir/rebootmgr   stop &>/dev/null || :
324
325 test "$1" != 0 || for i in %v_services; do
326         %chkconfig --del v_$i
327 done
328
329 test "$1" != 0 || %chkconfig --del rebootmgr
330 test "$1" != 0 || %chkconfig --del vservers-legacy
331
332 %postun legacy
333 test "$1" = 0  || %_initrddir/rebootmgr   condrestart >/dev/null || :
334
335
336 %files -f %name-base.list
337 %defattr(-,root,root,-)
338 %doc AUTHORS COPYING ChangeLog NEWS README THANKS
339 %doc doc/*.html doc/*.css
340 /sbin/vshelper
341 %dir %confdir
342 %dir %confdefaultdir
343 %dir %confdefaultdir/apps
344 %dir %confdefaultdir/files
345 %dir %pkglibdir/defaults
346 %ghost %confdefaultdir/cachebase
347 %ghost %confdefaultdir/vdirbase
348 %ghost %confdefaultdir/run.rev
349
350 %dir %_localstatedir/cache/vservers
351 %dir %_localstatedir/run/vservers
352 %dir %_localstatedir/run/vservers.rev
353 %dir %_localstatedir/run/vshelper
354
355
356 %files lib -f %name-lib.list
357 %files sysv -f %name-sysv.list
358
359
360 %files core -f %name-core.list
361 %defattr(-,root,root,-)
362 %dir %pkglibdir
363
364
365 %files build -f %name-build.list
366 %defattr(-,root,root,-)
367 %doc contrib/yum*.patch
368 %dir %confdir/.distributions
369 %dir %confdir/.distributions/*
370 %dir %confdir/.distributions/*/apt
371 %dir %confdir/.distributions/.common
372 %dir %confdir/.distributions/.common/pubkeys
373 %dir %confdefaultdir/apps/vunify
374 %dir %confdefaultdir/apps/vunify/hash
375
376
377 %files legacy -f %name-legacy.list
378 %defattr(-,root,root,-)
379 %dir %pkglibdir/legacy
380
381
382 %files devel -f %name-devel.list
383 %defattr(-,root,root,-)
384 %{!?_without_doc:%doc lib/apidoc/latex/refman.pdf}
385 %{!?_without_doc:%doc lib/apidoc/html}
386
387
388 %files python
389 %defattr(-,root,root,-)
390 %{!?_without_python:%{python_sitearch}/*}
391
392
393 %changelog
394 * Mon Jun 25 2007 Daniel Hokka Zakrisson <daniel@hozac.com> - 0.30.214-0
395 - updated URLs
396 - get rid of e2fsprogs requirement
397
398 * Fri Dec 29 2006 Daniel Hokka Zakrisson <daniel@hozac.com> - 0.30.213-0
399 - add --with legacy and --without doc switches
400 - add util-vserver initscript
401
402 * Sun Jan 22 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.30.210-0
403 - do not require 'xalan' anymore by default
404 - removed 'Requires: apt'; apt-rpm is not maintained upstream anymore
405 - removed 'chattr' leftovers
406 - create the '/etc/vservers/.defaults/cachebase' symlink
407 - added /var/cache/vservers and the needed support
408 - set barrier attribute on /vservers/.pkg and /vservers/.hash
409 - added 'centos-release' to the list of packages in the copy-the-keys
410   trigger script
411 - create '/vservers/.hash' and add initial configuration for it
412
413 * Sun Oct 30 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.209-0
414 - version 0.30.209
415 - copy centos keys
416
417 * Sat Jul 16 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.208-2
418 - updated URLs
419
420 * Fri Jul 15 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.208-1
421 - version 0.30.208
422 - require the -lib subpackage by -devel
423 - copy GPG keys from /etc/pki/rpm-gpg/
424
425 * Fri Apr 15 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.206-1
426 - added patches to make yum work in chroot environments
427 - version 0.30.206
428
429 * Thu Mar 24 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.205-0
430 - added some %%descriptions
431 - copy GPG keys from the system into the confdir
432 - buildrequire dietlibc-0.25
433 - BuildRequire beecrypt-devel
434 - cleanups
435 - use %%global instead of %%define
436 - removed 'run.rev' as a vserver-local variable and made it a system-wide setting
437
438 * Wed Jan 26 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.198-0.3
439 - updated BuildRequires:
440 - use 'setattr --barrier' instead of 'chattr +t' in the %%post scriptlet
441 - moved the v_* initscripts to legacy
442 - do not ship the /vservers directory itself; as it is immutable, the
443   extraction will fail else
444
445 * Thu Sep  9 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.194-0
446 - documented switches for 'rpmbuild'
447
448 * Wed May 26 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.215-0
449 - (re)added the MANIFEST_* variables which were lost some time ago;
450   this will preserve %%config files...
451
452 * Mon Mar 15 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.202-0
453 - use file-list for sysv scripts also
454
455 * Sat Mar  6 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.198-0
456 - added vprocunhide-service support
457 - added doxygen support
458 - updated Requires:
459
460 * Wed Oct  1 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.23.5-0
461 - Initial build.