Skip to content

Commit

Permalink
split subpackage ros2 rolling
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 30, 2024
1 parent 93e3f51 commit 8d501ef
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 41 deletions.
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SYSCONFDIR?=/etc
QMDIR=/usr/lib/qm
SPECFILE=rpm/qm.spec
SPECFILE_SUBPACKAGE_KVM=rpm/kvm/qm-kvm.spec
SPECFILE_SUBPACKAGE_ROS2_ROLLING=rpm/ros2/rolling/ros2_rolling.spec
RPM_TOPDIR ?= $(PWD)/rpmbuild
VERSION ?= $(shell cat VERSION)

Expand Down Expand Up @@ -95,6 +96,17 @@ kvm_subpackage: clean dist ## - Creates a local RPM package, useful
--define="version ${VERSION}" \
${SPECFILE_SUBPACKAGE_KVM}

.PHONY: ros2_rolling
ros2_rolling: 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_ROS2_ROLLING}


# 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
Expand All @@ -109,11 +121,6 @@ qm_dropin_img_tempdir: ## - QM RPM sub-package qm_dropin_img_tempdir
sed -i 's/%define enable_qm_dropin_img_tempdir 0/%define enable_qm_dropin_img_tempdir 1/' ${SPECFILE}
$(MAKE) VERSION=${VERSION} rpm

.PHONY: qm_dropin_ros2_rolling
qm_dropin_ros2_rolling: ## - QM RPM sub-package to creating a quadlet container with ROS2 rolling env
sed -i 's/%define enable_qm_ros2_rolling 0/%define enable_qm_ros2_rolling 1/' ${SPECFILE}
$(MAKE) VERSION=${VERSION} rpm

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

###########################################
# subpackage QM - ROS2 Rolling version #
###########################################
%define enable_qm_ros2_rolling 0

###########################################
# subpackage QM - mount bind /dev/ttyUSB0 #
###########################################
Expand Down Expand Up @@ -245,17 +240,6 @@ install -d %{buildroot}%{_sysconfdir}/containers/containers.conf.d
# END - qm dropin sub-package - mount ttyUSB0 #
########################################################

########################################################
# START - qm dropin ROS2 - Rolling #
########################################################
%if %{enable_qm_ros2_rolling}
mkdir -p %{buildroot}/%{rootfs_qm}/%{_sysconfdir}/containers/systemd/
install -m 644 %{_builddir}/qm-%{version}/subsystems/ros2/ros2-rolling.container %{buildroot}/%{rootfs_qm}/etc/containers/systemd/ros2-rolling.container
%endif
########################################################
# END - qm dropin sub-package - ROS2 - Rolling #
########################################################

########################################################
# START - qm dropin sub-package - mount video #
########################################################
Expand Down Expand Up @@ -533,26 +517,6 @@ additional drop-in configurations.
%{rootfs_qm}/%{_sysconfdir}/containers/systemd/rear-camera.container
%endif

#######################################
# sub-package QM ROS2 rolling
#######################################
%if %{enable_qm_ros2_rolling}
%package -n qm_ros2_rolling
Summary: Subpackage container for quadlet container to ROS2 Rolling environment
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description -n qm_ros2_rolling
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_ros2_rolling
%{rootfs_qm}/%{_sysconfdir}/containers/systemd/ros2-rolling.container
%endif

#######################################

%changelog
%if %{defined autochangelog}
%autochangelog
Expand Down
48 changes: 48 additions & 0 deletions rpm/ros2/rolling/ros2_rolling.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
%global debug_package %{nil}

# 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.8
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

BuildRequires: make
BuildRequires: git-core
BuildRequires: pkgconfig(systemd)
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}

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

%install
# Create the necessary directory structure
mkdir -p %{buildroot}%{ros2_container}

# Install the ROS2 Rolling container file
install -m 644 subsystems/ros2/ros2-rolling.container %{buildroot}%{ros2_container}

%files
%license LICENSE
%doc README.md
%{ros2_container}ros2-rolling.container

%changelog
* Fri Jul 21 2023 RH Container Bot <[email protected]> - 0.6.8-1
- Initial release of qm-ros2-rolling
1 change: 1 addition & 0 deletions tools/version-update
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/kvm/q
# 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"
# 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 8d501ef

Please sign in to comment.