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