Skip to content

Commit

Permalink
feat: build subscription-manager-rhsm-certificates for OL9
Browse files Browse the repository at this point in the history
Signed-off-by: Avi Miller <[email protected]>
  • Loading branch information
Djelibeybi committed Jan 31, 2024
1 parent db10147 commit 1724816
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions oraclelinux9/build-rhsm-ol9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#
# find the latest upstream version of the subscription-manager RPM
RHSM_NVR=$(docker run --rm -it -v "$PWD/scripts:/scripts" registry.access.redhat.com/ubi9/ubi rpm -q --queryformat="%{VERSION}:%{RELEASE}" subscription-manager)
RHSM_CERTS_VERSION=$(docker run --rm -it -v "$PWD/scripts:/scripts" registry.access.redhat.com/ubi9/ubi rpm -q --queryformat="%{VERSION}" subscription-manager-rhsm-certificates)
RHSM_VERSION=$(echo "$RHSM_NVR" | cut -d: -f1)
RHSM_REL=$(echo "$RHSM_NVR" | cut -d: -f2)
RHSM_RELEASE=$(echo "$RHSM_REL" | cut -d. -f1)
Expand All @@ -25,6 +26,7 @@ docker run --rm -it \
-v "$PWD/output:/output" \
-e RHSM_VERSION="$RHSM_VERSION" \
-e RHSM_RELEASE="$RHSM_RELEASE" \
-e RHSM_CERTS_VERSION="$RHSM_CERTS_VERSION" \
-e RHSM_DIST="$RHSM_DIST" \
-e GPG_NAME_EMAIL \
"build-rhsm:ol9-$IMG_VER"
22 changes: 16 additions & 6 deletions oraclelinux9/scripts/build-rhsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@
# Copyright (c) 2021, 2024 Avi Miller
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# Clone the repo
# Clone the repos
cd /root || exit
git clone https://github.com/candlepin/subscription-manager.git
git clone https://github.com/candlepin/subscription-manager-rhsm-certificates

# Checkout the release tag
# Checkout the release tag and use tito to build the source RPM
cd /root/subscription-manager || exit
git checkout "subscription-manager-$RHSM_VERSION-$RHSM_RELEASE"

# Use tito to build the source RPM
tito build --tag="subscription-manager-$RHSM_VERSION-$RHSM_RELEASE" --srpm --dist=".$RHSM_DIST" --offline

# Checkout the certificates and build with tito
cd /root/subscription-manager-rhsm-certificates || exit
git checkout "subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE"
tito build --tag="subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE" --srpm --dist=".$RHSM_DIST" --offline

# Copy the source RPMs to the RPM tree
cp "/tmp/tito/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" /root/rpmbuild/SRPMS/
cp "/tmp/tito/subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" /root/rpmbuild/SRPMS/

# Build the binary RPMs
dnf builddep -y "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
rpmbuild --rebuild "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
dnf builddep -y "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" \
"/root/rpmbuild/SRPMS/subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"

rpmbuild --rebuild "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" \
"/root/rpmbuild/SRPMS/subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"

# Sign the binary RPMs if the required files and envvar are provided
if [ -f /gpg/key.asc ] && [ -f /gpg/passphrase ] && [ "$GPG_NAME_EMAIL" ]; then
Expand Down

0 comments on commit 1724816

Please sign in to comment.