Add test script to test recovery from qemu failure.
[libguestfs.git] / libguestfs.spec.in
1 # @configure_input@
2
3 # Enable to build w/o network.
4 %global buildnonet 0
5
6 Summary:     Access and modify virtual machine disk images
7 Name:        libguestfs
8 Version:     @VERSION@
9 Release:     1%{?dist}
10 License:     LGPLv2+
11 Group:       Development/Libraries
12 URL:         http://et.redhat.com/~rjones/libguestfs/
13 Source0:     http://et.redhat.com/~rjones/libguestfs/files/%{name}-%{version}.tar.gz
14 BuildRoot:   %{_tmppath}/%{name}-%{version}-%{release}-root
15
16 # Currently fails on non-x86 because of this error:
17 # "qemu: linux kernel too old to load a ram disk"
18 ExclusiveArch: %{ix86} x86_64
19
20 # Basic build requirements:
21 BuildRequires: /usr/bin/pod2man
22 BuildRequires: /usr/bin/pod2text
23 BuildRequires: febootstrap >= 1.5
24 BuildRequires: augeas-devel >= 0.5.0
25 BuildRequires: readline-devel
26 BuildRequires: qemu >= 0.10-7
27 BuildRequires: createrepo
28
29 # This is only needed for RHEL 5 because readline-devel doesn't
30 # properly depend on it, but doesn't do any harm on other platforms:
31 BuildRequires: ncurses-devel
32
33 # Build requirements for the appliance:
34 # (see 'make-initramfs.sh.in' in the source)
35 BuildRequires: kernel, bash, coreutils, lvm2, ntfs-3g, util-linux-ng
36 BuildRequires: MAKEDEV, net-tools, augeas-libs, file
37 BuildRequires: module-init-tools, procps, strace, iputils
38 BuildRequires: grub, dosfstools, ntfsprogs
39
40 # These are only required if you want to build the bindings for
41 # different languages:
42 BuildRequires: ocaml
43 BuildRequires: ocaml-findlib-devel
44 BuildRequires: perl-devel
45 BuildRequires: perl-Test-Simple
46 BuildRequires: perl-Test-Pod
47 BuildRequires: perl-Test-Pod-Coverage
48 BuildRequires: perl-ExtUtils-MakeMaker
49 BuildRequires: python-devel
50 BuildRequires: ruby-devel
51 BuildRequires: rubygem-rake
52 BuildRequires: java >= 1.5.0
53 BuildRequires: jpackage-utils
54 BuildRequires: java-devel
55
56 # For virt-inspector:
57 BuildRequires: perl-Sys-Virt
58
59 # Runtime requires:
60 Requires:    qemu >= 0.10-7
61
62
63 %description
64 Libguestfs is a library for accessing and modifying guest disk images.
65 Amongst the things this is good for: making batch configuration
66 changes to guests, getting disk used/free statistics (see also:
67 virt-df), migrating between virtualization systems (see also:
68 virt-p2v), performing partial backups, performing partial guest
69 clones, cloning guests and changing registry/UUID/hostname info, and
70 much else besides.
71
72 Libguestfs uses Linux kernel and qemu code, and can access any type of
73 guest filesystem that Linux and qemu can, including but not limited
74 to: ext2/3/4, btrfs, FAT and NTFS, LVM, many different disk partition
75 schemes, qcow, qcow2, vmdk.
76
77 Libguestfs provides ways to enumerate guest storage (eg. partitions,
78 LVs, what filesystem is in each LV, etc.).  It can also run commands
79 in the context of the guest.  Also you can access filesystems over FTP.
80
81 Libguestfs is a library that can be linked with C and C++ management
82 programs.
83
84 See also the 'guestfish' package for shell scripting and command line
85 access.
86
87 For Perl bindings, see 'perl-libguestfs'.
88
89 For OCaml bindings, see 'ocaml-libguestfs-devel'.
90
91 For Python bindings, see 'python-libguestfs'.
92
93 For Ruby bindings, see 'ruby-libguestfs'.
94
95 For Java bindings, see 'libguestfs-java-devel'.
96
97
98 %package devel
99 Summary:     Development tools and libraries for %{name}
100 Group:       Development/Libraries
101 Requires:    %{name} = %{version}-%{release}
102 Requires:    pkgconfig
103
104
105 %description devel
106 %{name}-devel contains development tools and libraries
107 for %{name}.
108
109
110 %package -n guestfish
111 Summary:     Shell for accessing and modifying virtual machine disk images
112 Group:       Development/Tools
113 License:     GPLv2+
114 Requires:    %{name} = %{version}-%{release}
115 Requires:    /usr/bin/pod2text
116
117
118 %description -n guestfish
119 Guestfish is the Filesystem Interactive SHell, for accessing and
120 modifying virtual machine disk images from the command line and shell
121 scripts.
122
123
124 %package -n virt-inspector
125 Summary:     Display OS version, kernel, drivers, etc in a virtual machine
126 Group:       Development/Tools
127 License:     GPLv2+
128 Requires:    %{name} = %{version}-%{release}
129 Requires:    guestfish
130 Requires:    perl-Sys-Virt
131
132
133 %description -n virt-inspector
134 Virt-inspector examines a virtual machine and tries to determine the
135 version of the OS, the kernel version, what drivers are installed,
136 whether the virtual machine is fully virtualized (FV) or
137 para-virtualized (PV), what applications are installed and more.
138
139
140 %package -n ocaml-%{name}
141 Summary:     OCaml bindings for %{name}
142 Group:       Development/Libraries
143 Requires:    %{name} = %{version}-%{release}
144
145
146 %description -n ocaml-%{name}
147 ocaml-%{name} contains OCaml bindings for %{name}.
148
149 This is for toplevel and scripting access only.  To compile OCaml
150 programs which use %{name} you will also need ocaml-%{name}-devel.
151
152
153 %package -n ocaml-%{name}-devel
154 Summary:     OCaml bindings for %{name}
155 Group:       Development/Libraries
156 Requires:    ocaml-%{name} = %{version}-%{release}
157
158
159 %description -n ocaml-%{name}-devel
160 ocaml-%{name}-devel contains development libraries
161 required to use the OCaml bindings for %{name}.
162
163
164 %package -n perl-%{name}
165 Summary:     Perl bindings for %{name}
166 Group:       Development/Libraries
167 Requires:    %{name} = %{version}-%{release}
168 Requires:    perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
169
170
171 %description -n perl-%{name}
172 perl-%{name} contains Perl bindings for %{name}.
173
174
175 %package -n python-%{name}
176 Summary:     Python bindings for %{name}
177 Group:       Development/Libraries
178 Requires:    %{name} = %{version}-%{release}
179
180 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
181 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
182
183 %description -n python-%{name}
184 python-%{name} contains Python bindings for %{name}.
185
186
187 %package -n ruby-%{name}
188 Summary:     Ruby bindings for %{name}
189 Group:       Development/Libraries
190 Requires:    %{name} = %{version}-%{release}
191 Requires:    ruby(abi) = 1.8
192 Provides:    ruby(guestfs) = %{version}
193
194 %{!?ruby_sitelib: %define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")}
195 %{!?ruby_sitearch: %define ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")}
196
197 %description -n ruby-%{name}
198 ruby-%{name} contains Ruby bindings for %{name}.
199
200
201 %package java
202 Summary:     Java bindings for %{name}
203 Group:       Development/Libraries
204 Requires:    %{name} = %{version}-%{release}
205 Requires:    java >= 1.5.0
206 Requires:    jpackage-utils
207
208 %description java
209 %{name}-java contains Java bindings for %{name}.
210
211 If you want to develop software in Java which uses %{name}, then
212 you will also need %{name}-java-devel.
213
214
215 %package java-devel
216 Summary:     Java development package for %{name}
217 Group:       Development/Libraries
218 Requires:    %{name} = %{version}-%{release}
219 Requires:    %{name}-java = %{version}-%{release}
220
221 %description java-devel
222 %{name}-java-devel contains the tools for developing Java software
223 using %{name}.
224
225 See also %{name}-javadoc.
226
227
228 %package javadoc
229 Summary:     Java documentation for %{name}
230 Group:       Development/Libraries
231 Requires:    %{name} = %{version}-%{release}
232 Requires:    %{name}-java = %{version}-%{release}
233 Requires:    jpackage-utils
234
235 %description javadoc
236 %{name}-javadoc contains the Java documentation for %{name}.
237
238
239 %prep
240 %setup -q
241
242 mkdir -p daemon/m4
243
244
245 %build
246 %if %{buildnonet}
247 mkdir repo
248 find /var/cache/yum/build -type f -name '*.rpm' -print0 | xargs -0 cp -t repo
249 createrepo repo
250 %define extra --with-mirror=file://$(pwd)/repo --with-repo=fedora-12
251 %else
252 %define extra %nil
253 %endif
254
255 ./configure \
256   --prefix=%{_prefix} --libdir=%{_libdir} \
257   --mandir=%{_mandir} \
258   --with-java-home=%{java_home} \
259   --with-qemu="qemu-kvm qemu-system-%{_build_arch} qemu" \
260   --enable-debug-command \
261   %{extra}
262
263 # This ensures that /usr/sbin/chroot is on the path.  Not needed
264 # except for RHEL 5, it shouldn't do any harm on other platforms.
265 export PATH=/usr/sbin:$PATH
266
267 # 'INSTALLDIRS' ensures that perl libs are installed in the vendor dir
268 # not the site dir.
269 make INSTALLDIRS=vendor %{?_smp_mflags}
270
271
272 %check
273 test -n "$QUICK_RPMBUILD" || make check
274
275
276 %install
277 rm -rf $RPM_BUILD_ROOT
278
279 make DESTDIR=$RPM_BUILD_ROOT install
280
281 rm $RPM_BUILD_ROOT%{_libdir}/libguestfs.a
282 rm $RPM_BUILD_ROOT%{_libdir}/libguestfs.la
283
284 # Clean up the examples/ directory which will get installed in %doc.
285 # Note we can't delete the original examples/Makefile because that
286 # will be needed by the check section later in the RPM build.
287 cp -a examples ex
288 pushd ex
289 make clean
290 rm Makefile*
291 rm -rf .deps .libs
292 popd
293
294 # Same for ocaml/examples.
295 cp -a ocaml/examples ocaml/ex
296 pushd ocaml/ex
297 make clean
298 rm Makefile*
299 popd
300
301 find $RPM_BUILD_ROOT -name perllocal.pod -delete
302 find $RPM_BUILD_ROOT -name .packlist -delete
303 find $RPM_BUILD_ROOT -name '*.bs' -delete
304
305 rm $RPM_BUILD_ROOT%{python_sitearch}/libguestfsmod.a
306 rm $RPM_BUILD_ROOT%{python_sitearch}/libguestfsmod.la
307
308 if [ "$RPM_BUILD_ROOT%{python_sitearch}" != "$RPM_BUILD_ROOT%{python_sitelib}" ]; then
309    mkdir -p $RPM_BUILD_ROOT%{python_sitelib}
310    mv $RPM_BUILD_ROOT%{python_sitearch}/guestfs.py* \
311      $RPM_BUILD_ROOT%{python_sitelib}/
312 fi
313
314 # Install ruby bindings by hand.
315 mkdir -p $RPM_BUILD_ROOT%{ruby_sitelib}
316 mkdir -p $RPM_BUILD_ROOT%{ruby_sitearch}
317 install -p -m0644 ruby/lib/guestfs.rb $RPM_BUILD_ROOT%{ruby_sitelib}
318 install -p -m0755 ruby/ext/guestfs/_guestfs.so $RPM_BUILD_ROOT%{ruby_sitearch}
319
320 # Remove static-linked Java bindings.
321 rm $RPM_BUILD_ROOT%{_libdir}/libguestfs_jni.a
322 rm $RPM_BUILD_ROOT%{_libdir}/libguestfs_jni.la
323
324 # Generator shouldn't be executable when we distribute it.
325 chmod -x src/generator.ml
326
327
328 %clean
329 rm -rf $RPM_BUILD_ROOT
330
331
332 %post -p /sbin/ldconfig
333
334 %postun -p /sbin/ldconfig
335
336
337 %files
338 %defattr(-,root,root,-)
339 %doc COPYING
340 %{_libdir}/guestfs/
341 %{_libdir}/libguestfs.so.*
342
343
344 %files devel
345 %defattr(-,root,root,-)
346 %doc ChangeLog HACKING TODO README ex html/guestfs.3.html html/pod.css
347 %doc src/generator.ml
348 %{_libdir}/libguestfs.so
349 %{_mandir}/man3/guestfs.3*
350 %{_includedir}/guestfs.h
351 %{_includedir}/guestfs-actions.h
352 %{_includedir}/guestfs-structs.h
353 %{_libdir}/pkgconfig/libguestfs.pc
354
355
356 %files -n guestfish
357 %defattr(-,root,root,-)
358 %doc html/guestfish.1.html html/pod.css recipes/
359 %{_bindir}/guestfish
360 %{_mandir}/man1/guestfish.1*
361
362
363 %files -n virt-inspector
364 %defattr(-,root,root,-)
365 %{_bindir}/virt-inspector
366 %{_mandir}/man1/virt-inspector.1*
367
368
369 %files -n ocaml-%{name}
370 %defattr(-,root,root,-)
371 %doc README
372 %{_libdir}/ocaml/guestfs
373 %exclude %{_libdir}/ocaml/guestfs/*.a
374 %exclude %{_libdir}/ocaml/guestfs/*.cmxa
375 %exclude %{_libdir}/ocaml/guestfs/*.cmx
376 %exclude %{_libdir}/ocaml/guestfs/*.mli
377 %{_libdir}/ocaml/stublibs/*.so
378 %{_libdir}/ocaml/stublibs/*.so.owner
379
380
381 %files -n ocaml-%{name}-devel
382 %defattr(-,root,root,-)
383 %doc ocaml/ex
384 %{_libdir}/ocaml/guestfs/*.a
385 %{_libdir}/ocaml/guestfs/*.cmxa
386 %{_libdir}/ocaml/guestfs/*.cmx
387 %{_libdir}/ocaml/guestfs/*.mli
388
389
390 %files -n perl-%{name}
391 %defattr(-,root,root,-)
392 %doc perl/examples
393 %{perl_vendorarch}/*
394 %{_mandir}/man3/Sys::Guestfs.3pm*
395
396
397 %files -n python-%{name}
398 %defattr(-,root,root,-)
399 %doc README
400 %{python_sitearch}/*
401 %{python_sitelib}/*.py
402 %{python_sitelib}/*.pyc
403 %{python_sitelib}/*.pyo
404
405
406 %files -n ruby-%{name}
407 %defattr(-,root,root,-)
408 %doc README
409 %{ruby_sitelib}/guestfs.rb
410 %{ruby_sitearch}/_guestfs.so
411
412
413 %files java
414 %defattr(-,root,root,-)
415 %doc README
416 %{_libdir}/libguestfs_jni*.so.*
417 %{_datadir}/java/*.jar
418
419
420 %files java-devel
421 %defattr(-,root,root,-)
422 %doc README
423 %{_libdir}/libguestfs_jni*.so
424
425
426 %files javadoc
427 %defattr(-,root,root,-)
428 %doc README
429 %{_datadir}/javadoc/%{name}-java-%{version}
430
431
432 %changelog
433 * Fri May  8 2009 Richard Jones <rjones@redhat.com> - @VERSION@-1
434 - New upstream version @VERSION@.
435
436 * Fri May  8 2009 Richard Jones <rjones@redhat.com> - 1.0.21-2
437 - New upstream version 1.0.21.
438
439 * Thu May  7 2009 Richard Jones <rjones@redhat.com> - 1.0.20-2
440 - New upstream version 1.0.20.
441
442 * Thu May  7 2009 Richard Jones <rjones@redhat.com> - 1.0.19-1
443 - New upstream version 1.0.19.
444
445 * Tue Apr 28 2009 Richard Jones <rjones@redhat.com> - 1.0.15-1
446 - New upstream version 1.0.15.
447
448 * Fri Apr 24 2009 Richard Jones <rjones@redhat.com> - 1.0.12-1
449 - New upstream version 1.0.12.
450
451 * Wed Apr 22 2009 Richard Jones <rjones@redhat.com> - 1.0.6-1
452 - New upstream version 1.0.6.
453
454 * Mon Apr 20 2009 Richard Jones <rjones@redhat.com> - 1.0.2-1
455 - New upstream version 1.0.2.
456
457 * Thu Apr 16 2009 Richard Jones <rjones@redhat.com> - 0.9.9-12
458 - Multiple fixes to get it to scratch build in Koji.
459
460 * Sat Apr  4 2009 Richard Jones <rjones@redhat.com> - 0.9.9-1
461 - Initial build.