Skip to content

Commit

Permalink
split packaging: input now has it's own spec
Browse files Browse the repository at this point in the history
Signed-off-by: Douglas Schilling Landgraf <[email protected]>
  • Loading branch information
dougsland committed Dec 31, 2024
1 parent 8f4d5ca commit 4e3252d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 47 deletions.
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SPECFILE_SUBPACKAGE_KVM=rpm/kvm/qm-kvm.spec
SPECFILE_SUBPACKAGE_SOUND=rpm/sound/sound.spec
SPECFILE_SUBPACKAGE_VIDEO=rpm/video/video.spec
SPECFILE_SUBPACKAGE_TTY7=rpm/tty7/tty7.spec
SPECFILE_SUBPACKAGE_INPUT=rpm/input/input.spec
SPECFILE_SUBPACKAGE_ROS2_ROLLING=rpm/ros2/rolling/ros2_rolling.spec
RPM_TOPDIR ?= $(PWD)/rpmbuild
VERSION ?= $(shell cat VERSION)
Expand Down Expand Up @@ -139,13 +140,23 @@ tty7_subpackage: clean dist ## - Creates a local RPM package, useful
--define="version ${VERSION}" \
${SPECFILE_SUBPACKAGE_TTY7}

.PHONY: input_subpackage
input_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_INPUT}


# ostree target is a helper for everything required for ostree
.PHONY: ostree
ostree: qm_dropin_img_tempdir ## - A helper for creating QM packages for ostree based distros

.PHONY: qm_dropin_window_manager
qm_dropin_window_manager: qm_dropin_mount_bind_kvm qm_dropin_mount_bind_input ## - QM RPM sub-package qm_dropin_window_manager
qm_dropin_window_manager: qm_dropin_mount_bind_kvm ## - QM RPM sub-package qm_dropin_window_manager
sed -i 's/%define enable_qm_window_manager 0/%define enable_qm_window_manager 1/' ${SPECFILE}
$(MAKE) VERSION=${VERSION} rpm

Expand All @@ -159,11 +170,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_input
qm_dropin_mount_bind_input: ## - QM RPM sub-package to mount bind /dev/input in the nested containers
sed -i 's/%define enable_qm_mount_bind_input 0/%define enable_qm_mount_bind_input 1/' ${SPECFILE}
$(MAKE) VERSION=${VERSION} rpm

install-policy: all ## - Install selinux policies only
semodule -i ${TARGETS}.pp.bz2
sepolicy manpage --path . --domain ${TARGETS}_t
Expand Down
30 changes: 30 additions & 0 deletions rpm/input/input.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Name: qm_mount_bind_input
Version: 0.6.8
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
BuildArch: noarch

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

%description
This sub-package installs drop-in configurations for QM containers to mount bind input devices.

%prep
%autosetup -Sgit -n qm-%{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/

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

%changelog
* Fri Jul 21 2023 RH Container Bot <[email protected]>
- Added input mount bind drop-in configuration.
41 changes: 0 additions & 41 deletions rpm/qm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
###########################################
%define enable_qm_mount_bind_ttyUSB0 0

###########################################
# subpackage QM - input devices #
###########################################
%define enable_qm_mount_bind_input 0

# Some bits borrowed from the openstack-selinux package
%global selinuxtype targeted
%global moduletype services
Expand Down Expand Up @@ -194,22 +189,6 @@ install -d %{buildroot}%{_sysconfdir}/containers/containers.conf.d
# END - qm dropin sub-package - mount ttyUSB0 #
########################################################

########################################################
# START - qm dropin sub-package - mount input #
########################################################
%if %{enable_qm_mount_bind_input}
# first step - add drop-in file in /etc/containers/containers.d.conf/qm_dropin_mount_bind_input.conf
# to QM container mount input
install -m 644 %{_builddir}/qm-%{version}/etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_input.conf %{buildroot}%{_sysconfdir}/containers/containers.conf.d/qm_dropin_mount_bind_input.conf

# second step - add drop-in file in /etc/qm/containers/containers.d.conf/qm_dropin/mount_bind_input.conf
# to nested containers in QM env mount bind input
install -m 644 %{_builddir}/qm-%{version}/etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_input.conf %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_input.conf
%endif
########################################################
# END - qm dropin sub-package - mount input #
########################################################

# install policy modules
%_format MODULES $x.pp.bz2
%{__make} DESTDIR=%{buildroot} DATADIR=%{_datadir} install
Expand Down Expand Up @@ -284,25 +263,6 @@ additional drop-in configurations.
%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_img_tempdir.conf
%endif

#######################################
# sub-package QM Mount Input #
#######################################
%if %{enable_qm_mount_bind_input}
%package -n qm_mount_bind_input
Summary: Drop-in configuration for QM containers to mount bind input
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description -n qm_mount_bind_input
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_input
%{_sysconfdir}/containers/containers.conf.d/qm_dropin_mount_bind_input.conf
%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_input.conf
%endif

#######################################
# sub-package QM Mount ttyUSB0 #
#######################################
Expand All @@ -328,7 +288,6 @@ additional drop-in configurations.
%if %{enable_qm_window_manager}
%package windowmanager
Summary: Optional Window Manager deployed in QM environment (Experimental)
Requires: qm_mount_bind_input
%description windowmanager
The optional window manager deployed in QM environment as nested container.

Expand Down
2 changes: 2 additions & 0 deletions tools/version-update
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/ros2/
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"
sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/tty7/tty7.spec"
sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/input/input.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"
sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/tty7/tty7.spec"
sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/input/input.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

0 comments on commit 4e3252d

Please sign in to comment.