From 9e268f7fb1f3b7589f5514beebce2e19f34b63ae Mon Sep 17 00:00:00 2001 From: Jakub Panek Date: Mon, 17 Jun 2024 13:21:22 +0000 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! wip: add support for xx-dnf --- src/Dockerfile | 31 +++++++++++++++++++++++-------- src/test_helper.bash | 1 - src/xx-apk | 2 +- src/xx-apt | 2 +- src/xx-cargo | 2 +- src/xx-cc | 2 +- src/xx-dnf | 2 +- src/xx-verify | 2 +- 8 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index e49e4bf..cd106e4 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -42,16 +42,31 @@ FROM ${TEST_BASE_IMAGE} AS test-base-rhel RUN --mount=type=cache,target=/pkg-cache <> /etc/dnf/dnf.conf +if test -e /etc/os-release; then + . /etc/os-release +fi + +if test -d /var/cache/yum; then + rm -rf /var/cache/yum + ln -s /pkg-cache /var/cache/yum +fi + +if test -d /var/cache/dnf; then + rm -rf /var/cache/dnf + ln -s /pkg-cache /var/cache/dnf +fi + +case "${ID}" in + centos) + sed 's/keepcache=0/keepcache=1/g' /etc/yum.conf + ;; + *) + echo 'keepcache=True' >> /etc/dnf/dnf.conf + ;; +esac cmd_exists() { - if command -v $1 >/dev/null 2>/dev/null; then - return 0 - else - return 1 - fi + command -v $1 >/dev/null 2>/dev/null } get_dnf() { diff --git a/src/test_helper.bash b/src/test_helper.bash index dc0d2cd..465d4b0 100644 --- a/src/test_helper.bash +++ b/src/test_helper.bash @@ -37,7 +37,6 @@ pkg() { else ${xx}apk ${alpine_op} "$@" 2>/dev/null || true fi - return ;; debian*) if [ "${op}" = "install" ]; then diff --git a/src/xx-apk b/src/xx-apk index 26aa9c1..038c649 100755 --- a/src/xx-apk +++ b/src/xx-apk @@ -3,7 +3,7 @@ set -e # shellcheck source=./xx-common -. "$(dirname -- $0)/xx-common" +. "$(command -v xx-common)" flock_setup if [ -z "$XX_APK_NOLOCK" ]; then diff --git a/src/xx-apt b/src/xx-apt index febb8fd..a9b3b07 100755 --- a/src/xx-apt +++ b/src/xx-apt @@ -3,7 +3,7 @@ set -e # shellcheck source=./xx-common -. "$(dirname -- $0)/xx-common" +. "$(command -v xx-common)" flock_setup if [ -z "$XX_APT_NOLOCK" ]; then diff --git a/src/xx-cargo b/src/xx-cargo index eae5fe3..56a5281 100755 --- a/src/xx-cargo +++ b/src/xx-cargo @@ -10,7 +10,7 @@ execSilent() { } # shellcheck source=./xx-common -. "$(dirname -- $0)/xx-common" +. "$(command -v xx-common)" flock_setup if [ -z "$XX_CARGO_NOLOCK" ]; then diff --git a/src/xx-cc b/src/xx-cc index 81ea7e5..a6e51f8 100755 --- a/src/xx-cc +++ b/src/xx-cc @@ -304,7 +304,7 @@ fi setup() { # shellcheck source=./xx-common - . "$(dirname -- $0)/xx-common" + . "$(command -v xx-common)" flock_setup if [ -z "$XX_CC_NOLOCK" ]; then diff --git a/src/xx-dnf b/src/xx-dnf index 6fb4c76..d7787d5 100755 --- a/src/xx-dnf +++ b/src/xx-dnf @@ -3,7 +3,7 @@ set -e # shellcheck source=./xx-common -. "$(dirname -- $0)/xx-common" +. "$(command -v xx-common)" flock_setup if [ -z "$XX_DNF_NOLOCK" ]; then diff --git a/src/xx-verify b/src/xx-verify index 48d65ce..05c21a1 100755 --- a/src/xx-verify +++ b/src/xx-verify @@ -3,7 +3,7 @@ set -e # shellcheck source=./xx-common -. "$(dirname -- $0)/xx-common" +. "$(command -v xx-common)" flock_setup if [ -z "$XX_VERIFY_NOLOCK" ]; then