Unify Fedora and RHEL spec files.

This commit is contained in:
Richard W.M. Jones 2020-12-02 21:11:37 +00:00
parent db25f16e0c
commit 6ec7a0de06
2 changed files with 106 additions and 15 deletions

55
copy-patches.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash -
set -e
# Maintainer script to copy patches from the git repo to the current
# directory. Use it like this:
# ./copy-patches.sh
rhel_version=av-8.3.0
# Check we're in the right directory.
if [ ! -f virt-v2v.spec ]; then
echo "$0: run this from the directory containing 'virt-v2v.spec'"
exit 1
fi
git_checkout=$HOME/d/virt-v2v-rhel-$rhel_version
if [ ! -d $git_checkout ]; then
echo "$0: $git_checkout does not exist"
echo "This script is only for use by the maintainer when preparing a"
echo "virt-v2v release on RHEL."
exit 1
fi
# Get the base version of virt-v2v.
version=`grep '^Version:' virt-v2v.spec | awk '{print $2}'`
tag="v$version"
# Remove any existing patches.
git rm -f [0-9]*.patch ||:
rm -f [0-9]*.patch
# Get the patches.
(cd $git_checkout; rm -f [0-9]*.patch; git format-patch -N --submodule=diff $tag)
mv $git_checkout/[0-9]*.patch .
# Remove any not to be applied.
rm -f *NOT-FOR-RPM*.patch
# Add the patches.
git add [0-9]*.patch
# Print out the patch lines.
echo
echo "--- Copy the following text into virt-v2v.spec file"
echo
echo "# Patches."
for f in [0-9]*.patch; do
n=`echo $f | awk -F- '{print $1}'`
echo "Patch$n: $f"
done
echo
echo "--- End of text"

View File

@ -10,7 +10,7 @@
Name: virt-v2v
Epoch: 1
Version: 1.43.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPLv2+
@ -23,6 +23,10 @@ Source1: http://download.libguestfs.org/virt-v2v/%{source_directory}/%{nam
Source2: libguestfs.keyring
%endif
# Maintainer script which helps with handling patches.
Source3: copy-patches.sh
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
# kernel built for this architecture any longer and libguestfs rather
# fundamentally depends on the kernel. Therefore we must exclude this
@ -30,6 +34,14 @@ Source2: libguestfs.keyring
# expect that libguestfs or virt-v2v will be available on i686 so
# there is nothing that needs fixing.
ExcludeArch: %{ix86}
%else
# Architectures where virt-v2v is shipped on RHEL:
#
# not on aarch64 because it is not useful there
# not on %%{power64} because of RHBZ#1287826
# not on s390x because it is not useful there
ExclusiveArch: x86_64
%endif
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
@ -38,7 +50,7 @@ BuildRequires: autoconf, automake, libtool
BuildRequires: /usr/bin/pod2man
BuildRequires: gcc
BuildRequires: ocaml >= 4.01
BuildRequires: libguestfs-devel >= 1:1.40
BuildRequires: libguestfs-devel >= 1:1.42
BuildRequires: augeas-devel
BuildRequires: bash-completion
@ -47,7 +59,6 @@ BuildRequires: gettext-devel
BuildRequires: jansson-devel
BuildRequires: libosinfo-devel
BuildRequires: libvirt-devel
BuildRequires: libvirt-daemon-qemu
BuildRequires: libvirt-daemon-kvm
BuildRequires: libxml2-devel
BuildRequires: pcre-devel
@ -67,8 +78,13 @@ BuildRequires: nbdkit-python-plugin
BuildRequires: gnupg2
%endif
Requires: libguestfs%{?_isa} >= 1:1.40
Requires: libguestfs-tools-c >= 1:1.40
Requires: libguestfs%{?_isa} >= 1:1.42
Requires: libguestfs-tools-c >= 1:1.42
%if 0%{?rhel}
# For Windows conversions on RHEL.
Requires: libguestfs-winsupport >= 7.2
%endif
Requires: gawk
Requires: gzip
@ -76,11 +92,21 @@ Requires: unzip
Requires: curl
Requires: /usr/bin/virsh
Recommends: nbdkit
Recommends: nbdkit-curl-plugin
Recommends: nbdkit-python-plugin
Recommends: nbdkit-ssh-plugin
Recommends: nbdkit-vddk-plugin
# Ensure the UEFI firmware is available, to properly convert
# EFI guests (RHBZ#1429643).
%ifarch x86_64
Requires: edk2-ovmf
%endif
%ifarch aarch64
Requires: edk2-aarch64
%endif
# Needed for -it vddk, and -o rhv-upload.
Requires: nbdkit
Requires: nbdkit-curl-plugin
Requires: nbdkit-python-plugin
Requires: nbdkit-ssh-plugin
Requires: nbdkit-vddk-plugin
# For rhsrvany.exe, used to install firstboot scripts in Windows guests.
Requires: mingw32-srvany >= 1.0-13
@ -132,14 +158,21 @@ for %{name}.
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%endif
%autosetup -p1
%if 0%{patches_touch_autotools}
autoreconf -i
%endif
%build
%configure
make %{?_smp_mflags}
%configure \
%if !0%{?rhel}
--with-extra="fedora=%{fedora},release=%{release}" \
%else
--with-extra="rhel=%{rhel},release=%{release}" \
%endif
make V=1 %{?_smp_mflags}
%install
@ -155,9 +188,10 @@ pushd $RPM_BUILD_ROOT%{_datadir}/virt-tools
ln -sf /usr/i686-w64-mingw32/sys-root/mingw/bin/rhsrvany.exe
popd
# Delete the v2v test harness (except for the man page).
# Delete the v2v test harness.
rm -r $RPM_BUILD_ROOT%{_libdir}/ocaml/v2v_test_harness
rm -r $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs/dllv2v_test_harness*
rm $RPM_BUILD_ROOT%{_mandir}/man1/virt-v2v-test-harness.1*
# Find locale files.
%find_lang %{name}
@ -193,7 +227,7 @@ rm -r $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs/dllv2v_test_harness*
%files -f %{name}.lang
%license COPYING
#doc README
%doc README
%{_bindir}/virt-v2v
%{_bindir}/virt-v2v-copy-to-local
%{_mandir}/man1/virt-v2v.1*
@ -206,7 +240,6 @@ rm -r $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs/dllv2v_test_harness*
%{_mandir}/man1/virt-v2v-output-rhv.1*
%{_mandir}/man1/virt-v2v-release-notes-1.42.1*
%{_mandir}/man1/virt-v2v-support.1*
%{_mandir}/man1/virt-v2v-test-harness.1*
%{_datadir}/virt-tools
@ -227,6 +260,9 @@ rm -r $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs/dllv2v_test_harness*
%changelog
* Wed Dec 02 2020 Richard W.M. Jones <rjones@redhat.com> - 1:1.43.2-2
- Unify Fedora and RHEL spec files.
* Tue Dec 01 2020 Richard W.M. Jones <rjones@redhat.com> - 1:1.43.2-1
- New upstream version 1.43.2.