a0a55e1c970ee0e602dd36bfabbb46039def0e3b
[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 mkdir -p daemon/m4
242
243
244 %build
245 %if %{buildnonet}
246 mkdir repo
247 find /var/cache/yum/build -type f -name '*.rpm' -print0 | xargs -0 cp -t repo
248 createrepo repo
249 %define extra --with-mirror=file://$(pwd)/repo --with-repo=fedora-12
250 %else
251 %define extra %nil
252 %endif
253
254 ./configure \
255   --prefix=%{_prefix} --libdir=%{_libdir} \
256   --mandir=%{_mandir} \
257   --with-java-home=%{java_home} \
258   --with-qemu="qemu-kvm qemu-system-%{_build_arch} qemu" \
259   --enable-debug-command \
260   %{extra}
261
262 # This ensures that /usr/sbin/chroot is on the path.  Not needed
263 # except for RHEL 5, it shouldn't do any harm on other platforms.
264 export PATH=/usr/sbin:$PATH
265
266 # 'INSTALLDIRS' ensures that perl libs are installed in the vendor dir
267 # not the site dir.
268 make INSTALLDIRS=vendor %{?_smp_mflags}
269
270
271 %check
272 test -n "$QUICK_RPMBUILD" || make check
273
274
275 %install
276 rm -rf $RPM_BUILD_ROOT
277
278 make DESTDIR=$RPM_BUILD_ROOT install
279
280 rm $RPM_BUILD_ROOT%{_libdir}/libguestfs.a
281 rm $RPM_BUILD_ROOT%{_libdir}/libguestfs.la
282
283 # Clean up the examples/ directory which will get installed in %doc.
284 # Note we can't delete the original examples/Makefile because that
285 # will be needed by the check section later in the RPM build.
286 cp -a examples ex
287 pushd ex
288 make clean
289 rm Makefile*
290 rm -rf .deps .libs
291 popd
292
293 # Same for ocaml/examples.
294 cp -a ocaml/examples ocaml/ex
295 pushd ocaml/ex
296 make clean
297 rm Makefile*
298 popd
299
300 find $RPM_BUILD_ROOT -name perllocal.pod -delete
301 find $RPM_BUILD_ROOT -name .packlist -delete
302 find $RPM_BUILD_ROOT -name '*.bs' -delete
303
304 rm $RPM_BUILD_ROOT%{python_sitearch}/libguestfsmod.a
305 rm $RPM_BUILD_ROOT%{python_sitearch}/libguestfsmod.la
306
307 if [ "$RPM_BUILD_ROOT%{python_sitearch}" != "$RPM_BUILD_ROOT%{python_sitelib}" ]; then
308    mkdir -p $RPM_BUILD_ROOT%{python_sitelib}
309    mv $RPM_BUILD_ROOT%{python_sitearch}/guestfs.py* \
310      $RPM_BUILD_ROOT%{python_sitelib}/
311 fi
312
313 # Install ruby bindings by hand.
314 mkdir -p $RPM_BUILD_ROOT%{ruby_sitelib}
315 mkdir -p $RPM_BUILD_ROOT%{ruby_sitearch}
316 install -p -m0644 ruby/lib/guestfs.rb $RPM_BUILD_ROOT%{ruby_sitelib}
317 install -p -m0755 ruby/ext/guestfs/_guestfs.so $RPM_BUILD_ROOT%{ruby_sitearch}
318
319 # Remove static-linked Java bindings.
320 rm $RPM_BUILD_ROOT%{_libdir}/libguestfs_jni.a
321 rm $RPM_BUILD_ROOT%{_libdir}/libguestfs_jni.la
322
323 # Generator shouldn't be executable when we distribute it.
324 chmod -x src/generator.ml
325
326
327 %clean
328 rm -rf $RPM_BUILD_ROOT
329
330
331 %post -p /sbin/ldconfig
332
333 %postun -p /sbin/ldconfig
334
335
336 %files
337 %defattr(-,root,root,-)
338 %doc COPYING
339 %{_libdir}/guestfs/
340 %{_libdir}/libguestfs.so.*
341
342
343 %files devel
344 %defattr(-,root,root,-)
345 %doc ChangeLog HACKING TODO README ex html/guestfs.3.html html/pod.css
346 %doc src/generator.ml
347 %{_libdir}/libguestfs.so
348 %{_mandir}/man3/guestfs.3*
349 %{_includedir}/guestfs.h
350 %{_includedir}/guestfs-actions.h
351 %{_includedir}/guestfs-structs.h
352 %{_libdir}/pkgconfig/libguestfs.pc
353
354
355 %files -n guestfish
356 %defattr(-,root,root,-)
357 %doc html/guestfish.1.html html/pod.css recipes/
358 %{_bindir}/guestfish
359 %{_mandir}/man1/guestfish.1*
360
361
362 %files -n virt-inspector
363 %defattr(-,root,root,-)
364 %{_bindir}/virt-inspector
365 %{_mandir}/man1/virt-inspector.1*
366
367
368 %files -n ocaml-%{name}
369 %defattr(-,root,root,-)
370 %doc README
371 %{_libdir}/ocaml/guestfs
372 %exclude %{_libdir}/ocaml/guestfs/*.a
373 %exclude %{_libdir}/ocaml/guestfs/*.cmxa
374 %exclude %{_libdir}/ocaml/guestfs/*.cmx
375 %exclude %{_libdir}/ocaml/guestfs/*.mli
376 %{_libdir}/ocaml/stublibs/*.so
377 %{_libdir}/ocaml/stublibs/*.so.owner
378
379
380 %files -n ocaml-%{name}-devel
381 %defattr(-,root,root,-)
382 %doc ocaml/ex
383 %{_libdir}/ocaml/guestfs/*.a
384 %{_libdir}/ocaml/guestfs/*.cmxa
385 %{_libdir}/ocaml/guestfs/*.cmx
386 %{_libdir}/ocaml/guestfs/*.mli
387
388
389 %files -n perl-%{name}
390 %defattr(-,root,root,-)
391 %doc perl/examples
392 %{perl_vendorarch}/*
393 %{_mandir}/man3/Sys::Guestfs.3pm*
394
395
396 %files -n python-%{name}
397 %defattr(-,root,root,-)
398 %doc README
399 %{python_sitearch}/*
400 %{python_sitelib}/*.py
401 %{python_sitelib}/*.pyc
402 %{python_sitelib}/*.pyo
403
404
405 %files -n ruby-%{name}
406 %defattr(-,root,root,-)
407 %doc README
408 %{ruby_sitelib}/guestfs.rb
409 %{ruby_sitearch}/_guestfs.so
410
411
412 %files java
413 %defattr(-,root,root,-)
414 %doc README
415 %{_libdir}/libguestfs_jni*.so.*
416 %{_datadir}/java/*.jar
417
418
419 %files java-devel
420 %defattr(-,root,root,-)
421 %doc README
422 %{_libdir}/libguestfs_jni*.so
423
424
425 %files javadoc
426 %defattr(-,root,root,-)
427 %doc README
428 %{_datadir}/javadoc/%{name}-java-%{version}
429
430
431 %changelog
432 * Thu May  7 2009 Richard Jones <rjones@redhat.com> - @VERSION@-1
433 - New upstream version @VERSION@.
434
435 * Thu May  7 2009 Richard Jones <rjones@redhat.com> - 1.0.20-1
436 - New upstream version 1.0.20.
437
438 * Thu May  7 2009 Richard Jones <rjones@redhat.com> - 1.0.19-1
439 - New upstream version 1.0.19.
440
441 * Tue Apr 28 2009 Richard Jones <rjones@redhat.com> - 1.0.15-1
442 - New upstream version 1.0.15.
443
444 * Fri Apr 24 2009 Richard Jones <rjones@redhat.com> - 1.0.12-1
445 - New upstream version 1.0.12.
446
447 * Wed Apr 22 2009 Richard Jones <rjones@redhat.com> - 1.0.6-1
448 - New upstream version 1.0.6.
449
450 * Mon Apr 20 2009 Richard Jones <rjones@redhat.com> - 1.0.2-1
451 - New upstream version 1.0.2.
452
453 * Thu Apr 16 2009 Richard Jones <rjones@redhat.com> - 0.9.9-12
454 - Multiple fixes to get it to scratch build in Koji.
455
456 * Sat Apr  4 2009 Richard Jones <rjones@redhat.com> - 0.9.9-1
457 - Initial build.