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