From 6dca8b6be522f9372c260f7fb520777da6e9b110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 26 May 2025 11:40:40 +0200 Subject: [PATCH 1/3] archlinux: update dnf dependency It's dnf5 now. --- archlinux/PKGBUILD.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archlinux/PKGBUILD.in b/archlinux/PKGBUILD.in index 8e89b2f6e..76840e488 100644 --- a/archlinux/PKGBUILD.in +++ b/archlinux/PKGBUILD.in @@ -212,7 +212,7 @@ package_qubes-vm-dom0-updates() { qubes-vm-core qubes-vm-networking python - dnf + dnf5 ) cd "${_pkgnvr}" From c97fc643c6ffe892fdc70f641de8750f47b8e8d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 27 May 2025 02:47:15 +0200 Subject: [PATCH 2/3] Use/prefer dnf5 if available Arch has only dnf5, without dnf -> dnf5 symlink, so try to use dnf5. But also, prefer versioned name if available, as that simplifies version-dependent parts (no need to call --version for example). --- .../qubes-download-dom0-updates.sh | 10 +++++--- qubes-rpc/qvm-template-repo-query | 24 +++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/package-managers/qubes-download-dom0-updates.sh b/package-managers/qubes-download-dom0-updates.sh index e92137421..f597cfadb 100755 --- a/package-managers/qubes-download-dom0-updates.sh +++ b/package-managers/qubes-download-dom0-updates.sh @@ -68,13 +68,17 @@ if [ -z "$UPDATE_ACTION" ]; then UPDATE_ACTION=upgrade fi -if type dnf >/dev/null 2>&1; then - UPDATE_CMD=dnf +if type dnf >/dev/null 2>&1 || type dnf5 >/dev/null 2>&1; then + if type dnf5 >/dev/null 2>&1; then + UPDATE_CMD=dnf5 + else + UPDATE_CMD=dnf + fi UPDATE_ARGUMENTS+=(--noplugins -y) CLEAN_OPTS+=(--noplugins -y) "$UPDATE_CMD" "${OPTS[@]}" "$UPDATE_ACTION" --help | grep -q best && UPDATE_ARGUMENTS+=(--best) "$UPDATE_CMD" "${OPTS[@]}" "$UPDATE_ACTION" --help | grep -q allowerasing && UPDATE_ARGUMENTS+=(--allowerasing) - if "$UPDATE_CMD" --version | grep -q dnf5 && [ "$CHECK_ONLY" = "1" ]; then + if [ "$UPDATE_CMD" = "dnf5" ] && [ "$CHECK_ONLY" = "1" ]; then UPDATE_ACTION=check-upgrade fi else diff --git a/qubes-rpc/qvm-template-repo-query b/qubes-rpc/qvm-template-repo-query index 3a7c1986e..e1447ece2 100644 --- a/qubes-rpc/qvm-template-repo-query +++ b/qubes-rpc/qvm-template-repo-query @@ -45,8 +45,13 @@ while read -r line; do fi done < "$repodir/template.repo" +if ! DNF=$(command -v dnf5 dnf dnf4 | head -1); then + echo "ERROR: dnf command is missing, please use newer template for your UpdateVM to download templates." >&2 + echo "You can choose any Fedora version, Debian 11 (or newer), or any other based on those (like Whonix 16)." >&2 + exit 1 +fi DNF5=false -if [ "$(readlink /usr/bin/dnf)" = "dnf5" ]; then +if [[ "$DNF" = *"/dnf5" ]]; then DNF5=true fi @@ -58,11 +63,6 @@ if ! $DNF5; then OPTS+=("--setopt=pluginpath=/usr/lib/qubes/dnf-plugins") fi -if ! command -v dnf >/dev/null; then - echo "ERROR: dnf command is missing, please use newer template for your UpdateVM to download templates." >&2 - echo "You can choose any Fedora version, Debian 11 (or newer), or any other based on those (like Whonix 16)." >&2 - exit 1 -fi # This creates the hashfile if it doesn't exist, and keep the ctime and mtime # unchanged otherwise. @@ -76,9 +76,9 @@ RET=0 if [ "$1" = "query" ]; then if $DNF5; then - dnf repoquery "${OPTS[@]}" --qf='%{name}|%{epoch}|%{version}|%{release}|%{repoid}|%{downloadsize}|%{buildtime}|%{license}|%{url}|%{summary}|%{description}|\n' "$SPEC" + $DNF repoquery "${OPTS[@]}" --qf='%{name}|%{epoch}|%{version}|%{release}|%{repoid}|%{downloadsize}|%{buildtime}|%{license}|%{url}|%{summary}|%{description}|\n' "$SPEC" else - dnf repoquery "${OPTS[@]}" --qf='%{name}|%{epoch}|%{version}|%{release}|%{repoid}|%{downloadsize}|%{buildtime}|%{license}|%{url}|%{summary}|%{description}|' "$SPEC" + $DNF repoquery "${OPTS[@]}" --qf='%{name}|%{epoch}|%{version}|%{release}|%{repoid}|%{downloadsize}|%{buildtime}|%{license}|%{url}|%{summary}|%{description}|' "$SPEC" fi RET="$?" elif [ "$1" = "download" ]; then @@ -88,15 +88,15 @@ elif [ "$1" = "download" ]; then # downloaded, go to the next one. The intention is to retry on interrupted # connection, but skip mirrors that are not synchronized yet. declare -a urls=() - if $DNF5 && dnf download --help | grep -q allmirrors; then + if $DNF5 && $DNF download --help | grep -q allmirrors; then # The smartest case. DNF5 on Fedora 41 with --allmirrors patch - space_separated_urls="$(dnf download "${OPTS[@]}" --url --allmirrors "$SPEC")" + space_separated_urls="$($DNF download "${OPTS[@]}" --url --allmirrors "$SPEC")" readarray -d ' ' -t urls <<<"$space_separated_urls" urls=( $(shuf -e "${urls[@]}") ) elif $DNF5; then # The middle case. DNF5 on Fedora 41 before --allmirror patch # TODO: Phase out after DNF5 --allmirrors patch is released - url="$(dnf download "${OPTS[@]}" --url "$SPEC")" + url="$($DNF download "${OPTS[@]}" --url "$SPEC")" urls=("$url") else # The old DNF4 on Fedora 40 and other old templates @@ -104,7 +104,7 @@ elif [ "$1" = "download" ]; then # to print all mirrors. # TODO: Phase out after DNF4 is EOL OPTS+=("--setopt=pluginpath=/usr/lib/qubes/dnf-plugins") - urls="$(dnf downloadurl "${OPTS[@]}" --url --all-mirrors "$SPEC" | shuf)" + urls="$($DNF downloadurl "${OPTS[@]}" --url --all-mirrors "$SPEC" | shuf)" readarray -t urls <<<"$urls" fi downloaded=0 From 2453e153f98d74cd0b978842fbc8103266f30e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 27 May 2025 16:41:04 +0200 Subject: [PATCH 3/3] archlinux: fix post-upgrade notify hook Match package not file, to catch also meta-package upgrades. --- archlinux/PKGBUILD.qubes-post-upgrade.hook | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archlinux/PKGBUILD.qubes-post-upgrade.hook b/archlinux/PKGBUILD.qubes-post-upgrade.hook index 1ab33cb5e..a1bca1b06 100644 --- a/archlinux/PKGBUILD.qubes-post-upgrade.hook +++ b/archlinux/PKGBUILD.qubes-post-upgrade.hook @@ -1,6 +1,6 @@ [Trigger] Operation = Upgrade -Type = Path +Type = Package Target = * [Action]