diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf84005..a8e8002 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,6 +87,10 @@ jobs: image: ubuntu:22.04 typ: debian allow-failure: false + - + image: ubuntu:24.04 + typ: debian + allow-failure: false - image: redhat/ubi8 typ: rhel diff --git a/src/Dockerfile b/src/Dockerfile index aa85ba0..ec57799 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -26,15 +26,23 @@ WORKDIR /work FROM ${TEST_BASE_IMAGE} AS test-base-debian ARG APT_MIRROR=deb.debian.org -RUN --mount=type=cache,target=/pkg-cache \ - rm -rf /var/cache/apt/archives && \ - ln -s /pkg-cache /var/cache/apt/archives && \ - rm /etc/apt/apt.conf.d/docker-clean && \ - echo 'Binary::apt::APT::Keep-Downloaded-Packages "1";' > /etc/apt/apt.conf.d/keep-downloads && \ - touch /etc/apt/sources.list && \ - sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list && \ - sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list && \ +RUN --mount=type=cache,target=/pkg-cache < /etc/apt/apt.conf.d/keep-downloads + aptsourcesfile=/etc/apt/sources.list + if [ -f /etc/apt/sources.list.d/debian.sources ]; then + aptsourcesfile=/etc/apt/sources.list.d/debian.sources + elif [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then + aptsourcesfile=/etc/apt/sources.list.d/ubuntu.sources + fi + touch $aptsourcesfile + sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" $aptsourcesfile + sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" $aptsourcesfile apt update && apt install --no-install-recommends -y bats vim +EOT WORKDIR /work FROM ${TEST_BASE_IMAGE} AS test-base-rhel diff --git a/src/xx-apt b/src/xx-apt index 20400e5..4b3e747 100755 --- a/src/xx-apt +++ b/src/xx-apt @@ -21,6 +21,16 @@ checkpkg() { apt show "$@" } +aptsourcesfile() { + if [ -f /etc/apt/sources.list.d/debian.sources ]; then + echo /etc/apt/sources.list.d/debian.sources + elif [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then + echo /etc/apt/sources.list.d/ubuntu.sources + else + echo /etc/apt/sources.list + fi +} + exitnolinux() { if [ "${TARGETOS}" != "linux" ]; then echo >&2 "skipping packages installation on ${XX_OS}" @@ -37,7 +47,7 @@ case "${TARGETARCH}" in riscv*) case "${XX_VENDOR}" in debian) - if ! grep "sid main" /etc/apt/sources.list >/dev/null; then + if ! grep "sid main" "$(aptsourcesfile)" >/dev/null; then echo >&2 "skipping packages installation on ${XX_ARCH}. riscv64 currently only supported on sid" exit 0 fi @@ -64,7 +74,7 @@ fi fixubuntusources() { # fix all current sources to native arch nativearch="$(TARGETPLATFORM="" TARGETPAIR="" TARGETARCH="" TARGETOS="" xx-info arch)" - sed -E "/arch=/! s/^(# )?(deb|deb-src) /\1\2 [arch=$nativearch] /" -i /etc/apt/sources.list + sed -E "/arch=/! s/^(# )?(deb|deb-src) /\1\2 [arch=$nativearch] /" -i "$(aptsourcesfile)" if ! xx-info is-cross; then return; fi