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

Adding extra packages to fix-spec-file #657

Merged
merged 1 commit into from
Nov 18, 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
3 changes: 3 additions & 0 deletions .packit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
75 changes: 0 additions & 75 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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}
Expand Down
45 changes: 44 additions & 1 deletion docs/devel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand All @@ -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
Yarboa marked this conversation as resolved.
Show resolved Hide resolved
dougsland marked this conversation as resolved.
Show resolved Hide resolved
by Copr to packit/containers-qm-<PR_ID> 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/\(<spec_file_macro_name> \).*/\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-<PR_ID> <distro><arch>
```

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-<PR_ID>.repo qm:/etc/yum.repos.d/

dnf install --releasever=<VERSION_ID> --installroot /usr/lib/qm/rootfs/ <package>
```

### 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.
Expand Down
18 changes: 9 additions & 9 deletions rpm/qm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/set-ffi-env-e2e
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading