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