fix(show): star marker, aligned gutter and smarter AUR merge

N?? / show marks the upstream candidate with "*" instead of ">" (the
prompt, which read as a command in logs), and every line but the note
gets a two-character gutter: "  " for the installed record, "* " for the
candidate, so keys and colons line up. The plain native fallback (zypper,
unmergeable records) and the not-installed candidate use the same gutter.

pacman records (-Qi with -Si or the AUR helper's -Sia) are now compared
the way they are meant:
- values unwrapped (continuation lines joined, runs of blanks as one):
  yay wraps Depends On / Optional Deps at 80 columns even without a
  terminal unless COLUMNS=0, which the helper now gets for -Qua and -Sia
- Depends On, Provides, Conflicts With, Make/Check Deps and the other
  lists as sets of exact tokens in any order (a constraint is a change)
- Optional Deps by package names ("name: description [installed]" in
  -Qi, bare names from the AUR)
- a differing value is one line like -Qi, Optional Deps one entry per
  line; candidate-only fields sit next to their counterpart (Repository
  after Version, AUR URL after URL, Maintainer after Packager, ...)

Verified on recorded claude-desktop records (paru 2.1.0, yay 13.0.1, the
installed 2.9939.4-1 from the AUR's own .SRCINFO); discovery/pacman.md
section 15.2.
This commit is contained in:
bryanpedini committed 2026-10-10 16:01:51 +02:00
1 parent def537af58
commit 3af159e09a
16 files changed
+680 -288

No files matched your search

+6 -6
View File
@@ -67,12 +67,12 @@ pacman_only() { [[ $BE == pacman ]] || skip "pacman backend only"; }
'su-dummy-aur: Skeptical-updater dummy package AUR (foreign: in no repository)' \
'reason: explicitly installed' \
'required by: nothing')"
assert_line '# lines starting with > come from the upstream candidate: a differing value, or a field the installed record lacks'
assert_output --partial "$(printf '%s\n' 'Version : 1.0-1' '> Version : 2.0-1')"
assert_line 'Install Reason : Explicitly installed'
assert_line '> Repository : aur'
assert_line '> Maintainer : su-fixture'
assert_line '> AUR URL : https://aur.archlinux.org/packages/su-dummy-aur'
assert_line '# lines starting with * come from the upstream candidate: a differing value, or a field the installed record lacks'
assert_output --partial "$(printf '%s\n' ' Version : 1.0-1' '* Version : 2.0-1' '* Repository : aur')"
assert_line ' Install Reason : Explicitly installed'
assert_output --partial "$(printf '%s\n' ' URL : https://example.invalid/su-dummy' '* AUR URL : https://aur.archlinux.org/packages/su-dummy-aur')"
assert_output --partial "$(printf '%s\n' ' Packager : su-fixture <su-fixture@example.invalid>' '* Maintainer : su-fixture')"
assert_output --partial "$(printf '%s\n' ' Validated By : None' '* Votes : 7' '* Popularity : 0.01' '* Out Of Date : No')"
run grep -c 'su-tester HOME=/home/su-tester PWD=/home/su-tester -Sia su-dummy-aur' "$PARU_LOG"
assert_output 1
}
+14 -13
View File
@@ -60,29 +60,30 @@ zypper_verb() { case $(. /etc/os-release && printf '%s' "$ID") in opensuse-tumbl
run skeptical-updater --no-refresh <<<$'2??\nq'
assert_success
if [[ $BE == zypper ]]; then # no comparable records: the plain zypper info --requires
assert_line 'Information for package su-dummy-b:'
refute_line --partial '# lines starting with >'
assert_line ' Information for package su-dummy-b:'
refute_line --partial '# lines starting with *'
return 0
fi
assert_line '# lines starting with > come from the upstream candidate: a differing value, or a field the installed record lacks'
assert_line '# lines starting with * come from the upstream candidate: a differing value, or a field the installed record lacks'
case $BE in
apt)
assert_line 'Package: su-dummy-b'
assert_line 'Status: install ok installed'
assert_output --partial "$(printf '%s\n' 'Version: 1.0' '> Version: 2.0')"
assert_line --regexp '^> Filename: .*su-dummy-b_2\.0_all\.deb$'
assert_line ' Package: su-dummy-b'
assert_line ' Status: install ok installed'
assert_output --partial "$(printf '%s\n' ' Version: 1.0' '* Version: 2.0')"
assert_line --regexp '^\* Filename: .*su-dummy-b_2\.0_all\.deb$'
;;
pacman)
assert_output --partial "$(printf '%s\n' 'Version : 1.0-1' '> Version : 2.0-1')"
assert_line 'Install Reason : Installed as a dependency for another package'
assert_line '> Repository : su-dummy'
assert_output --partial "$(printf '%s\n' ' Version : 1.0-1' '* Version : 2.0-1' '* Repository : su-dummy')"
assert_line ' Install Reason : Installed as a dependency for another package'
;;
dnf)
assert_output --partial "$(printf '%s\n' 'Version : 1.0' '> Version : 2.0')"
assert_output --partial "$(printf '%s\n' 'Repository : @System' '> Repository : su-dummy')"
assert_output --partial "$(printf '%s\n' ' Version : 1.0' '* Version : 2.0')"
assert_output --partial "$(printf '%s\n' ' Repository : @System' '* Repository : su-dummy')"
;;
esac
[[ $(grep -c '^> ' <<<"$output") -ge 2 ]]
[[ $(grep -c '^\* ' <<<"$output") -ge 2 ]]
# every line has the two-character gutter, except the note
[[ $(grep -cvE '^(# lines starting with| |\* |$)' <<<"$(sed -n '/^# lines starting with/,/^> q$/p' <<<"$output" | sed '$d')") -eq 0 ]]
}
@test "N+ writes the user row and the dep row; list hides both and counts them" {