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