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