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