Skip to content

Commit

Permalink
Updating submodule packages to drop-ins quadlet files (#700)
Browse files Browse the repository at this point in the history
* Updating submodule packages to drop-ins quadlet files

resolves #674
During latest changes all subpackages use drop-in qudlet files
Under QM etc/containers/systemd/qm.container.d/ dir
Qm nested container quadlets moved to subsystems/ dir
Update to quadlet files

Signed-off-by: Yariv Rachmani <[email protected]>

* 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 <[email protected]>

* make TARGETS=windowmanager subpackages

make TARGETS=windowmanager subpackages
Adding missing qm qualets

Signed-off-by: Yariv Rachmani <[email protected]>

* make TARGETS=sound subpackages

Signed-off-by: Yariv Rachmani <[email protected]>

* make TARGETS=video subpackages

Signed-off-by: Yariv Rachmani <[email protected]>

* Adding more targets

make TARGETS=dvb subpackages
make TARGETS=img_tmpdir subpackages
make TARGETS=input subpackages
make TARGETS=radio subpackages
make TARGETS=tesxt2speech subpackages
make TARGETS=tty7 subpackages
make TARGETS=ttyUSB0 subpackages

Signed-off-by: Yariv Rachmani <[email protected]>

* Add target ros2

make TARGETS=ros2 subpackages
Adding github workflow for subpackages
renaming rpm/ros2/rolling/ros2_rolling.spec ->
rpm/ros2/ros2_rolling.spec

Adding fixes based on tests added

Signed-off-by: Yariv Rachmani <[email protected]>

---------

Signed-off-by: Yariv Rachmani <[email protected]>
  • Loading branch information
Yarboa authored Feb 15, 2025
1 parent a7966f2 commit 1729549
Show file tree
Hide file tree
Showing 36 changed files with 367 additions and 233 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/check-subpackages
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build Subpackages

on:
pull_request

jobs:
build-subpackages:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y make

- name: Run make for each subsystem
run: |
for dir in subsystems/*; do
if [ -d "$dir" ]; then
subsystem=$(basename "$dir")
echo "Running make for $subsystem..."
make TARGETS=$subsystem subpackages
if [ $? -ne 0 ]; then
echo "❌ Make failed for $subsystem" >&2
exit 1
fi
fi
done

13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +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
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 @@ -75,6 +74,12 @@ 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 -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 @@ -146,7 +146,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 @@ -178,7 +178,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 @@ -216,7 +217,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 @@ -330,7 +331,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 @@ -350,7 +351,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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,5 @@
# input device is connected to (useful for distinguishing between
# identical devices connected to different ports).
#
[containers]
devices = [
"/dev/input:/dev/input"
]
[Container]
AddDevice=-/dev/input
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,5 @@
# +-------------------------------------------------------------+
#
# qm_dropin_mount_bind_snd.conf
[containers]

# Devices to map for the container (sound device)
devices = [
"/dev/snd:/dev/snd"
]
[Container]
AddDevice=-/dev/snd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
# handling the graphical display, input, and windowing environment.
# When you start a graphical session (such as GNOME, KDE, etc.),
# it usually runs on this virtual console.
[containers]
devices = [
"/dev/tty7:/dev/tty7"
]
[Container]
AddDevice=-/dev/tty7
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,5 @@
# +------------------------------------------------------------+
#
#
[containers]
devices = [
"/dev/ttyUSB0:/dev/ttyUSB0"
]
[Container]
AddDevice=-/dev/ttyUSB0
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,5 @@
# └─────────────────────────────┘
#
#
[containers]
devices = [
"/dev/video0:/dev/video0"
]
[Container]
AddDevice=-/dev/video0
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Drop-in configuration for Podman to mount bind tty from host to container
#
[Container]
Mount=type=bind,source=/dev/tty0,target=/dev/tty0
Mount=type=bind,source=/dev/tty1,target=/dev/tty1
Mount=type=bind,source=/dev/tty2,target=/dev/tty2
Mount=type=bind,source=/dev/tty3,target=/dev/tty3
Mount=type=bind,source=/dev/tty4,target=/dev/tty4
Mount=type=bind,source=/dev/tty5,target=/dev/tty5
Mount=type=bind,source=/dev/tty6,target=/dev/tty6
Mount=type=bind,source=/dev/tty7,target=/dev/tty7
Mount=type=bind,source=/dev/tty0,target=/dev/tty0
23 changes: 17 additions & 6 deletions rpm/dvb/dvb.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
%global debug_package %{nil}

# Define the rootfs macros
%global rootfs_qm %{_prefix}/lib/qm/rootfs/

Name: qm-mount-bind-dvb
Version: 0
Release: 1%{?dist}
Summary: Drop-in configuration for QM containers to mount bind /dev/dvb
License: GPL-2.0-only
URL: https://github.com/containers/qm
Source0: %{url}/archive/v%{version}.tar.gz
Source0: %{url}/archive/qm-dvb-%{version}.tar.gz

BuildArch: noarch
Requires: qm = %{version}-%{release}
Expand All @@ -13,15 +18,21 @@ Requires: qm = %{version}-%{release}
This subpackage installs a drop-in configuration for QM containers to mount bind `/dev/dvb`.

%prep
%autosetup -Sgit -n qm-%{version}
%autosetup -Sgit -n qm-dvb-%{version}

%install
install -d %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d
install -m 644 etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_dvb.conf \
%{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/
# Create the directory for drop-in configurations
install -d %{buildroot}%{_sysconfdir}/containers/systemd/qm.container.d

# Install the dvb drop-in configuration file
install -m 644 %{_builddir}/qm-video-%{version}/etc/containers/systemd/qm.container.d/qm_dropin_mount_bind_dvb.conf \
%{buildroot}%{_sysconfdir}/containers/systemd/qm.container.d/qm_dropin_mount_bind_dvb.conf


%files
%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_dvb.conf
%license LICENSE
%doc README.md SECURITY.md
%{_sysconfdir}/containers/systemd/qm.container.d/qm_dropin_mount_bind_dvb.conf

%changelog
* Fri Jul 21 2023 RH Container Bot <[email protected]>
Expand Down
6 changes: 3 additions & 3 deletions rpm/img_tempdir/img_tempdir.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Release: 1%{?dist}
Summary: Drop-in configuration for QM nested containers using img tempdir
License: GPL-2.0-only
URL: https://github.com/containers/qm
Source0: %{url}/archive/v%{version}.tar.gz
Source0: %{url}/archive/qm-img_tempdir-%{version}.tar.gz
BuildArch: noarch

Requires: qm = %{version}-%{release}
Expand All @@ -13,11 +13,11 @@ Requires: qm = %{version}-%{release}
This sub-package installs drop-in configurations for QM nested containers that use img tempdir.

%prep
%autosetup -Sgit -n qm-%{version}
%autosetup -Sgit -n qm-img_tempdir-%{version}

%install
install -d %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d
install -m 644 etc/qm/containers/containers.conf.d/qm_dropin_img_tempdir.conf \
install -m 644 %{_builddir}/qm-img_tempdir-%{version}/etc/qm/containers/containers.conf.d/qm_dropin_img_tempdir.conf \
%{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/

%files
Expand Down
17 changes: 11 additions & 6 deletions rpm/input/input.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
%global debug_package %{nil}

Name: qm_mount_bind_input
Version: 0
Release: 1%{?dist}
Summary: Drop-in configuration for QM containers to mount bind input devices
License: GPL-2.0-only
URL: https://github.com/containers/qm
Source0: %{url}/archive/v%{version}.tar.gz
Source0: %{url}/archive/qm-input-%{version}.tar.gz
BuildArch: noarch

Requires: qm = %{version}-%{release}
Expand All @@ -13,17 +15,20 @@ Requires: qm = %{version}-%{release}
This sub-package installs drop-in configurations for QM containers to mount bind input devices.

%prep
%autosetup -Sgit -n qm-%{version}
%autosetup -Sgit -n qm-input-%{version}

%install
install -d %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d
install -m 644 etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_input.conf \
%{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/
# Create the directory for drop-in configurations
install -d %{buildroot}%{_sysconfdir}/containers/systemd/qm.container.d

# Install the input drop-in configuration file
install -m 644 %{_builddir}/qm-input-%{version}/etc/containers/systemd/qm.container.d/qm_dropin_mount_bind_input.conf \
%{buildroot}%{_sysconfdir}/containers/systemd/qm.container.d/qm_dropin_mount_bind_input.conf

%files
%license LICENSE
%doc README.md
%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_input.conf
%{_sysconfdir}/containers/systemd/qm.container.d/qm_dropin_mount_bind_input.conf

%changelog
* Fri Jul 21 2023 RH Container Bot <[email protected]>
Expand Down
9 changes: 3 additions & 6 deletions rpm/kvm/qm-kvm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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
18 changes: 12 additions & 6 deletions rpm/radio/radio.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
%global debug_package %{nil}

Name: qm-mount-bind-radio
Version: 0
Release: 1%{?dist}
Summary: Drop-in configuration for QM containers to mount bind /dev/radio
License: GPL-2.0-only
URL: https://github.com/containers/qm
Source0: %{url}/archive/v%{version}.tar.gz
Source0: %{url}/archive/qm-radio-%{version}.tar.gz

BuildArch: noarch
Requires: qm = %{version}-%{release}
Expand All @@ -13,15 +15,19 @@ Requires: qm = %{version}-%{release}
This subpackage installs a drop-in configuration for QM containers to mount bind `/dev/radio`.

%prep
%autosetup -Sgit -n qm-%{version}
%autosetup -Sgit -n qm-radio-%{version}

%install
install -d %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d
install -m 644 etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_radio.conf \
%{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/
# 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-radio-%{version}/etc/containers/systemd/qm.container.d/qm_dropin_mount_bind_radio.conf \
%{buildroot}%{_sysconfdir}/containers/systemd/qm.container.d/qm_dropin_mount_bind_radio.conf

%files
%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_radio.conf
%license LICENSE
%doc README.md SECURITY.md
%{_sysconfdir}/containers/systemd/qm.container.d/qm_dropin_mount_bind_radio.conf

%changelog
* Fri Jul 21 2023 RH Container Bot <[email protected]>
Expand Down
23 changes: 9 additions & 14 deletions rpm/ros2/rolling/ros2_rolling.spec → rpm/ros2/ros2_rolling.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,42 @@

# rootfs macros for QM ROS2 Rolling
%global rootfs_qm %{_prefix}/lib/qm/rootfs/
%global ros2_container %{rootfs_qm}/%{_sysconfdir}/containers/systemd/

Name: qm-ros2-rolling
Version: 0.6.9
Version: 0
Release: 1%{?dist}
Summary: Subpackage container for quadlet container to ROS2 Rolling environment
License: GPL-2.0-only
URL: https://github.com/containers/qm
Source0: %{url}/archive/v%{version}.tar.gz
BuildArch: noarch
Source0: %{url}/archive/qm-ros2-%{version}.tar.gz

BuildRequires: make
BuildRequires: git-core
BuildRequires: pkgconfig(systemd)
BuildArch: noarch
Requires: qm = %{version}-%{release}
Requires: podman

%description
This subpackage provides a containerized ROS2 Rolling environment within the
Quality Management (QM) system. It enables ROS2 applications to run in isolated
containers managed by Podman and systemd within the QM environment.

%prep
%autosetup -Sgit -n qm-%{version}
%autosetup -Sgit -n qm-ros2-%{version}

%build
# No special build requirements for ROS2 Rolling container
%{__make} all

%install
# Create the necessary directory structure
mkdir -p %{buildroot}%{ros2_container}
install -d %{buildroot}%{rootfs_qm}%{_sysconfdir}/containers/systemd

# Install the ROS2 Rolling container file
install -m 644 %{_builddir}/qm-ros2-%{version}/subsystems/ros2/etc/containers/systemd/ros2-rolling.container %{buildroot}%{rootfs_qm}%{_sysconfdir}/containers/systemd/ros2-rolling.container

install -m 644 subsystems/ros2/etc/containers/systemd/ros2-rolling.container %{buildroot}%{ros2_container}

%files
%license LICENSE
%doc README.md
%{ros2_container}ros2-rolling.container
%doc README.md SECURITY.md
%{rootfs_qm}%{_sysconfdir}/containers/systemd/ros2-rolling.container


%changelog
* Fri Jul 21 2023 RH Container Bot <[email protected]> - 0.6.8-1
Expand Down
Loading

0 comments on commit 1729549

Please sign in to comment.