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