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