From 8e3f546bfe0553862fcfd17fa81da00f4dd984eb Mon Sep 17 00:00:00 2001 From: Yariv Rachmani Date: Tue, 12 Nov 2024 19:49:04 +0200 Subject: [PATCH] Adding extra packages to fix-spec-file + Rebase latest changes + Adding howto create PR subpackages Signed-off-by: Yariv Rachmani --- .packit.sh | 3 ++ Makefile | 75 --------------------------------------- docs/devel/README.md | 45 ++++++++++++++++++++++- rpm/qm.spec | 18 +++++----- tests/e2e/set-ffi-env-e2e | 4 +-- 5 files changed, 58 insertions(+), 87 deletions(-) diff --git a/.packit.sh b/.packit.sh index fb7e8856..4948183c 100644 --- a/.packit.sh +++ b/.packit.sh @@ -32,3 +32,6 @@ sed -i "s/^Release:.*/Release: ${PACKIT_RPMSPEC_RELEASE}%{?dist}/" ${SPEC_FILE} # Update Source tarball name in spec sed -i "s/^Source0:.*.tar.gz/Source0: %{name}-${HEAD_VERSION}.tar.gz/" ${SPEC_FILE} + +# Add update create additional subpackages in spec +# Please refer `Let automation create/publish PR sub-packages` of docs/devel/README.md diff --git a/Makefile b/Makefile index a334abfa..f509c454 100644 --- a/Makefile +++ b/Makefile @@ -10,72 +10,6 @@ SPECFILE=rpm/qm.spec RPM_TOPDIR ?= $(PWD)/rpmbuild VERSION ?= $(shell cat VERSION) -########################################### -# subpackage QM - img_tempdir # -########################################### -# use img temp dir as /var/tmp # -########################################### -# export EN_QM_DROP_IMG_TMPDIR=1 -EN_QM_DROP_IMG_TMPDIR ?= 0 - -####################################################################### -# subpackage QM - mount bind /dev/tty7 # -####################################################################### -# mount bind /dev/tty7 from host to nested containers as /dev/tty7:rw # -# Please note: /dev/tty7 is typically the virtual terminal associated # -# with the graphical user interface (GUI) on Linux systems. # -# It is where the X server or the Wayland display server usually runs,# -# 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. # -####################################################################### -# export EN_QM_MNT_BIND_TTY7=1 -EN_QM_MNT_BIND_TTY7 ?= 0 - -############################################ -# subpackage QM - mount bind audio device # -# from host to container and nested # -# container enabling sound # -############################################ -# export EN_QM_MNT_BIND_SOUND=1 -EN_QM_MNT_BIND_SOUND ?= 0 - -############################################ -# subpackage QM - ros2-rolling # -############################################ -# export EN_QM_ROS2_ROLLING=1 -EN_QM_ROS2_ROLLING ?= 0 - -########################################### -# subpackage QM - Enable Window Manager # -########################################### -# export EN_QM_WINDOW_MGR=1 -EN_QM_WINDOW_MGR ?= 0 - -########################################### -# subpackage QM - mount bind /dev/ttyUSB0 # -########################################### -# export EN_QM_MNT_BIND_TTY_USB=1 -EN_QM_MNT_BIND_TTY_USB ?= 0 - -########################################### -# subpackage QM - mount bind /dev/kvm # -########################################### -# export EN_QM_MNT_BIND_KVM=1 -EN_QM_MNT_BIND_KVM ?= 0 - -########################################### -# subpackage QM - input devices # -########################################### -# export EN_QM_MNT_BIND_INPUT=1 -EN_QM_MNT_BIND_INPUT ?= 0 - -########################################### -# subpackage QM - input video # -########################################### -# export EN_QM_MNT_BIND_VIDEO=1 -EN_QM_MNT_BIND_VIDEO ?= 0 - # Default help target .PHONY: help help: @@ -135,15 +69,6 @@ rpm: clean dist ## - Creates a local RPM package, useful for develop tools/version-update -v ${VERSION} cp ./rpm/v${VERSION}.tar.gz ${RPM_TOPDIR}/SOURCES rpmbuild -ba \ - --define="u_enable_qm_dropin_img_tempdir ${EN_QM_DROP_IMG_TMPDIR}" \ - --define="u_enable_qm_window_manager ${EN_QM_WINDOW_MGR}" \ - --define="u_enable_qm_mount_bind_tty7 ${EN_QM_MNT_BIND_TTY7}" \ - --define="u_enable_qm_mount_bind_ttyUSB0 ${EN_QM_MNT_BIND_TTY_USB}" \ - --define="u_enable_qm_mount_bind_sound ${EN_QM_MNT_BIND_SOUND}" \ - --define="u_enable_qm_mount_bind_kvm ${EN_QM_MNT_BIND_KVM}" \ - --define="u_enable_qm_mount_bind_input ${EN_QM_MNT_BIND_INPUT}" \ - --define="u_enable_qm_mount_bind_video ${EN_QM_MNT_BIND_VIDEO}" \ - --define="u_enable_qm_dropin_ros2_rolling ${EN_QM_ROS2_ROLLING}" \ --define="_topdir ${RPM_TOPDIR}" \ --define="version ${VERSION}" \ ${SPECFILE} diff --git a/docs/devel/README.md b/docs/devel/README.md index 9a1e5811..249e1e88 100644 --- a/docs/devel/README.md +++ b/docs/devel/README.md @@ -14,6 +14,9 @@ - [SSH guest CentOS Automotive Stream Distro](#ssh-guest-centos-automotive-stream-distro) - [Check if HOST and Container are using different network namespace](#check-if-host-and-container-are-using-different-network-namespace) - [Debugging with podman in QM using --root](#debugging-with-podman-in-qm) + - [Creating your own drop-in QM sub-package](#creating-your-own-dropin-qm-subpackage) + - [Let automation create/publish PR sub-packages](#let-automation-create-publish-pr-subpackages) + - [Install PR copr sub-packages on local machine](#install-pr-copr-sub-packages-on-local-machine) - [Debugging with quadlet](#debugging-with-quadlet) ## Building QM rpm manually with changes @@ -239,7 +242,7 @@ Error: creating runtime static files directory "/usr/share/containers/storage/li mkdir /usr/share/containers/storage: read-only file system ``` -### Creating your own drop-in QM sub-package +### Creating your own dropin QM subpackage We recommend using the existing drop-in files as a guide and adapting them to your specific needs. However, here are the step-by-step instructions: @@ -258,6 +261,46 @@ Example changing the spec and triggering the build via make (feel free to automa $ make clean && VERSION=YOURVERSIONHERE make rpm ``` +### Let automation create publish PR subpackages + +subpuckges could be created by Packit and uploaded +by Copr to packit/containers-qm- repo. +Default macros for each subpackage deactivated by default. + +To enable PR repo apply the follwoing + +1. Enable subpackage spec macro definition in .packit.sh +Add the following line at the end of file, + +```bash +# Update build additional rpms in spec +sed -i 's/\( \).*/\11/' ${SPEC_FILE} +``` + +Check rpms created in PT Actions under PR Checks > Packit-as-a-Service +In case new tests need the sub-package, it will be innstalled immediatly +on Packit-as-a-Service test phase. + +### Install PR copr sub-packages on local machine + +1. Enbale repo in your machine +This part is done automatically by TestingFarm guest provisioning. +In case of manual installation, + +```bash +dnf copr enable packit/containers-qm- +``` + +1. Install rpm in qm +This part is done automatically by TestingFarm guest provisioning. +In case of manual installation, + +```bash +podman cp /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:packit:containers-qm-.repo qm:/etc/yum.repos.d/ + +dnf install --releasever= --installroot /usr/lib/qm/rootfs/ +``` + ### Debugging with quadlet Imagine a situation where you have a Quadlet container inside QM that isn't starting, and you're unsure why. The best approach is to log into the QM, run the ```quadlet --dryrun``` command, and analyze what's happening. Here's how you can troubleshoot the issue step by step. diff --git a/rpm/qm.spec b/rpm/qm.spec index 38a183f0..e23c5a70 100644 --- a/rpm/qm.spec +++ b/rpm/qm.spec @@ -11,7 +11,7 @@ # subpackage QM - img_tempdir # ########################################### # use img temp dir as /var/tmp -%define enable_qm_dropin_img_tempdir 0%{?u_enable_qm_dropin_img_tempdir} +%define enable_qm_dropin_img_tempdir 0 #################################################################### # subpackage QM - mount bind /dev/tty7 # @@ -28,44 +28,44 @@ # When you start a graphical session (ex. GNOME, KDE, etc.), # # it usually runs on this virtual console. # #################################################################### -%define enable_qm_mount_bind_tty7 0%{?u_enable_qm_mount_bind_tty7} +%define enable_qm_mount_bind_tty7 0 ##################################################################### # subpackage QM - mount bind audio # # device from host to container and nested container enabling sound # ##################################################################### -%define enable_qm_mount_bind_sound 0%{?u_enable_qm_mount_bind_sound} +%define enable_qm_mount_bind_sound 0 ########################################### # subpackage QM - Enable Window Manager # ########################################### -%define enable_qm_window_manager 0%{?u_enable_qm_window_manager} +%define enable_qm_window_manager 0 ########################################### # subpackage QM - ROS2 Rolling version # ########################################### -%define enable_qm_ros2_rolling 0%{?u_enable_qm_ros2_rolling} +%define enable_qm_ros2_rolling 0 ########################################### # subpackage QM - mount bind /dev/ttyUSB0 # ########################################### -%define enable_qm_mount_bind_ttyUSB0 0%{?u_enable_qm_mount_bind_ttyUSB0} +%define enable_qm_mount_bind_ttyUSB0 0 ########################################### # subpackage QM - mount bind /dev/kvm # ########################################### -%define enable_qm_mount_bind_kvm 0%{?u_enable_qm_mount_bind_kvm} +%define enable_qm_mount_bind_kvm 0 ########################################### # subpackage QM - mount bind /dev/video # ########################################### -%define enable_qm_mount_bind_video 0%{?u_enable_qm_mount_bind_video} +%define enable_qm_mount_bind_video 0 ########################################### # subpackage QM - input devices # ########################################### -%define enable_qm_mount_bind_input 0%{?u_enable_qm_mount_bind_input} +%define enable_qm_mount_bind_input 0 # Some bits borrowed from the openstack-selinux package %global selinuxtype targeted diff --git a/tests/e2e/set-ffi-env-e2e b/tests/e2e/set-ffi-env-e2e index baa707e1..efbc2b4c 100755 --- a/tests/e2e/set-ffi-env-e2e +++ b/tests/e2e/set-ffi-env-e2e @@ -157,9 +157,9 @@ install_qm_rpms() { dnf config-manager --set-enabled crb local release_id - release_id=$(grep -oP '(?<=^ID=)\w+' /etc/os-release) + release_id=$(grep -oP '(?<=^ID=)\w+' <<< "$(tr -d '"' < /etc/os-release)") local version_id - version_id=$(grep -oP '(?<=^VERSION_ID=)\w+' /etc/os-release) + version_id=$(grep -oP '(?<=^VERSION_ID=)\w+' <<< "$(tr -d '"' < /etc/os-release)") if [[ "$release_id" == "centos" ]]; then release_id=epel fi