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