Skip to content

Commit

Permalink
Fix subpackages make file
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Yarboa committed Jan 21, 2025
1 parent 92dbd10 commit 1e0417e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 31 deletions.
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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
```
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
11 changes: 4 additions & 7 deletions rpm/kvm/qm-kvm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
35 changes: 21 additions & 14 deletions subsystems/kvm/Makefile
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 1e0417e

Please sign in to comment.