FS#76682 - [pacman] pacman -qV should display version data in a single line

Attached to Project: Pacman
Opened by drws (drws) - Sunday, 27 November 2022, 15:53 GMT
Last edited by Toolybird (Toolybird) - Thursday, 01 December 2022, 02:12 GMT
Task Type Bug Report
Category Packages: Core
Status Assigned
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No

Details

Description: 'pacman -qV' currently prints same output as 'pacman -V'. The quiet option could and should apply to version query as well. An expected output of 'pacman -qV' would be:

Pacman v6.0.2 - libalpm v13.0.2
This task depends upon

Comment by Allan McRae (Allan) - Sunday, 27 November 2022, 21:18 GMT
What is the use case?
Comment by drws (drws) - Monday, 28 November 2022, 11:05 GMT
I just need to obtain a single-line human-readable version string of both Pacman and ALPM, KISS-style.

What Pacman outputs is great, except for not taking its own quiet option into account when it evidently could (and should for KISS purposes).
Comment by Allan McRae (Allan) - Monday, 28 November 2022, 11:37 GMT
The reason I asked for a use case is there is a supported way to get libalpm information via pkg-config.

--quiet is documented to only effect some operations. I am after a reason why it is needed here and pkg-config is not enough.
Comment by Toolybird (Toolybird) - Thursday, 01 December 2022, 02:11 GMT
The version info can be had fairly easily. As @Allan mentioned for alpm:

$ pkg-config --modversion libalpm
13.0.2

Probably numerous ways to extract the pacman version but here's 1 quick example:

$ pacman -V | awk '/alpm/ {print $3}' | sed 's/^v//'
6.0.2

Probably not worth implementing in pacman itself but I'll let @Allan decide :)
Comment by drws (drws) - Friday, 02 December 2022, 18:13 GMT
pkg-config suffices in principle, but pacman already outputs human-readable pre-formatted pretty string containing both relevant versions ("Pacman v6.0.2 - libalpm v13.0.2"). I know that --quiet is documented to only effect some operations and that also solves the issue in principle, but I'm arguing --quiet is a very general option (in the likes of --help, the --version itself, --verbose and such) so implementation should be widest possible (throughout the operating modes).

Counting-in the KISS principle it seems natural that --quiet suppressed the additional ASCII art and information around the information that was actually requested from Pacman - a version (string).

Trying be more specific about the use case, I need it for exactly what it is, to print a quick single-lined Pacman AND ALPM version report sometimes during system administration. pkg-config doesn't give you that easily so the two solutions aren't duplicates.

Loading...