c356506d49f251186423dae8d7024a9a4ce75c4c
[fedora-reviews.git] / guestfs-tools / guestfs-tools.spec
1 # Architectures that we run the test suite on.
2 #
3 # As the test suite takes a very long time to run and is somewhat
4 # unreliable on !x86 architectures, only run it on x86-64.
5 %if !0%{?rhel}
6 %global test_arches x86_64
7 %else
8 # RHEL 9 only:
9 # x86-64:  "/lib64/libc.so.6: CPU ISA level is lower than required"
10 #          (RHBZ#1919389)
11 %global test_arches NONE
12 %endif
13
14 # Verify tarball signature with GPGv2.
15 %global verify_tarball_signature 1
16
17 # If there are patches which touch autotools files, set this to 1.
18 %global patches_touch_autotools 1
19
20 # The source directory.
21 %global source_directory 1.45-development
22
23 # Filter perl provides.
24 %{?perl_default_filter}
25
26 Summary:       Tools to access and modify virtual machine disk images
27 Name:          guestfs-tools
28 Version:       1.45.2
29 Release:       3%{?dist}
30 License:       GPLv2+
31
32 # Build only for architectures that have a kernel
33 ExclusiveArch: %{kernel_arches}
34
35 # Source and patches.
36 URL:           http://libguestfs.org/
37 Source0:       http://download.libguestfs.org/guestfs-tools/%{source_directory}/%{name}-%{version}.tar.gz
38 %if 0%{verify_tarball_signature}
39 Source1:       http://download.libguestfs.org/guestfs-tools/%{source_directory}/%{name}-%{version}.tar.gz.sig
40 %endif
41
42 # Keyring used to verify tarball signature.
43 %if 0%{verify_tarball_signature}
44 Source2:       libguestfs.keyring
45 %endif
46
47 # Upstream patches to fix various build issues discovered while
48 # packaging this for Fedora.
49 Patch1:        0001-po-docs-podfiles-Fix-bogus-directories-in-this-file.patch
50 Patch2:        0002-po-docs-Don-t-try-to-install-.3-and-.5-files-which-d.patch
51 Patch3:        0003-build-Remove-dependency-on-gobject-introspection.patch
52 Patch4:        0004-build-Remove-dependency-on-perl-Sys-Virt.patch
53 Patch5:        0005-builder-Get-rid-of-etc-xdg-and-XDG_CONFIG_DIRS-nonse.patch
54 Patch6:        0006-builder-Use-correct-ounit2-module.patch
55 Patch7:        0007-Update-common-submodule-to-latest.patch
56
57 %if 0%{patches_touch_autotools}
58 BuildRequires: autoconf, automake, libtool, gettext-devel
59 %endif
60
61 # Basic build requirements.
62 BuildRequires: gcc, gcc-c++
63 BuildRequires: make
64 BuildRequires: libguestfs-devel >= 1.44.0
65 BuildRequires: libguestfs-xfs
66 BuildRequires: perl(Pod::Simple)
67 BuildRequires: perl(Pod::Man)
68 BuildRequires: perl(Test::More)
69 BuildRequires: /usr/bin/pod2text
70 BuildRequires: po4a
71 BuildRequires: pcre2-devel
72 BuildRequires: libxml2-devel
73 BuildRequires: jansson-devel
74 BuildRequires: libvirt-devel
75 BuildRequires: libxcrypt-devel
76 BuildRequires: ncurses-devel
77 BuildRequires: ocaml-libguestfs-devel
78 BuildRequires: ocaml-findlib-devel
79 BuildRequires: ocaml-gettext-devel
80 %if !0%{?rhel}
81 BuildRequires: ocaml-ounit-devel
82 %endif
83 BuildRequires: flex
84 BuildRequires: bison
85 BuildRequires: xz-devel
86 %if !0%{?rhel}
87 BuildRequires: zip
88 BuildRequires: unzip
89 %endif
90 %if !0%{?rhel}
91 BuildRequires: perl(Expect)
92 %endif
93 BuildRequires: bash-completion
94 BuildRequires: /usr/bin/qemu-img
95 BuildRequires: perl(Locale::TextDomain)
96 BuildRequires: perl(Sys::Guestfs)
97 BuildRequires: perl(Win::Hivex)
98 BuildRequires: perl(Win::Hivex::Regedit)
99
100 %if 0%{verify_tarball_signature}
101 BuildRequires: gnupg2
102 %endif
103
104 # For virt-builder:
105 Requires:      curl
106 Requires:      gnupg2
107 Requires:      /usr/bin/qemu-img
108 Requires:      xz
109
110 # For virt-builder-repository:
111 Suggests:      osinfo-db
112
113 # For virt-inspector, since Fedora and RHEL >= 7 use XFS:
114 Recommends:    libguestfs-xfs
115
116 # For virt-edit and virt-customize:
117 Suggests:      perl
118
119 # This replaces the libguestfs-tools-c package.
120 Provides:      libguestfs-tools-c = 1:%{version}-%{release}
121 Obsoletes:     libguestfs-tools-c <= 1:1.45.2-1
122
123
124 %description
125 guestfs-tools is a set of tools that can be used to make batch
126 configuration changes to guests, get disk used/free statistics
127 (virt-df), perform backups and guest clones, change
128 registry/UUID/hostname info, build guests from scratch (virt-builder)
129 and much more.
130
131 Virt-alignment-scan scans virtual machines looking for partition
132 alignment problems.
133
134 Virt-builder is a command line tool for rapidly making disk images
135 of popular free operating systems.
136
137 Virt-cat is a command line tool to display the contents of a file in a
138 virtual machine.
139
140 Virt-customize is a command line tool for customizing virtual machine
141 disk images.
142
143 Virt-df is a command line tool to display free space on virtual
144 machine filesystems.  Unlike other tools, it doesn’t just display the
145 amount of space allocated to a virtual machine, but can look inside
146 the virtual machine to see how much space is really being used.  It is
147 like the df(1) command, but for virtual machines, except that it also
148 works for Windows virtual machines.
149
150 Virt-diff shows the differences between virtual machines.
151
152 Virt-edit is a command line tool to edit the contents of a file in a
153 virtual machine.
154
155 Virt-filesystems is a command line tool to display the filesystems,
156 partitions, block devices, LVs, VGs and PVs found in a disk image
157 or virtual machine.  It replaces the deprecated programs
158 virt-list-filesystems and virt-list-partitions with a much more
159 capable tool.
160
161 Virt-format is a command line tool to erase and make blank disks.
162
163 Virt-get-kernel extracts a kernel/initrd from a disk image.
164
165 Virt-inspector examines a virtual machine and tries to determine the
166 version of the OS, the kernel version, what drivers are installed,
167 whether the virtual machine is fully virtualized (FV) or
168 para-virtualized (PV), what applications are installed and more.
169
170 Virt-log is a command line tool to display the log files from a
171 virtual machine.
172
173 Virt-ls is a command line tool to list out files in a virtual machine.
174
175 Virt-make-fs is a command line tool to build a filesystem out of
176 a collection of files or a tarball.
177
178 Virt-resize can resize existing virtual machine disk images.
179
180 Virt-sparsify makes virtual machine disk images sparse (thin-provisioned).
181
182 Virt-sysprep lets you reset or unconfigure virtual machines in
183 preparation for cloning them.
184
185 Virt-tail follows (tails) a log file within a guest, like 'tail -f'.
186
187
188 %package -n virt-win-reg
189 Summary:       Access and modify the Windows Registry of a Windows VM
190 License:       GPLv2+
191 BuildArch:     noarch
192
193 # This replaces the libguestfs-tools package.
194 Provides:      libguestfs-tools = 1:%{version}-%{release}
195 Obsoletes:     libguestfs-tools <= 1:1.45.2-1
196
197
198 %description -n virt-win-reg
199 Virt-win-reg lets you look at and modify the Windows Registry of
200 Windows virtual machines.
201
202
203 %if !0%{?rhel}
204 %package -n virt-dib
205 Summary:       Safe and secure diskimage-builder replacement
206 License:       GPLv2+
207
208 Requires:      libguestfs-dib >= 1:1.45.2-1
209
210
211 %description -n virt-dib
212 Virt-dib is a safe and secure alternative to the OpenStack
213 diskimage-builder command.  It is compatible with most
214 diskimage-builder elements.
215 %endif
216
217
218 %package bash-completion
219 Summary:       Bash tab-completion scripts for %{name}
220 BuildArch:     noarch
221 Requires:      bash-completion >= 2.0
222 Requires:      %{name} = %{version}-%{release}
223
224
225 %description bash-completion
226 Install this package if you want intelligent bash tab-completion
227 for the virt-* tools.
228
229
230 %package man-pages-ja
231 Summary:       Japanese (ja) man pages for %{name}
232 BuildArch:     noarch
233 Requires:      %{name} = %{version}-%{release}
234
235 %description man-pages-ja
236 %{name}-man-pages-ja contains Japanese (ja) man pages
237 for %{name}.
238
239
240 %package man-pages-uk
241 Summary:       Ukrainian (uk) man pages for %{name}
242 BuildArch:     noarch
243 Requires:      %{name} = %{version}-%{release}
244
245 %description man-pages-uk
246 %{name}-man-pages-uk contains Ukrainian (uk) man pages
247 for %{name}.
248
249
250 %prep
251 %if 0%{verify_tarball_signature}
252 %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
253 %endif
254 %setup -q
255 %autopatch -p1
256
257 %if 0%{patches_touch_autotools}
258 autoreconf -i
259 %endif
260
261
262 %build
263 %{configure}
264
265 # Building index-parse.c by hand works around a race condition in the
266 # autotools cruft, where two or more copies of yacc race with each
267 # other, resulting in a corrupted file.
268 make -j1 -C builder index-parse.c
269
270 make V=1 %{?_smp_mflags}
271
272
273 %check
274 %ifarch %{test_arches}
275 # Enable debugging.
276 export LIBGUESTFS_DEBUG=1
277 export LIBGUESTFS_TRACE=1
278
279 # This test is currently broken and needs further investigation.
280 export SKIP_TEST_MACHINE_READABLE_SH=1
281
282 # This test fails for me in local mock and Koji, but not when running
283 # in an unrestricted environment.
284 export SKIP_TEST_VIRT_FORMAT_SH=1
285
286 if ! make check -k ; then
287     # Dump out the log files of any failing tests to make
288     # debugging test failures easier.
289     for f in `find -name test-suite.log | xargs grep -l ^FAIL:`; do
290         echo '*****' $f '*****'
291         cat $f
292         echo
293     done
294     exit 1
295 fi
296 %endif
297
298
299 %install
300 make DESTDIR=$RPM_BUILD_ROOT install
301
302 # Delete libtool files.
303 find $RPM_BUILD_ROOT -name '*.la' -delete
304
305 # Move installed documentation back to the source directory so
306 # we can install it using a %%doc rule.
307 mv $RPM_BUILD_ROOT%{_docdir}/%{name} installed-docs
308 gzip --best installed-docs/*.xml
309
310
311 # Find locale files.
312 %find_lang %{name}
313
314
315 %files -f %{name}.lang
316 %license COPYING
317 %doc README
318 %doc installed-docs/*
319 %dir %{_sysconfdir}/virt-builder
320 %dir %{_sysconfdir}/virt-builder/repos.d
321 %config(noreplace) %{_sysconfdir}/virt-builder/repos.d/*
322 %{_bindir}/virt-alignment-scan
323 %{_bindir}/virt-builder
324 %{_bindir}/virt-builder-repository
325 %{_bindir}/virt-cat
326 %{_bindir}/virt-customize
327 %{_bindir}/virt-df
328 %{_bindir}/virt-diff
329 %{_bindir}/virt-edit
330 %{_bindir}/virt-filesystems
331 %{_bindir}/virt-format
332 %{_bindir}/virt-get-kernel
333 %{_bindir}/virt-index-validate
334 %{_bindir}/virt-inspector
335 %{_bindir}/virt-log
336 %{_bindir}/virt-ls
337 %{_bindir}/virt-make-fs
338 %{_bindir}/virt-resize
339 %{_bindir}/virt-sparsify
340 %{_bindir}/virt-sysprep
341 %{_bindir}/virt-tail
342 %{_mandir}/man1/virt-alignment-scan.1*
343 %{_mandir}/man1/virt-builder-repository.1*
344 %{_mandir}/man1/virt-builder.1*
345 %{_mandir}/man1/virt-cat.1*
346 %{_mandir}/man1/virt-customize.1*
347 %{_mandir}/man1/virt-df.1*
348 %{_mandir}/man1/virt-diff.1*
349 %{_mandir}/man1/virt-edit.1*
350 %{_mandir}/man1/virt-filesystems.1*
351 %{_mandir}/man1/virt-format.1*
352 %{_mandir}/man1/virt-get-kernel.1*
353 %{_mandir}/man1/virt-index-validate.1*
354 %{_mandir}/man1/virt-inspector.1*
355 %{_mandir}/man1/virt-log.1*
356 %{_mandir}/man1/virt-ls.1*
357 %{_mandir}/man1/virt-make-fs.1*
358 %{_mandir}/man1/virt-resize.1*
359 %{_mandir}/man1/virt-sparsify.1*
360 %{_mandir}/man1/virt-sysprep.1*
361 %{_mandir}/man1/virt-tail.1*
362
363
364 %files -n virt-win-reg
365 %license COPYING
366 %doc README
367 %{_bindir}/virt-win-reg
368 %{_mandir}/man1/virt-win-reg.1*
369
370
371 %if !0%{?rhel}
372 %files -n virt-dib
373 %license COPYING
374 %doc README
375 %{_bindir}/virt-dib
376 %{_mandir}/man1/virt-dib.1*
377 %endif
378
379
380 %files bash-completion
381 %license COPYING
382 %dir %{_datadir}/bash-completion/completions
383 %{_datadir}/bash-completion/completions/virt-*
384
385
386 %files man-pages-ja
387 %lang(ja) %{_mandir}/ja/man1/*.1*
388
389
390 %files man-pages-uk
391 %lang(uk) %{_mandir}/uk/man1/*.1*
392
393
394 %changelog
395 * Thu Mar 25 2021 Richard W.M. Jones <rjones@redhat.com> - 1.45.2-3
396 - Add perl(Test::More) dependency for the Perl test suite.
397 - Fix ounit2 dependency again.
398
399 * Wed Mar 24 2021 Richard W.M. Jones <rjones@redhat.com> - 1.45.2-2
400 - Add perl(Locale::TextDomain) dependency for virt-win-reg.
401 - Fix ounit2 dependency upstream.
402
403 * Tue Mar 23 2021 Richard W.M. Jones <rjones@redhat.com> - 1.45.2-1
404 - New guestfs-tools package, split off from libguestfs.