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