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