Don't rely on rhpkg and centpkg tools
Since [1], TMT finally applies downstream patches when extracting sources for testing. Fixing this took eternity, and in the meantime, we moved to using rhpkg / centpkg to prepare the sources for testing. This is however now causing a lot of pain in c10s / el10, because these tools are not yet build for the new distro versions. Let's move back to relying on TMT to extract sources and apply downstream, patches. [1] https://github.com/teemtee/tmt/pull/2641 Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
55460c84da
commit
3ab1933d04
@ -7,6 +7,7 @@ prepare:
|
|||||||
- osbuild
|
- osbuild
|
||||||
discover:
|
discover:
|
||||||
how: fmf
|
how: fmf
|
||||||
|
dist-git-source: true
|
||||||
filter: tag:unit-test
|
filter: tag:unit-test
|
||||||
execute:
|
execute:
|
||||||
how: tmt
|
how: tmt
|
||||||
|
@ -6,47 +6,12 @@ set -euxo pipefail
|
|||||||
|
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
|
|
||||||
case "${ID}" in
|
|
||||||
fedora)
|
|
||||||
PKG_MAINT_TOOL="fedpkg"
|
|
||||||
sudo dnf install -y "${PKG_MAINT_TOOL}"
|
|
||||||
;;
|
|
||||||
rhel)
|
|
||||||
PKG_MAINT_TOOL="rhpkg"
|
|
||||||
# rhpkg is not available in the default repos
|
|
||||||
sudo curl -L -o "/etc/yum.repos.d/rcm-tools-rhel-${VERSION_ID%.*}-baseos.repo" "http://download.devel.redhat.com/rel-eng/internal/rcm-tools-rhel-${VERSION_ID%.*}-baseos.repo"
|
|
||||||
# install the RH IT CA certificate used by the repo above
|
|
||||||
sudo curl -L -o /etc/pki/ca-trust/source/anchors/2015-IT-Root-CA.pem http://certs.corp.redhat.com/certs/2015-IT-Root-CA.pem
|
|
||||||
sudo curl -L -o /etc/pki/ca-trust/source/anchors/2022-IT-Root-CA.pem http://certs.corp.redhat.com/certs/2022-IT-Root-CA.pem
|
|
||||||
sudo update-ca-trust
|
|
||||||
;;
|
|
||||||
centos)
|
|
||||||
PKG_MAINT_TOOL="centpkg"
|
|
||||||
# centpkg is not available in the default repos
|
|
||||||
sudo dnf install -y epel-release
|
|
||||||
# CRB repos are available only for CentOS Stream 9
|
|
||||||
if [ "${VERSION_ID}" == "9" ]; then
|
|
||||||
dnf config-manager --set-enabled crb
|
|
||||||
fi
|
|
||||||
|
|
||||||
# CRB repos are available for CentOS Stream 10
|
|
||||||
if [ "${VERSION_ID}" == "10" ]; then
|
|
||||||
dnf config-manager --set-enabled crb
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Error: unsupported OS: ${ID}-${VERSION_ID}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Move to the checked out git repo with the test plans
|
# Move to the checked out git repo with the test plans
|
||||||
# this should be the root of the dist-git repo
|
# this should be the root of the dist-git repo
|
||||||
cd "${TMT_TREE}"
|
cd "${TMT_TREE}"
|
||||||
|
|
||||||
# install all test dependencies
|
# install all test dependencies
|
||||||
sudo dnf install -y \
|
sudo dnf install -y \
|
||||||
"${PKG_MAINT_TOOL}" \
|
|
||||||
rpmdevtools \
|
rpmdevtools \
|
||||||
python3-mako \
|
python3-mako \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
|
@ -5,68 +5,6 @@ set -euxo pipefail
|
|||||||
|
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
|
|
||||||
case "${ID}" in
|
|
||||||
fedora)
|
|
||||||
PKG_MAINT_TOOL="fedpkg"
|
|
||||||
;;
|
|
||||||
rhel)
|
|
||||||
PKG_MAINT_TOOL="rhpkg"
|
|
||||||
;;
|
|
||||||
centos)
|
|
||||||
PKG_MAINT_TOOL="centpkg"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Error: unsupported OS: ${ID}-${VERSION_ID}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Move to the checked out git repo with the test plans
|
|
||||||
# this should be the root of the dist-git repo
|
|
||||||
cd "${TMT_TREE}"
|
|
||||||
# the content of the directory is copy of the dist-git repo, but the .git directory is missing
|
|
||||||
# so we need to create it to make all *pkg tools happy
|
|
||||||
git init
|
|
||||||
|
|
||||||
# deduct the release to pass to rpkg to prep the sources.
|
|
||||||
# 1. use the DIST_GIT_RELEASE if set
|
|
||||||
DIST_GIT_RELEASE="${DIST_GIT_RELEASE:-}"
|
|
||||||
# 2. use the TARGET_BRANCH if set
|
|
||||||
if [[ -z "${DIST_GIT_RELEASE}" ]]; then
|
|
||||||
echo "DIST_GIT_RELEASE was not provided, trying to use TARGET_BRANCH"
|
|
||||||
DIST_GIT_RELEASE="${TARGET_BRANCH:-}"
|
|
||||||
fi
|
|
||||||
# 3. use the host OS type and version
|
|
||||||
if [[ -z "${DIST_GIT_RELEASE}" ]]; then
|
|
||||||
echo "DIST_GIT_RELEASE nor TARGET_BRANCH were not provided, trying to use the host OS type and version"
|
|
||||||
case "${ID}" in
|
|
||||||
fedora)
|
|
||||||
DIST_GIT_RELEASE="f${VERSION_ID}"
|
|
||||||
;;
|
|
||||||
rhel)
|
|
||||||
DIST_GIT_RELEASE="rhel-${VERSION_ID}.0"
|
|
||||||
;;
|
|
||||||
centos)
|
|
||||||
DIST_GIT_RELEASE="c${VERSION_ID}s"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# The namespace and name must be passed explicitly to rhpkg, because it can't determine them on its own.
|
|
||||||
# Passing these options to centpkg and fedpkg is harmless, so we can use them for all tools.
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
${PKG_MAINT_TOOL} -v --namespace rpms --name osbuild --release "${DIST_GIT_RELEASE}" prep
|
|
||||||
|
|
||||||
# Extract the Source0 basename without extension
|
|
||||||
SRC_DIR=$(spectool --source 0 osbuild.spec | sed 's/.\+\(osbuild-[0-9]\+\)\.tar\.gz/\1/')
|
|
||||||
|
|
||||||
cd "${SRC_DIR}"
|
|
||||||
|
|
||||||
# Some unit tests depend on the fact that the source code is in a git repo
|
|
||||||
git init .
|
|
||||||
git add *
|
|
||||||
git commit -m "Initial commit"
|
|
||||||
|
|
||||||
# The 'test/run/test_assemblers.py::test_tar' test case uses system tar to extract the built tar archive.
|
# The 'test/run/test_assemblers.py::test_tar' test case uses system tar to extract the built tar archive.
|
||||||
# However, files in the tar archive can have SELinux context not present in the system policy. Therefore,
|
# However, files in the tar archive can have SELinux context not present in the system policy. Therefore,
|
||||||
# in order for the system tar to be able to set it when extracting the archive, it must be labeled with
|
# in order for the system tar to be able to set it when extracting the archive, it must be labeled with
|
||||||
@ -99,6 +37,15 @@ if ([ "${ID}" == "rhel" ] || [ "${ID}" == "centos" ]) && [ "${VERSION_ID%%.*}" =
|
|||||||
TEST_SELECTION_EXPR="${TEST_SELECTION_EXPR} and not (TestStages and test_qemu)"
|
TEST_SELECTION_EXPR="${TEST_SELECTION_EXPR} and not (TestStages and test_qemu)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Move to the directory with sources
|
||||||
|
cd "${TMT_SOURCE_DIR}"
|
||||||
|
|
||||||
|
# Extract the Source0 basename without extension
|
||||||
|
SRC_DIR=$(spectool --source 0 osbuild.spec | sed 's/.\+\(osbuild-[0-9]\+\)\.tar\.gz/\1/')
|
||||||
|
|
||||||
|
# Move to the extracted sources directory (patches are applied by default)
|
||||||
|
cd "${SRC_DIR}"
|
||||||
|
|
||||||
sudo python3 -m pytest \
|
sudo python3 -m pytest \
|
||||||
--rootdir "$(pwd)" \
|
--rootdir "$(pwd)" \
|
||||||
--ignore "$(pwd)/test/src" \
|
--ignore "$(pwd)/test/src" \
|
||||||
|
Loading…
Reference in New Issue
Block a user