From 1554a522ccd641a603d94aae28c495ce30afa428 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 8 Oct 2026 10:54:07 +0200 Subject: [PATCH] Update packages after prioritizing OPR --- migrations/1791403252.sh | 4 ++ test/shell.d/opr-priority-migration-test.sh | 76 +++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 test/shell.d/opr-priority-migration-test.sh diff --git a/migrations/1791403252.sh b/migrations/1791403252.sh index 3788eae5..c87f3a11 100644 --- a/migrations/1791403252.sh +++ b/migrations/1791403252.sh @@ -22,3 +22,7 @@ if ! cmp -s /etc/pacman.conf "$pacman_config"; then sudo cp -a /etc/pacman.conf /etc/pacman.conf.bak sudo install -m 644 -o root -g root "$pacman_config" /etc/pacman.conf fi + +# Refresh databases and upgrade against the new repository priority. Run this +# even when the config is already ordered so a failed upgrade can be retried. +omarchy-update-system-pkgs diff --git a/test/shell.d/opr-priority-migration-test.sh b/test/shell.d/opr-priority-migration-test.sh new file mode 100644 index 00000000..dd2d086e --- /dev/null +++ b/test/shell.d/opr-priority-migration-test.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +set -euo pipefail +source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" + +test_dir=$(mktemp -d) +trap 'rm -rf "$test_dir"' EXIT +mkdir -p "$test_dir/bin" +export PACMAN_CONFIG="$test_dir/pacman.conf" CALL_LOG="$test_dir/calls" +sed "s|/etc/pacman.conf|$PACMAN_CONFIG|g" "$ROOT/migrations/1791403252.sh" >"$test_dir/migration.sh" + +cat >"$test_dir/bin/sudo" <<'SH' +#!/bin/bash +[[ ${CONFIG_STATUS:-0} == 0 ]] || exit "$CONFIG_STATUS" +if [[ $1 == "install" ]]; then + install -m 644 "${@: -2}" +else + "$@" +fi +SH +cat >"$test_dir/bin/omarchy-update-system-pkgs" <<'SH' +#!/bin/bash +# Snapshot exactly the configuration visible to the package updater. +cat "$PACMAN_CONFIG" >"$CALL_LOG" +exit "${UPDATE_STATUS:-0}" +SH +chmod +x "$test_dir/bin/"* + +run() { + rm -f "$CALL_LOG" + env PATH="$test_dir/bin:$PATH" "$@" bash -euo pipefail "$test_dir/migration.sh" >"$test_dir/output" 2>&1 +} + +for channel in stable rc edge; do + cat >"$PACMAN_CONFIG" <