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