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