Skip to content

Commit c0353cd

Browse files
authored
fix rpm-package-build task (#1151)
* use Fedora 45 for building RPMs (to get the appropriate C driver version) * tweak __install script to leverage 'dnf build-dep' command
1 parent 12626ed commit c0353cd

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

Earthfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ BUILD_EXAMPLE_STATE_MACHINE:
208208
RUN cd /s && /s/example-state-machine
209209

210210
rpm-build:
211-
FROM +init --base fedora:38
211+
FROM +init --base fedora:45
212212
GIT CLONE https://src.fedoraproject.org/rpms/libmongocrypt.git /R
213213
# Install the packages listed by "BuildRequires" and rpm-build:
214-
RUN __install $(awk '/^BuildRequires:/ { print $2 }' /R/libmongocrypt.spec) \
215-
rpm-build
214+
RUN __install /R/libmongocrypt.spec
215+
RUN __install rpm-build
216216
DO +COPY_SOURCE
217217
RUN cp -r /s/libmongocrypt/. /R
218218
RUN awk -f /R/etc/rpm/tweak.awk < /R/libmongocrypt.spec > /R/libmongocrypt.2.spec
@@ -224,7 +224,7 @@ rpm-build:
224224

225225
rpm-install-runtime:
226226
# Install the runtime RPM
227-
FROM +init --base fedora:38
227+
FROM +init --base fedora:45
228228
COPY +rpm-build/RPMS /tmp/libmongocrypt-rpm/
229229
RUN dnf makecache
230230
RUN __install $(find /tmp/libmongocrypt-rpm/ -name 'libmongocrypt-1.*.rpm')

etc/install-package.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ if test -f /etc/debian_version ; then
2121
apt-get -y install -- "$@"
2222
elif test -f /etc/redhat-release || grep 'ID="amzn"' /etc/os-release >/dev/null 1>&2; then
2323
if test -f /usr/bin/dnf; then
24-
# 'dnf' will "do the right thing"
25-
# --allow-erasing: see https://github.com/jeroen/curl/issues/350.
26-
dnf install -y --allowerasing -- "$@"
24+
if echo "$@" | grep -q '[.]spec'; then
25+
# We use the build-dep command to let dnf do the heavy lifting from the spec file
26+
dnf build-dep -y --allowerasing "$@"
27+
else
28+
# 'dnf' will "do the right thing"
29+
# --allow-erasing: see https://github.com/jeroen/curl/issues/350.
30+
dnf install -y --allowerasing "$@"
31+
fi
2732
elif test -f /usr/bin/yum; then
2833
yum install -y -- "$@"
2934
# 'yum' happily ignores missing packages. Use 'rpm -q' to check that

0 commit comments

Comments
 (0)