From 1108192539a63713390aa1b733db087c22fecc36 Mon Sep 17 00:00:00 2001 From: Nicola Sella Date: Wed, 28 Feb 2024 13:31:30 +0100 Subject: [PATCH] Tweak Dockerfile to use dnf4/5 builders --- Dockerfile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index b5fd0ada7..e376b489f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,19 @@ # Example Usage: # $ podman build --build-arg TYPE=distro -t ci-dnf-stack -f Dockerfile # $ podman run --net none -it ci-dnf-stack behave dnf +# +# Build for DNF4 +# $ podman build --build-arg DNF=dnf -t ci-dnf-stack -f Dockerfile +# +# Build for a specific Fedora version +# $ podman build --build-arg BASE=fedora:38 -t ci-dnf-stack -f Dockerfile ARG BASE=fedora:39 FROM $BASE ENV LANG C.UTF-8 ARG TYPE=nightly +ARG DNF # disable deltas and weak deps RUN set -x && \ @@ -24,16 +31,18 @@ RUN set -x && \ # enable dnf5 RUN set -x && \ - dnf -y copr enable rpmsoftwaremanagement/dnf-nightly; \ - dnf -y install dnf5-plugins; \ - # run upgrade before distro-sync in case there is a new version in dnf-nightly that has a new dependency - dnf5 -y upgrade; \ - dnf5 -y distro-sync --repo copr:copr.fedorainfracloud.org:rpmsoftwaremanagement:dnf-nightly; + if [ $DNF == "dnf5" ]; then \ + dnf -y copr enable rpmsoftwaremanagement/dnf-nightly; \ + dnf -y install dnf5-plugins; \ + # run upgrade before distro-sync in case there is a new version in dnf-nightly that has a new dependency + dnf5 -y upgrade; \ + dnf5 -y distro-sync --repo copr:copr.fedorainfracloud.org:rpmsoftwaremanagement:dnf-nightly; \ + fi RUN set -x && \ if [ -n "$COPR" ] && [ -n "$COPR_RPMS" ]; then \ - dnf5 -y copr enable $COPR; \ - dnf5 -y install $COPR_RPMS; \ + $DNF -y copr enable $COPR; \ + $DNF -y install $COPR_RPMS; \ fi # copy test suite @@ -41,14 +50,14 @@ COPY ./dnf-behave-tests/ /opt/ci/dnf-behave-tests # install test suite dependencies RUN set -x && \ - dnf5 -y builddep /opt/ci/dnf-behave-tests/requirements.spec && \ + $DNF -y builddep /opt/ci/dnf-behave-tests/requirements.spec && \ pip3 install -r /opt/ci/dnf-behave-tests/requirements.txt # install local RPMs if available COPY ./rpms/ /opt/ci/rpms/ RUN rm /opt/ci/rpms/*-{devel,debuginfo,debugsource}*.rpm; \ if [ -n "$(find /opt/ci/rpms/ -maxdepth 1 -name '*.rpm' -print -quit)" ]; then \ - dnf5 -y install /opt/ci/rpms/*.rpm --disableplugin=local; \ + $DNF -y install /opt/ci/rpms/*.rpm --disableplugin=local; \ fi # create directory for dbus daemon socket