From 23edbe748ff04d92cf8f9ab7dea39a13f333d59d Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Tue, 16 Apr 2024 16:18:55 -0400 Subject: [PATCH] Updates Skip-PR-comments: true Run-GHA: true Required-githooks: true Signed-off-by: Brian J. Murrell --- ci/rpm/build.sh | 60 +++++++++++++++++++++++++++++++++++++++++++ ci/rpm/create_repo.sh | 5 ++-- 2 files changed, 62 insertions(+), 3 deletions(-) create mode 100755 ci/rpm/build.sh diff --git a/ci/rpm/build.sh b/ci/rpm/build.sh new file mode 100755 index 00000000..1aa300f1 --- /dev/null +++ b/ci/rpm/build.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# Script for building RPMs in a chroot +# If the STAGE_NAME environment variable is present the script will +# attempt to parse it to determine what distribution to build for. +# +# For manual testing, you can set the environment variables CHROOT_NAME +# and TARGET can be set. +# +# Default is to build for CentOS 7. +# Fault injection will be enabled by default in CI unless a pragma has +# has disabled fault injection or this is a Release build +set -uex + +id +if [ "$(id -u)" = "0" ]; then + echo "Should not be run as root" + exit 1 +fi + +mydir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +ci_envs="$mydir/../parse_ci_envs.sh" +if [ -e "${ci_envs}" ]; then + # shellcheck source=parse_ci_envs.sh + source "${ci_envs}" +fi + +: "${SCONS_FAULTS_ARGS:=BUILD_TYPE=dev}" +SCONS_ARGS="${SCONS_FAULTS_ARGS}" + +: "${CHROOT_NAME:='rocky+epel-8-x86_64'}" +: "${TARGET:='el8'}" +: "${REPO_SPEC:='el-8'}" + +: "${COVFN_DISABLED:=true}" +: "${JOB_REPOS:=}" +EXTERNAL_COMPILER_OPT="" + +if ! $COVFN_DISABLED && [[ $REPO_SPEC == el-* ]]; then + compiler_args="COMPILER=covc" + EXTERNAL_COMPILER_OPT=" --define \"compiler_args ${compiler_args}\"" +fi + +EXTERNAL_SCONS_OPT=" --define \"scons_args ${SCONS_ARGS}\"" +EXTERNAL_RPM_BUILD_OPTIONS="${EXTERNAL_SCONS_OPT}${EXTERNAL_COMPILER_OPT}" + +rm -rf "artifacts/${TARGET}/" +if ! mkdir -p "artifacts/${TARGET}/"; then + echo "Failed to create directory \"artifacts/${TARGET}/\"" + ls -ld . || true + pwd || true + exit 1 +fi + +# shellcheck disable=SC2086 +DEBEMAIL="$DAOS_EMAIL" DEBFULLNAME="$DAOS_FULLNAME" \ +TOPDIR=$PWD make CHROOT_NAME="${CHROOT_NAME}" ${JOB_REPOS} \ + EXTERNAL_RPM_BUILD_OPTIONS="${EXTERNAL_RPM_BUILD_OPTIONS}" \ + SCONS_ARGS="${SCONS_ARGS}" DISTRO_VERSION="${DISTRO_VERSION}" \ + -C utils/rpms chrootbuild diff --git a/ci/rpm/create_repo.sh b/ci/rpm/create_repo.sh index 6aaf615d..6ae1596d 100755 --- a/ci/rpm/create_repo.sh +++ b/ci/rpm/create_repo.sh @@ -5,9 +5,8 @@ set -eux # shellcheck disable=SC1091 . ci/gha_functions.sh -repo_path=$(repo_serial_increment) +repo_path=$(get_repo_path) mkdir -p "$repo_path$TARGET" -cp -a "$BUILD_CHROOT"/result/*.rpm "$repo_path$TARGET" -mock -r rocky+epel-8-x86_64 --scrub=all --uniqueext "$RUN_ID" +cp -a mock_result/*.rpm "$repo_path$TARGET" cd "$repo_path$TARGET" createrepo .