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