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