Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split subpackage video into single spec #683

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ QMDIR=/usr/lib/qm
SPECFILE=rpm/qm.spec
SPECFILE_SUBPACKAGE_KVM=rpm/kvm/qm-kvm.spec
SPECFILE_SUBPACKAGE_SOUND=rpm/sound/sound.spec
SPECFILE_SUBPACKAGE_VIDEO=rpm/video/video.spec
SPECFILE_SUBPACKAGE_ROS2_ROLLING=rpm/ros2/rolling/ros2_rolling.spec
RPM_TOPDIR ?= $(PWD)/rpmbuild
VERSION ?= $(shell cat VERSION)
Expand Down Expand Up @@ -117,6 +118,16 @@ sound_subpackage: clean dist ## - Creates a local RPM package, usefu
--define="version ${VERSION}" \
${SPECFILE_SUBPACKAGE_SOUND}

.PHONY: video_subpackage
video_subpackage: clean dist ## - Creates a local RPM package, useful for development
mkdir -p ${RPM_TOPDIR}/{RPMS,SRPMS,BUILD,SOURCES}
tools/version-update -v ${VERSION}
cp ./rpm/v${VERSION}.tar.gz ${RPM_TOPDIR}/SOURCES
rpmbuild -ba \
--define="_topdir ${RPM_TOPDIR}" \
--define="version ${VERSION}" \
${SPECFILE_SUBPACKAGE_VIDEO}


# ostree target is a helper for everything required for ostree
.PHONY: ostree
Expand All @@ -137,11 +148,6 @@ qm_dropin_mount_bind_ttyUSB0: ## - QM RPM sub-package to mount bind /dev/tty
sed -i 's/%define enable_qm_mount_bind_ttyUSB0 0/%define enable_qm_mount_bind_ttyUSB0 1/' ${SPECFILE}
$(MAKE) VERSION=${VERSION} rpm

.PHONY: qm_dropin_mount_bind_video0
qm_dropin_mount_bind_video0: ## - QM RPM sub-package to mount bind /dev/video0 in the nested containers
sed -i 's/%define enable_qm_mount_bind_video 0/%define enable_qm_mount_bind_video 1/' ${SPECFILE}
$(MAKE) VERSION=${VERSION} rpm

.PHONY: qm_dropin_mount_bind_tty7
qm_dropin_mount_bind_tty7: ## - QM RPM sub-package to mount bind /dev/tty7 in the nested containers
sed -i 's/%define enable_qm_mount_bind_tty7 0/%define enable_qm_mount_bind_tty7 1/' ${SPECFILE}
Expand Down
45 changes: 0 additions & 45 deletions rpm/qm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@
###########################################
%define enable_qm_mount_bind_ttyUSB0 0

###########################################
# subpackage QM - mount bind /dev/video #
###########################################
%define enable_qm_mount_bind_video 0

###########################################
# subpackage QM - input devices #
###########################################
Expand Down Expand Up @@ -216,25 +211,6 @@ install -d %{buildroot}%{_sysconfdir}/containers/containers.conf.d
# END - qm dropin sub-package - mount ttyUSB0 #
########################################################

########################################################
# START - qm dropin sub-package - mount video #
########################################################
%if %{enable_qm_mount_bind_video}
mkdir -p %{buildroot}/%{rootfs_qm}/%{_sysconfdir}/containers/systemd/
# first step - add drop-in file in /etc/containers/containers.d.conf/qm_dropin_mount_bind_video.conf
# to QM container mount video
install -m 644 %{_builddir}/qm-%{version}/etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf %{buildroot}%{_sysconfdir}/containers/containers.conf.d/qm_dropin_mount_bind_video.conf

# second step - add drop-in file in /etc/qm/containers/containers.d.conf/qm_dropin/mount_bind_video.conf
# to nested containers in QM env mount bind video
install -m 644 %{_builddir}/qm-%{version}/etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf

install -m 644 %{_builddir}/qm-%{version}/etc/containers/systemd/rear-camera.container %{buildroot}/%{rootfs_qm}/%{_sysconfdir}/containers/systemd/rear-camera.container
%endif
########################################################
# END - qm dropin sub-package - mount video #
########################################################

########################################################
# START - qm dropin sub-package - mount input #
########################################################
Expand Down Expand Up @@ -406,7 +382,6 @@ additional drop-in configurations.
%package windowmanager
Summary: Optional Window Manager deployed in QM environment (Experimental)
Requires: qm_mount_bind_input
Requires: qm_mount_bind_sound
%description windowmanager
The optional window manager deployed in QM environment as nested container.

Expand Down Expand Up @@ -453,26 +428,6 @@ done
podman exec qm systemctl daemon-reload &> /dev/null
%endif

#######################################
# sub-package QM Mount Bind /dev/video#
#######################################
%if %{enable_qm_mount_bind_video}
%package -n qm_mount_bind_video
Summary: Drop-in configuration for QM containers to mount bind /dev/video
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description -n qm_mount_bind_video
This sub-package installs a drop-in configurations for the QM.
It creates the `/etc/qm/containers/containers.conf.d/` directory for adding
additional drop-in configurations.

%files -n qm_mount_bind_video
%{_sysconfdir}/containers/containers.conf.d/qm_dropin_mount_bind_video.conf
%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf
%{rootfs_qm}/%{_sysconfdir}/containers/systemd/rear-camera.container
%endif

%changelog
%if %{defined autochangelog}
%autochangelog
Expand Down
36 changes: 36 additions & 0 deletions rpm/video/video.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Name: qm-mount-bind-video
Version: 0.6.8
Release: 1%{?dist}
Summary: Drop-in configuration for QM containers to mount bind /dev/video
License: GPL-2.0-only
URL: https://github.com/containers/qm
Source0: %{url}/archive/v%{version}.tar.gz

BuildArch: noarch
Requires: qm = %{version}-%{release}

%description
This subpackage installs a drop-in configuration for QM containers to mount bind `/dev/video`.

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

%build
# No build required for configuration files

%install
install -d %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d
install -d %{buildroot}%{_sysconfdir}/containers/systemd/
install -m 644 etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf \
%{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf
install -m 644 etc/containers/systemd/rear-camera.container \
%{buildroot}%{_sysconfdir}/containers/systemd/rear-camera.container

%files
%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf
%{_sysconfdir}/containers/systemd/rear-camera.container

%changelog
* Fri Jul 21 2023 RH Container Bot <[email protected]>
- Added video mount bind drop-in configuration.

2 changes: 2 additions & 0 deletions tools/version-update
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/qm.sp
sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/kvm/qm-kvm.spec"
sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/ros2/rolling/ros2_rolling.spec"
sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/sound/sound.spec"
sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/video/video.spec"
# Otherwise, set the new version.
sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/qm.spec"
sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/kvm/qm-kvm.spec"
sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/ros2/rolling/ros2_rolling.spec"
sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/sound/sound.spec"
sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/video/video.spec"
# Execute the changes on the rest of the files.
for file in "${FILES[@]}"; do
sed -i "s/${PREV_VERSION}/${VERSION}/g" "${BASEDIR}/${file}"
Expand Down
Loading