Skip to content

Commit

Permalink
Remove dependency on subscription-manager-rhsm-certificates
Browse files Browse the repository at this point in the history
Signed-off-by: Avi Miller <[email protected]>
  • Loading branch information
Djelibeybi committed Jan 24, 2024
1 parent 2902122 commit 152f033
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 154 deletions.
11 changes: 11 additions & 0 deletions .github/linters/.hadolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
##########################
## Hadolint config file ##
##########################

failure-threshold: warning

ignored:
- DL3016
- DL3033
- DL3041
4 changes: 2 additions & 2 deletions oraclelinux7/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) 2021 Avi Miller
# Copyright (c) 2021, 2024 Avi Miller
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

FROM oraclelinux:7-slim

RUN yum -y install oracle-epel-release-el7 oracle-nodejs-release-el7 \
&& yum -y --enablerepo=ol7_optional_latest install @buildsys-build tito rpm-build rpm-sign nodejs which expect \
&& yum -y --enablerepo=ol7_optional_latest install @buildsys-build tito rpm-build rpm-sign nodejs npm which expect\
&& rm -rf /var/cache/yum \
&& npm install -g yarn \
&& rpmdev-setuptree
Expand Down
9 changes: 6 additions & 3 deletions oraclelinux7/scripts/build-rhsm.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2021 Avi Miller
# Copyright (c) 2021, 2024 Avi Miller
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# Import GPG key and trust it
Expand All @@ -11,15 +11,18 @@ gpg --import --passphrase-file /gpg/passphrase < /gpg/key.asc
cd /root || exit
git clone https://github.com/candlepin/subscription-manager.git

# Checkout the release tag
cd /root/subscription-manager || exit
git checkout "subscription-manager-$RHSM_VERSION-$RHSM_RELEASE"

# Build the SRPM using tito then install it
cd subscription-manager || exit
tito build --tag="subscription-manager-$RHSM_VERSION-$RHSM_RELEASE" --srpm --dist=".$RHSM_DIST" --offline
cp "/tmp/tito/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" /root/rpmbuild/SRPMS/
rpm -ivh "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"

# Patch the subscription-manager.spec file
cd /root/rpmbuild/SPECS || exit
patch -p0 < /obsolete-rhn-rpms.diff
patch -p0 < /remove-certificates.diff

# Build the binary RPMs
cd /root/rpmbuild || exit
Expand Down
140 changes: 0 additions & 140 deletions oraclelinux7/scripts/obsolete-rhn-rpms.diff

This file was deleted.

20 changes: 20 additions & 0 deletions oraclelinux7/scripts/remove-certificates.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- subscription-manager.spec 2024-01-24 13:43:33.956922724 +1100
+++ subscription-manager.spec.new 2024-01-24 13:52:46.912361524 +1100
@@ -450,7 +450,7 @@
Requires: %{py_package_prefix}-iniparse
# rpm-python is an old name for python2-rpm but RHEL6 uses the old name
Requires: %{py_package_prefix}-six
-Requires: subscription-manager-rhsm-certificates = %{version}-%{release}
+
# Required by Fedora packaging guidelines
%{?python_provide:%python_provide %{py_package_prefix}-rhsm}
%if %{with python3}
@@ -485,7 +485,7 @@
Requires: %{py2_package_prefix}-iniparse
# rpm-python is an old name for python2-rpm but RHEL6 uses the old name
Requires: %{py2_package_prefix}-six
-Requires: subscription-manager-rhsm-certificates = %{version}-%{release}
+
# Required by Fedora packaging guidelines
%{?python_provide:%python_provide %{py2_package_prefix}-rhsm}
Requires: rpm-python
4 changes: 2 additions & 2 deletions oraclelinux8/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Avi Miller
# Copyright (c) 2021, 2024 Avi Miller
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

FROM oraclelinux:8
Expand All @@ -15,7 +15,7 @@ RUN echo > /etc/dnf/vars/ociregion \
&& npm install -g yarn \
&& rpmdev-setuptree

COPY scripts/build-rhsm.sh /
COPY scripts/* /
RUN chmod +x /build-rhsm.sh

CMD ["/build-rhsm.sh"]
9 changes: 7 additions & 2 deletions oraclelinux8/scripts/build-rhsm.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2021, 2023 Avi Miller
# 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
Expand All @@ -15,6 +15,11 @@ git checkout "subscription-manager-$RHSM_VERSION-$RHSM_RELEASE"
tito build --tag="subscription-manager-$RHSM_VERSION-$RHSM_RELEASE" --srpm --dist=".$RHSM_DIST" --offline
cp "/tmp/tito/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" /root/rpmbuild/SRPMS/

# Patch the subscription-manager.spec file
rpm -ivh "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
cd /root/rpmbuild/SPECS || exit
patch -p0 < /remove-certificates.diff

# Use rpmbuild to build and sign the binary RPMs
if [ -f /gpg/key.asc ] && [ -f /gpg/passphrase ] && [ "$GPG_NAME_EMAIL" ]; then

Expand All @@ -36,7 +41,7 @@ fi

dnf builddep -y "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
# shellcheck disable=SC2086
rpmbuild --rebuild $SIGN "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
rpmbuild -ba $SIGN /root/rpmbuild/SPECS/subscription-manager.spec

# Copy the RPMs to the output location
if [ ! -d /output/oraclelinux8 ]; then
Expand Down
20 changes: 20 additions & 0 deletions oraclelinux8/scripts/remove-certificates.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- subscription-manager.spec.orig 2024-01-24 14:04:19.911554646 +1100
+++ subscription-manager.spec 2024-01-24 14:05:03.102585444 +1100
@@ -589,7 +589,7 @@
Requires: %{py_package_prefix}-iniparse
# rpm-python is an old name for python2-rpm but RHEL6 uses the old name
Requires: %{py_package_prefix}-six
-Requires: subscription-manager-rhsm-certificates
+
# Required by Fedora packaging guidelines
%{?python_provide:%python_provide %{py_package_prefix}-rhsm}
%if %{with python3}
@@ -629,7 +629,7 @@
Requires: %{py2_package_prefix}-iniparse
# rpm-python is an old name for python2-rpm but RHEL6 uses the old name
Requires: %{py2_package_prefix}-six
-Requires: subscription-manager-rhsm-certificates
+
# Required by Fedora packaging guidelines
%{?python_provide:%python_provide %{py2_package_prefix}-rhsm}
Requires: rpm-python
4 changes: 2 additions & 2 deletions oraclelinux9/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021, 2023 Avi Miller
# Copyright (c) 2021, 2024 Avi Miller
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# hadolint global ignore=DL3041
Expand All @@ -17,7 +17,7 @@ RUN echo > /etc/dnf/vars/ociregion \
&& python3 -m pip install --no-cache-dir tito==0.6.22 \
&& rpmdev-setuptree

COPY scripts/build-rhsm.sh /
COPY scripts/* /
RUN chmod +x /build-rhsm.sh

CMD ["/build-rhsm.sh"]
11 changes: 8 additions & 3 deletions oraclelinux9/scripts/build-rhsm.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2021, 2023 Avi Miller
# 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
Expand All @@ -15,6 +15,11 @@ git checkout "subscription-manager-$RHSM_VERSION-$RHSM_RELEASE"
tito build --tag="subscription-manager-$RHSM_VERSION-$RHSM_RELEASE" --srpm --dist=".$RHSM_DIST" --offline
cp "/tmp/tito/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" /root/rpmbuild/SRPMS/

# Patch the subscription-manager.spec file
rpm -ivh "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
cd /root/rpmbuild/SPECS || exit
patch -p0 < /remove-certificates.diff

# Use rpmbuild to build and sign the binary RPMs
if [ -f /gpg/key.asc ] && [ -f /gpg/passphrase ] && [ "$GPG_NAME_EMAIL" ]; then

Expand All @@ -36,10 +41,10 @@ fi

dnf builddep -y "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
# shellcheck disable=SC2086
rpmbuild --rebuild $SIGN "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
rpmbuild -ba $SIGN /root/rpmbuild/SPECS/subscription-manager.spec

# Copy the RPMs to the output location
if [ ! -d /output/oraclelinux9 ]; then
mkdir /output/oraclelinux9
fi
cp -rf /root/rpmbuild/RPMS/* /output/oraclelinux9/
cp -rf /root/rpmbuild/RPMS/* /output/oraclelinux9/
20 changes: 20 additions & 0 deletions oraclelinux9/scripts/remove-certificates.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- subscription-manager.spec.orig 2024-01-24 14:24:56.627737164 +1100
+++ subscription-manager.spec 2024-01-24 14:25:25.788017945 +1100
@@ -135,7 +135,7 @@
Requires: %{py_package_prefix}-decorator
Requires: virt-what
Requires: %{rhsm_package_name} = %{version}
-Requires: subscription-manager-rhsm-certificates
+
%ifarch %{dmidecode_arches}
Requires: dmidecode
%endif
@@ -327,7 +327,7 @@
Requires: %{py_package_prefix}-dateutil
%endif
Requires: %{py_package_prefix}-iniparse
-Requires: subscription-manager-rhsm-certificates
+
# Required by Fedora packaging guidelines
%{?python_provide:%python_provide %{py_package_prefix}-rhsm}
Requires: python3-cloud-what = %{version}-%{release}

0 comments on commit 152f033

Please sign in to comment.