Thanks :)

Reason I thought this is relevant is: I'm basically looking for an API to get an installed package's version/rev. I prefer that over making syntactical assumptions on the way portage names packages.

Taking RPM for example, there's such an API: something like rpm -q --queryformat '%{VERSION}|' PKG_NAME if I remember correctly.|

Amit

Andrew Gaffney wrote:
Amit Dor-Shifer wrote:
Given the following:
# qlist -Iv sys-apps/portage
sys-apps/portage-2.1.4.5

How do I safely extract the "2.1.4.5"?

That's probably offtopic for this list, since it really has nothing to do with portage itself. However, you probably want something like:

qlist -Iv sys-apps/portage | sed -e 's:^.*-\([0-9][^-_]*\).*$:\1:'


Reply via email to