Skip to content

Commit 606c15a

Browse files
committed
Fixed issue where rhel >8 packages would not have correct openssl dependency version
We build against systems with the latest available dependencies such as OpenSSL. We examine the highest "Version Definition" in the OpenSSL libraries which gives us the highest "API" and then use that as a requirement in our rpm package spec files. This should ensure that when packages are installed with yum/dnf any required OpenSSL package upgrades will be performed or the installation will fail. Ticket: ENT-12587 Changelog: title
1 parent 1de59c5 commit 606c15a

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

build-scripts/package

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,25 @@ case "$PACKAGING" in
142142
fi
143143
fi
144144

145-
# determine policy-version for rhel systems so we can require what we build with
145+
# determine the system-provided versions of dependencies we build against so we can Require them later in our RPM spec files.
146146
if [ "$OS" = "rhel" ]; then
147147
SELINUX_POLICY_VERSION=$(rpm -q --qf '%{VERSION}\n' selinux-policy)
148148
if [ -z "$SELINUX_POLICY_VERSION" ]; then
149149
echo "error: unable to determine selinux-policy package version"
150150
exit 1
151151
fi
152+
OPENSSL_VERSION=$(rpm -q --provides openssl-libs | grep OPENSSL_ | sed 's/^.*_\([0-9.]*\).*$/\1/' | sort -n | tail -1)
153+
if [ -z "$OPENSSL_VERSION" ]; then
154+
echo "error: unable to determine openssl package version"
155+
exit 1
156+
fi
152157
fi
153158

154159
sed \
155160
-e "s/@@VERSION@@/$RPM_VERSION/g" \
156161
-e "s/@@RELEASE@@/$safe_prefix$RPM_RELEASE/g" \
157162
-e "s/@@SELINUX_POLICY_VERSION@@/$SELINUX_POLICY_VERSION/g" \
163+
-e "s/@@OPENSSL_VERSION@@/$OPENSSL_VERSION/g" \
158164
-e "/^%pre\$/r $PREINSTALL" \
159165
-e "/^%post\$/r $POSTINSTALL" \
160166
-e "/^%preun\$/r $PREREMOVE" \

packaging/cfengine-nova-hub/cfengine-nova-hub.spec.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ Requires: libssl.so.1.1()(64bit) libssl.so.1.1(OPENSSL_1_1_0)(64bit) libssl.so.1
3333
Requires: libcrypto.so.1.1()(64bit) libcrypto.so.1.1(OPENSSL_1_1_0)(64bit)
3434
%endif
3535

36+
# We build against systems with the latest available dependencies such as OpenSSL.
37+
# We examine the highest "Version Definition" in the OpenSSL libraries which gives us the highest "API" and then use that as a requirement in our rpm package spec files.
38+
# This should ensure that when packages are installed with yum/dnf any required OpenSSL package upgrades will be performed or the installation will fail.
39+
# OPENSSL_VERSION is determined in build-scripts/package script.
3640
%if %{?rhel}%{!?rhel:0} > 8
37-
Requires: libcrypto.so.3()(64bit) libcrypto.so.3(OPENSSL_3.0.0)(64bit) libcrypto.so.3(OPENSSL_3.0.1)(64bit)
38-
Requires: libssl.so.3()(64bit) libssl.so.3(OPENSSL_3.0.0)(64bit)
41+
Requires: libcrypto.so.3()(64bit) libcrypto.so.3(OPENSSL_@@OPENSSL_VERSION@@)(64bit)
42+
Requires: libssl.so.3()(64bit) libssl.so.3(OPENSSL_@@OPENSSL_VERSION@@)(64bit)
3943
%endif
4044

4145
# cfbs/Build requires Python 3.5+ (not available on RHEL 6)

packaging/cfengine-nova/cfengine-nova.spec.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ Requires: libssl.so.1.1()(64bit) libssl.so.1.1(OPENSSL_1_1_0)(64bit) libssl.so.1
2929
Requires: libcrypto.so.1.1()(64bit) libcrypto.so.1.1(OPENSSL_1_1_0)(64bit)
3030
%endif
3131

32+
# We build against systems with the latest available dependencies such as OpenSSL.
33+
# We examine the highest "Version Definition" in the OpenSSL libraries which gives us the highest "API" and then use that as a requirement in our rpm package spec files.
34+
# This should ensure that when packages are installed with yum/dnf any required OpenSSL package upgrades will be performed or the installation will fail.
35+
# OPENSSL_VERSION is determined in build-scripts/package script.
3236
%if %{?rhel}%{!?rhel:0} > 8
33-
Requires: libcrypto.so.3()(64bit) libcrypto.so.3(OPENSSL_3.0.0)(64bit) libcrypto.so.3(OPENSSL_3.0.1)(64bit)
34-
Requires: libssl.so.3()(64bit) libssl.so.3(OPENSSL_3.0.0)(64bit)
37+
Requires: libcrypto.so.3()(64bit) libcrypto.so.3(OPENSSL_@@OPENSSL_VERSION@@)(64bit)
38+
Requires: libssl.so.3()(64bit) libssl.so.3(OPENSSL_@@OPENSSL_VERSION@@)(64bit)
3539
%endif
3640

3741
AutoReqProv: no

0 commit comments

Comments
 (0)