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