feat(info): show the install reason and drop the indentation

N? and `info PKG` now print three lines, none indented:

    PKG: <description>
    reason: explicitly installed | installed as a dependency | unknown | not installed
    required by: <installed dependents, comma separated> | nothing

The reason comes from a new <be>_reason backend function: apt-mark
showauto / showmanual (dpkg decides for a package in neither list), the
Install Reason of pacman -Qi, dnf repoquery --installed %{reason} (dnf4
and dnf5 words) and the Installed line of zypper info (rpm plus libzypp's
AutoInstalled when zypper is locked). A row whose old version is "-" is
not installed and the backend is not asked. The "(installed)" qualifier
moves to --help, README and DESIGN.

The rpm E2E fixture and e2e_reset now also mark su-dummy-a and su-dummy-c
as user-installed on dnf, which records plain rpm installs as "unknown",
so 1? and 2? show both reasons on all 12 distros. The verified commands
are recorded in discovery/{apt,pacman,rpm}.md.
This commit is contained in:
bryanpedini committed 2026-10-10 13:32:42 +02:00
1 parent 1354db6c39
commit 71d7f87aa3
21 files changed
+589 -48

No files matched your search

+23 -4
View File
@@ -64,11 +64,30 @@ UPGRADE='apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--forc
assert_line 'excluded from this run: su-dummy-b'
}
@test "N? prints the description and the installed packages that depend on it" {
run skup --no-refresh <<<$'2?\nq'
@test "N? prints the description, the install reason and the installed packages that depend on it" {
run skup --no-refresh <<<$'1?\n2?\nq'
assert_success
assert_line 'su-dummy-b: dummy package su-dummy-b for skeptical-updater tests'
assert_line ' required by (installed): su-dummy-a'
assert_output --partial "$(printf '%s\n' '> 1?' \
'su-dummy-a: dummy package su-dummy-a for skeptical-updater tests' \
'reason: explicitly installed' \
'required by: nothing' \
'> 2?' \
'su-dummy-b: dummy package su-dummy-b for skeptical-updater tests' \
'reason: installed as a dependency' \
'required by: su-dummy-a')"
refute_output --partial 'required by (installed)'
}
@test "N? on a new dependency (old version -) says 'not installed' without asking the package manager" {
FAKE_APT_SIM=real run skup --no-refresh <<<$'9?\nq'
assert_success
assert_line --regexp '^ \[9\] su-dummy-newdep +- +-> +1\.0 +su-fixture:su-repo$'
assert_output --partial "$(printf '%s\n' '> 9?' \
'su-dummy-newdep: (no description available: unknown package?)' \
'reason: not installed' \
'required by: nothing')"
log_lacks '^apt-mark show'
log_lacks '^dpkg-query -W -f \$\{db:Status-Abbrev\} '
}
@test "N?? prints the native full info" {