Skip to content

Commit

Permalink
Adjust RPM build procedure to take into account brew RPMs
Browse files Browse the repository at this point in the history
  • Loading branch information
ggiguash committed Feb 18, 2025
1 parent d5ff798 commit e6d5402
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
37 changes: 31 additions & 6 deletions test/bin/build_rpms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set -euo pipefail
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck source=test/bin/common.sh
source "${SCRIPTDIR}/common.sh"
# shellcheck source=test/bin/common_versions.sh
source "${SCRIPTDIR}/common_versions.sh"

build_rpms() {
cd "${ROOTDIR}"
Expand Down Expand Up @@ -93,7 +95,7 @@ make_repo() {
# Create the local RPM repository for whatever was built from source.
echo "Copying RPMs from ${builddir} to ${repodir}"
# shellcheck disable=SC2086 # no quotes for command arguments to allow word splitting
cp -R ${builddir}/{RPMS,SPECS,SRPMS} "${repodir}/"
find ${builddir} -name \*.rpm -exec cp -R "{}" "${repodir}/" \;

createrepo "${repodir}"

Expand All @@ -102,19 +104,42 @@ make_repo() {
find "${repodir}" -type d -exec chmod a+rx {} \;
}

# Note: Brew RPM download requires a VPN connection.
#
# The brew RPMs are part of the CI cache. If access to VPN is not available and
# the cached artifacts are not present locally, an empty brew source directory
# is created so that other procedures do not fail.
download_brew_rpms() {
mkdir -p "${BREW_RPM_SOURCE}"
if "${SCRIPTDIR}/manage_brew_rpms.sh" access ; then
# Delete the old RPMs before the download
echo "Cleaning up old brew downloads"
rm -rf "${BREW_RPM_SOURCE}"
# Run the download procedure
bash -x "${SCRIPTDIR}/../../scripts/fetch_tools.sh" brew
bash -x "${SCRIPTDIR}/manage_brew_rpms.sh" download "4.${MINOR_VERSION}" "${BREW_RPM_SOURCE}"
else
echo "WARNING: The Brew Hub site is not accessible, skipping the download"
fi
}

create_local_repo() {
mkdir -p "${IMAGEDIR}"
cd "${IMAGEDIR}"

make_repo "${LOCAL_REPO}" "${RPM_SOURCE}"
make_repo "${NEXT_REPO}" "${NEXT_RPM_SOURCE}"
make_repo "${BASE_REPO}" "${BASE_RPM_SOURCE}"

# Force recreation of dnf cache after rebuilding the repositories
make_repo "${BREW_REPO}" "${BREW_RPM_SOURCE}"

# Force recreation of dnf caches after rebuilding the repositories
sudo dnf clean all
dnf clean all
}


#
# Main
#
build_rpms

create_local_repo
download_brew_rpms
create_local_repo
7 changes: 7 additions & 0 deletions test/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ NEXT_RPM_SOURCE="${OUTPUTDIR}/rpmbuild-fake-next-minor"
# shellcheck disable=SC2034 # used elsewhere
BASE_RPM_SOURCE="${OUTPUTDIR}/rpmbuild-base"

# Location of RPM packages downloaded from brew
# shellcheck disable=SC2034 # used elsewhere
BREW_RPM_SOURCE="${OUTPUTDIR}/brew-rpms"

# Location of local repository used by composer
export LOCAL_REPO="${IMAGEDIR}/rpm-repos/microshift-local"

Expand All @@ -65,6 +69,9 @@ export NEXT_REPO="${IMAGEDIR}/rpm-repos/microshift-fake-next-minor"
# Location of local repository used by composer
export BASE_REPO="${IMAGEDIR}/rpm-repos/microshift-base"

# Location of local repository used by composer
export BREW_REPO="${IMAGEDIR}/rpm-repos/microshift-brew"

# Location of container images list for all the built images
export CONTAINER_LIST="${IMAGEDIR}/container-images-list"

Expand Down

0 comments on commit e6d5402

Please sign in to comment.