You are not logged in.

#1 2023-05-13 14:37:20

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,142

[Solved] How to retrieve just pkgver from an installed package

Package A is installed

Package B depends on A and needs to be set to the same version package A has.

pacman -Q somename | sed 's/somename //'

Does remove the name but leaves the pkgrel value .
It's also not suitable to put directly in a string .

How to use the version of A in the pkgver() function of B ?

Last edited by Lone_Wolf (2023-05-14 09:06:07)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#2 2023-05-13 15:20:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,471
Website

Re: [Solved] How to retrieve just pkgver from an installed package

This sounds like a bad idea from the start.  Why would the pgkver of B depend on A?  It's then *not* the pkgver of B but something else entirely.  A package's pkgver depends on it's own source.  You can have versioned dependencies if you need the same versions installed, but having B misrepresent what version it is would not support this goal at all.

But if you really just want a sed command to extract the version number:

... | sed 's/[^ ]* \([^-]*\)-.*/\1/'

Last edited by Trilby (2023-05-13 15:25:17)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2023-05-13 16:07:36

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,142

Re: [Solved] How to retrieve just pkgver from an installed package

The AUR llvm-minimal-git package has been getting more complex and an increased number of splits for various reasons .

I am considering to switch it to separate packages (similar to llvm/clang in repos ) that will build from a specific snapshot of the sourcecode .

Puttting the snapshot in its own package seems like a simple way to ensure all use that exact version .
I could have all of them run the same pkgver() used in the snapshot package, but  copying the value from the snapshot pacakge feels cleaner .

Your sed command does deliver the value.

Edit : getting the command output into a var was easy using a bashism.

Last edited by Lone_Wolf (2023-05-14 09:05:48)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB