#43 Introduce a 'qemu-srpm-macros' sub-RPM for packages consuming QEMU
Opened 8 months ago by berrange. Modified 24 days ago
rpms/ berrange/qemu main  into  main

file added
@@ -0,0 +1,16 @@ 

+ # RPM macros for QEMU


+ # Host architectures where linux-user emulation is present

+ %qemu_useremu_host_arches   aarch64 %{arm} %{ix86} %{mips} %{power64} riscv64 s390x x86_64


+ # Host architectures where full machine emulators are present

+ %qemu_sysemu_host_arches    aarch64 %{arm} %{ix86} %{mips} %{power64} riscv64 s390x x86_64


+ # Host architectures where the disk image tools (qemu-img, qemu-store-daemon, qemu-nbd) are present

+ %qemu_image_tools_arches    aarch64 %{arm} %{ix86} %{mips} %{power64} riscv64 s390x x86_64


+ # Host architectures where KVM accelerator for full machine emulators is present

+ %qemu_sysemu_kvm_arches     aarch64 %{ix86} %{mips} %{power64} riscv64 s390x x86_64


+ # If TCG is available for full machine emulators of non-native architectures

+ %qemu_sysemu_tcg_non_native 1

file modified
+17 -3
@@ -29,9 +29,6 @@ 

  %ifarch s390x

  %global kvm_package   system-s390x


- %ifarch armv7hl

- %global kvm_package   system-arm

- %endif

  %ifarch aarch64

  %global kvm_package   system-aarch64

@@ -61,6 +58,9 @@ 

  %global have_kvm 0

  %if 0%{?kvm_package:1}

  %global have_kvm 1

+ %define obsoletes_package_kvm %{nil}

+ %else

+ %define obsoletes_package_kvm Obsoletes: %{name}-kvm < %{evr}



  # Matches numactl ExcludeArch
@@ -315,6 +315,7 @@ 

  %{obsoletes_block_gluster} \

  %{obsoletes_block_rbd} \

  %{obsoletes_package_virtiofsd} \

+ %{obsoletes_package_kvm} \

  Obsoletes: %{name}-system-lm32 <= %{epoch}:%{version}-%{release} \

  Obsoletes: %{name}-system-lm32-core <= %{epoch}:%{version}-%{release} \

  Obsoletes: %{name}-system-moxie <= %{epoch}:%{version}-%{release} \
@@ -353,6 +354,7 @@ 

  Source30: kvm-s390x.conf

  Source31: kvm-x86.conf

  Source36: README.tests

+ Source37: macros.qemu-srpm


  # Fix SGX assert

  Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch
@@ -572,6 +574,11 @@ 


  This package provides documentation and auxiliary programs used with %{name}.


+ %package srpm-macros

+ Summary: RPM macros for building packages relying on QEMU

+ %description srpm-macros

+ %{name}-srpm-macros provides RPM macros that are useful when

+ building packages that rely on QEMU


  %package docs

  Summary: %{name} documentation
@@ -2001,6 +2008,7 @@ 

  # endif !tools_only



+ install -m 0644 -D -t %{buildroot}%{_rpmconfigdir}/macros.d/ %{SOURCE37}



@@ -2160,6 +2168,8 @@ 




+ %files -n qemu-srpm-macros

+ %{_rpmconfigdir}/macros.d/macros.qemu-srpm


  %files -n qemu-guest-agent

@@ -2784,6 +2794,10 @@ 




+ * Thu Jul 13 2023 Daniel P. Berrangé <berrange@redhat.com> - 8.0.2-2

+ - Drop qemu-kvm package on arm7

+ - Introduce qemu-srpm-macros


  * Mon Jul 03 2023 Camilla Conte <cconte@redhat.com> - 2:8.0.2-1

  - New upstream release 8.0.2

  - Fix arabic keyboard layout name

QEMU has been deprecating and dropping certain platforms/features
over the recent times. A while ago it dropped KVM on arm7 hosts
and QEMU system emulators are scheduled for removal on i686.

Packages which depend on QEMU will need to use ExclusiveArch or
arch conditional dependancies to take account of these changes.

Providing a 'qemu-srpm-macros' package will help consumers of QEMU
adapt their specfile, without having to hardcode specific lists of

  • %qemu_useremu_host_arches

Host architectures where linux-user emulation is present

  • %qemu_sysemu_host_arches

Host architectures where full machine emulators are present

  • %qemu_image_tools_arches

Host architectures where the disk image tools (qemu-img,
qemu-store-daemon, qemu-nbd) are present

  • %qemu_sysemu_kvm_arches

Host architectures where KVM accelerator for full machine emulators
is present, and thus qemu-kvm package exists

  • %qemu_sysemu_tcg_non_native

If TCG is available for full machine emulators of non-native

This set of variables was identified as the set that represents the key
differences in feature availability per architecture, between Fedora
builds and ELN/CentOS/RHEL builds, as well as likely future 32-bit
host retirement in future QEMU builds in Fedora.

For example ELN would have a macros.qemu-srpm containing


%qemu_sysemu_host_arches aarch64 s390x x86_64

%qemu_image_tools_arches aarch64 ppc64le s390x x86_64

%qemu_sysemu_kvm_arches aarch64 s390x x86_64

%qemu_sysemu_tcg_non_native 0

So I have two contradictory comments on this ...

For ocaml we have ocaml-srpm-macros which is a separate source package. This is good because it means that redhat-rpm-config can require this package without causing excessive circular dependencies. (The package itself is essentially just a few text files and has no significant build or runtime deps.) Since just about everything BuildRequires: redhat-rpm-config (maybe indirectly) that means that to bootstrap Fedora you also have to build *-srpm-macros, which is easy if they are trivial source packages. (https://src.fedoraproject.org/rpms/ocaml-srpm-macros/tree/rawhide)

Conversely for supermin we throw a few RPM macros into the supermin-devel subpackage because that was easier than creating a whole new source package: https://src.fedoraproject.org/rpms/supermin/blob/rawhide/f/supermin.spec#_205 Plus only 1 or 2 other packages need the macros.

So I think if we were to ever need to have this added as a Requires of some base build package we might consider doing it as a separate package rather than a qemu subpackage.

Doesn't seem like there's a hugely strong standard for separate src.rpm vs a sub-RPM

# for i in `rpm -qa --qf '[%{NAME}\n]' | grep rpm-macros` ; do f=`rpm -qi $i | grep ^Source | awk '{print $4}'`; echo "$i: $f"; done
perl-srpm-macros: perl-srpm-macros-1-48.fc38.src.rpm
openblas-srpm-macros: openblas-srpm-macros-2-13.fc38.src.rpm
ocaml-srpm-macros: ocaml-srpm-macros-7-3.fc38.src.rpm
gnat-srpm-macros: gnat-srpm-macros-6-2.fc38.src.rpm
ghc-srpm-macros: ghc-srpm-macros-1.6.1-1.fc38.src.rpm
fpc-srpm-macros: fpc-srpm-macros-1.3-7.fc38.src.rpm
nim-srpm-macros: nim-srpm-macros-3-8.fc38.src.rpm
lua-srpm-macros: lua-rpm-macros-1-8.fc38.src.rpm
lua-rpm-macros: lua-rpm-macros-1-8.fc38.src.rpm
efi-srpm-macros: efi-rpm-macros-5-7.fc38.src.rpm
rpmautospec-rpm-macros: python-rpmautospec-0.3.5-1.fc38.src.rpm
fonts-srpm-macros: fonts-rpm-macros-2.0.5-11.fc38.src.rpm
go-srpm-macros: go-rpm-macros-3.2.0-2.fc38.src.rpm
python-rpm-macros: python-rpm-macros-3.11-10.fc38.src.rpm
python3-rpm-macros: python-rpm-macros-3.11-10.fc38.src.rpm
python-srpm-macros: python-rpm-macros-3.11-10.fc38.src.rpm
go-rpm-macros: go-rpm-macros-3.2.0-2.fc38.src.rpm
rust-srpm-macros: rust-packaging-24-2.fc38.src.rpm
cargo-rpm-macros: rust-packaging-24-2.fc38.src.rpm
cmake-rpm-macros: cmake-3.26.4-4.fc38.src.rpm
ansible-srpm-macros: ansible-packaging-1-10.fc38.src.rpm
qt6-rpm-macros: qt6-6.5.1-1.fc38.src.rpm
package-notes-srpm-macros: package-notes-0.5-8.fc38.src.rpm
pyproject-srpm-macros: pyproject-rpm-macros-1.9.0-1.fc38.src.rpm
pyproject-rpm-macros: pyproject-rpm-macros-1.9.0-1.fc38.src.rpm
systemd-rpm-macros: systemd-253.5-1.fc38.src.rpm
python-qt5-rpm-macros: python-qt5-5.15.9-3.fc38.src.rpm
qt5-rpm-macros: qt5-5.15.10-1.fc38.src.rpm
qt5-srpm-macros: qt5-5.15.10-1.fc38.src.rpm
kernel-srpm-macros: kernel-srpm-macros-1.0-19.fc38.src.rpm

QEMU macros feel like something we're unlikely to want to pull in from redhat-rpm-config by default.

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

Makes sense to me. Needs rebase obviously.

So what packages would need updating after this? libvirt, gnome-boxes, libguestfs. FWIW virt-manager is fine given the way its deps are structured.

I forgot about this, but last time I looked there was a surprisingly large set of things in fedora depending on either qemu or libvirt which could be impacted.

I think we should do this. I can update the following packages once it is in Rawhide:

  • libguestfs
  • guestfs-tools
  • virt-v2v
  • nbdkit (builds a libguestfs plugin that uses qemu)
  • libnbd (needs qemu-img for some tests)
  • qemu-sanity-check
  • supermin (uses qemu for tests)
  • virt-top
  • american-fuzzy-lop
  • ocaml-libvirt

Other packages which we should consider:

  • ceph
  • cockpit-machines
  • edk2
  • glusterfs (obsolete now?)
  • gnome-boxes
  • ipxe
  • koji (runtime requires qemu-img)
  • libkrun
  • libvirt-python
  • libvirt-sandbox (obsolete?)
  • libvirt-test-API
  • mom (runtime requires qemu)
  • openbios
  • oz (obsolete?)
  • pcp (has a -kvm subpackage, but not sure if that's really KVM)
  • qt-virt-manager
  • ravada (build & runtime requires qemu-img)
  • rubygem-ruby-libvirt
  • seabios
  • SLOF
  • systemd
  • testcloud
  • tmt
  • tuned
  • virt-install / virt-manager
  • virt-xml
  • xen