From 1e0417ee35d86632ffd988dfc0414b33b9a33181 Mon Sep 17 00:00:00 2001 From: Yariv Rachmani Date: Sun, 19 Jan 2025 11:45:38 +0200 Subject: [PATCH] Fix subpackages make file It seems that subpackaged rpm was not set correctly Make subpackages creation could be done with the following command make TARGETS=kvm subpackages Signed-off-by: Yariv Rachmani --- Makefile | 15 ++++++++++----- README.md | 11 ++++++----- rpm/kvm/qm-kvm.spec | 11 ++++------- subsystems/kvm/Makefile | 35 +++++++++++++++++++++-------------- 4 files changed, 41 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 51eee8b6..1a469ac3 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,9 @@ LIBDIR ?= $(PREFIX)/lib SYSCONFDIR?=/etc QMDIR=/usr/lib/qm SPECFILE=rpm/qm.spec -# SUBSYS := subsystems/kvm subsystems/windowmanager subsystems/sound subsystems/video subsystems/radio subsystems/dvb subsystems/tty7 subsystems/input subsystems/ttyUSB0 subsystems/text2speech subsystems/img_tempdir subsystems/ros2 -SUBSYS := -export RPM_TOPDIR ?= $(PWD)/rpmbuild -export VERSION ?= $(shell cat VERSION) -export ROOTDIR ?= $(PWD) +RPM_TOPDIR ?= $(PWD)/rpmbuild +VERSION ?= $(shell cat VERSION) +ROOTDIR ?= $(PWD) # Default help target .PHONY: help @@ -76,6 +74,13 @@ rpm: clean dist ## - Creates a local RPM package, useful for develop --define="version ${VERSION}" \ ${SPECFILE} +.PHONY: subpackages +subpackages: $(TARGETS) +$(TARGETS): + @echo "Entering directory: subsystem/$@" + $(MAKE) -C subsystems/$@ + make -f subsystems/$@/Makefile $@ + install-policy: all ## - Install selinux policies only semodule -i ${TARGETS}.pp.bz2 sepolicy manpage --path . --domain ${TARGETS}_t diff --git a/README.md b/README.md index 2ffa9a31..afc8d8e7 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ img_tempdir_subpackage - Creates a local RPM package, useful for dev windowmanager_subpackage - Creates a local RPM package, useful for development douglas@fedora:~/qm-multiplespecs/qm$ -make input_subpackage +make TARGETS=input subpackages ls rpmbuild/RPMS/noarch/ qm-0.6.7-1.fc40.noarch.rpm qm_mount_bind_input-0.6.7-1.fc40.noarch.rpm ``` @@ -177,7 +177,8 @@ The video sub-package exposes `/dev/video0` (or many video devices required) to ### Building the video sub-package, installing, and restarting QM ```bash -make video_subpackage +make TARGETS=video subpackages + sudo podman restart qm sudo dnf install ./rpmbuild/RPMS/noarch/qm_mount_bind_video-0.6.7-1.fc40.noarch.rpm ``` @@ -215,7 +216,7 @@ Run the following commands to install the `qm_mount_bind_sound` package and rest ```bash # Build and install the RPM for QM sound git clone https://github.com/containers/qm.git && cd qm -make sound_subpackage +make TARGETS=sound subpackages sudo dnf install -y rpmbuild/RPMS/noarch/qm_mount_bind_sound-0.6.7-1.fc40.noarch.rpm # Restart QM container (if already running) @@ -329,7 +330,7 @@ How to test this env? ```bash git clone https://github.com/containers/qm.git && cd qm -make ros2_rolling_subpackage +make TARGETS=ros2_rolling subpackages sudo dnf install rpmbuild/RPMS/noarch/qm_ros2_rolling-0.6.7-1.fc40.noarch.rpm -y sudo podman restart qm # if you have qm already running @@ -349,7 +350,7 @@ Step 1: clone QM repo, install libvirt packages, prepare some files inside QM a ```bash git clone https://github.com/containers/qm.git && cd qm -make kvm_subpackage +make TARGETS=kvm subpackages sudo dnf install rpmbuild/RPMS/noarch/qm_mount_bind_kvm-0.6.7-1.fc40.noarch.rpm sudo podman restart qm # if you have qm already running sudo dnf --installroot /usr/lib/qm/rootfs/ install virt-install libvirt-daemon libvirt-daemon-qemu libvirt-daemon-kvm -y diff --git a/rpm/kvm/qm-kvm.spec b/rpm/kvm/qm-kvm.spec index 504d5018..cdce7bce 100644 --- a/rpm/kvm/qm-kvm.spec +++ b/rpm/kvm/qm-kvm.spec @@ -4,12 +4,12 @@ %global rootfs_qm %{_prefix}/lib/qm/rootfs/ Name: qm-kvm -Version: 0 +Version: 0.6.9 Release: 1%{?dist} Summary: Drop-in configuration for QM containers to mount bind /dev/kvm License: GPL-2.0-only URL: https://github.com/containers/qm -Source0: %{url}/archive/v%{version}.tar.gz +Source0: %{url}/archive/qm-kvm-%{version}.tar.gz BuildArch: noarch # Build requirements @@ -28,17 +28,14 @@ Requires: podman This subpackage provides a drop-in configuration for the QM environment to enable mount binding of `/dev/kvm` from the host system to containers. This configuration is essential for supporting KVM-based virtualization within QM containers. %prep -%autosetup -n qm-%{version} - -%build -%{__make} all +%autosetup -Sgit -n qm-kvm-%{version} %install # Create the directory for drop-in configurations install -d %{buildroot}%{_sysconfdir}/containers/systemd/qm.container.d # Install the KVM drop-in configuration file -install -m 644 %{_builddir}/qm-%{version}/etc/containers/systemd/qm.container.d/qm_dropin_mount_bind_kvm.conf \ +install -m 644 %{_builddir}/qm-kvm-%{version}/etc/containers/systemd/qm.container.d/qm_dropin_mount_bind_kvm.conf \ %{buildroot}%{_sysconfdir}/containers/systemd/qm.container.d/qm_dropin_mount_bind_kvm.conf %files -n qm-kvm diff --git a/subsystems/kvm/Makefile b/subsystems/kvm/Makefile index 7a6161f4..1cbe28d7 100644 --- a/subsystems/kvm/Makefile +++ b/subsystems/kvm/Makefile @@ -1,26 +1,33 @@ -SPECFILE_SUBPACKAGE_KVM=rpm/kvm/qm-kvm.spec +RPM_TOPDIR ?= $(PWD)/rpmbuild +VERSION ?= $(shell cat VERSION) +ROOTDIR ?= $(PWD) +SPECFILE_SUBPACKAGE_IMG_KVM ?= ${ROOTDIR}/rpm/kvm/qm-kvm.spec .PHONY: dist dist: ## - Creates the QM kvm package - cd $(ROOTDIR) && tar cvz \ - --exclude-from=build-aux/exclude_from_tar_gz_subpackage_kvm.txt \ + cd ${ROOTDIR} && tar cvz \ --dereference \ - --transform s/qm/qm-kvm-${VERSION}/ \ + --transform 's|subsystems/kvm/Makefile|Makefile|' \ + --transform 's|rpm/kvm/qm-kvm.spec|qm-kvm.spec|' \ + --transform 's|qm|qm-kvm-${VERSION}|' \ -f /tmp/qm-kvm-${VERSION}.tar.gz \ + ../qm/rpm/kvm/qm-kvm.spec \ + ../qm/subsystems/kvm/Makefile \ + ../qm/tools/version-update \ + ../qm/VERSION \ ../qm/README.md \ ../qm/SECURITY.md \ ../qm/LICENSE \ - ../qm/ \ ../qm/etc/containers/systemd/qm.container.d/qm_dropin_mount_bind_kvm.conf - cd $(ROOTDIR) && mv /tmp/qm-kvm-${VERSION}.tar.gz ./rpm + cd ${ROOTDIR} && mv /tmp/qm-kvm-${VERSION}.tar.gz ./rpm -.PHONY: rpm -rpm: dist ## - Creates a local RPM windowmanager package, useful for development - cd $(ROOTDIR) && mkdir -p ${RPM_TOPDIR}/{RPMS,SRPMS,BUILD,SOURCES} - cd $(ROOTDIR) && tools/version-update -v ${VERSION} - cd $(ROOTDIR) && cp ./rpm/v${VERSION}.tar.gz ${RPM_TOPDIR}/SOURCES - cd $(ROOTDIR) && rpmbuild -ba \ - --define="_topdir ${RPM_TOPDIR}" \ +.PHONY: kvm +kvm: dist ## - Creates a local RPM kvm package, useful for development + @echo ${VERSION} + cd ${ROOTDIR} && mkdir -p ${RPM_TOPDIR}/{RPMS,SRPMS,BUILD,SOURCES} + cd ${ROOTDIR} && cp ./rpm/qm-kvm-${VERSION}.tar.gz ${RPM_TOPDIR}/SOURCES + rpmbuild -ba \ + --define="_topdir ${RPM_TOPDIR}" \ --define="version ${VERSION}" \ - ${SPECFILE_SUBPACKAGE_IMG_WINDOWMANAGER} + ${SPECFILE_SUBPACKAGE_IMG_KVM}