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