* [gentoo-portage-dev] How to extract the version/revision of an installed package?
@ 2008-11-25 16:05 Amit Dor-Shifer
2008-11-25 16:13 ` Andrew Gaffney
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Amit Dor-Shifer @ 2008-11-25 16:05 UTC (permalink / raw
To: gentoo-portage-dev
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"?
(I don't necessarily need to use qlist. Just want to get the version of
an installed package within a bash script)
10x
Amit
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-25 16:05 [gentoo-portage-dev] How to extract the version/revision of an installed package? Amit Dor-Shifer
@ 2008-11-25 16:13 ` Andrew Gaffney
2008-11-25 16:19 ` Andrew Gaffney
2008-11-25 16:43 ` Amit Dor-Shifer
2008-11-25 22:03 ` Brian Harring
2008-11-26 0:15 ` Ned Ludd
2 siblings, 2 replies; 16+ messages in thread
From: Andrew Gaffney @ 2008-11-25 16:13 UTC (permalink / raw
To: gentoo-portage-dev
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:'
--
Andrew Gaffney http://dev.gentoo.org/~agaffney/
Gentoo Linux Developer Catalyst/Genkernel + Release Engineering Lead
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-25 16:13 ` Andrew Gaffney
@ 2008-11-25 16:19 ` Andrew Gaffney
2008-11-25 16:43 ` Amit Dor-Shifer
1 sibling, 0 replies; 16+ messages in thread
From: Andrew Gaffney @ 2008-11-25 16:19 UTC (permalink / raw
To: gentoo-portage-dev
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:'
And if you want the full version (with RC position and revision):
qlist -Iv sys-apps/portage | sed -e 's:^.*-\([0-9].*\)$:\1:'
--
Andrew Gaffney http://dev.gentoo.org/~agaffney/
Gentoo Linux Developer Catalyst/Genkernel + Release Engineering Lead
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-25 16:13 ` Andrew Gaffney
2008-11-25 16:19 ` Andrew Gaffney
@ 2008-11-25 16:43 ` Amit Dor-Shifer
2008-11-25 17:03 ` René 'Necoro' Neumann
1 sibling, 1 reply; 16+ messages in thread
From: Amit Dor-Shifer @ 2008-11-25 16:43 UTC (permalink / raw
To: gentoo-portage-dev
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:'
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-25 16:43 ` Amit Dor-Shifer
@ 2008-11-25 17:03 ` René 'Necoro' Neumann
2008-11-26 11:13 ` Amit Dor-Shifer
0 siblings, 1 reply; 16+ messages in thread
From: René 'Necoro' Neumann @ 2008-11-25 17:03 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Amit Dor-Shifer schrieb:
> 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
You could also use eix ... though I needed quite a time to figure it out ;)
# PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages
- --format "<installedversionsshort>"
1.9.6-r2 1.10.1-r1
Note however, that if you a package has multiple installed versions,
they are seperated by space. One could use
# PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages
- --format "<installedversionsshort:\n>"
But this prints an additional empty line at the beginning.
> 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:'
>>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkksL/sACgkQ4UOg/zhYFuCgIwCdFUhQxUOMuTSqBVgSeb6SgdNd
PLYAniyZJKrxqtt1LBPFq9Nr56wvGSz8
=y6nB
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-25 16:05 [gentoo-portage-dev] How to extract the version/revision of an installed package? Amit Dor-Shifer
2008-11-25 16:13 ` Andrew Gaffney
@ 2008-11-25 22:03 ` Brian Harring
2008-11-26 0:18 ` Ned Ludd
2008-11-26 0:15 ` Ned Ludd
2 siblings, 1 reply; 16+ messages in thread
From: Brian Harring @ 2008-11-25 22:03 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 540 bytes --]
On Tue, Nov 25, 2008 at 06:05:21PM +0200, 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"?
>
> (I don't necessarily need to use qlist. Just want to get the version of an
> installed package within a bash script)
This *really* should be folded into portageq offhand- it's the initial
step towards shifting versionator logic (yet another standalone
parser/comparison implementation) into the PM.
Counter arguements?
~brian
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-25 16:05 [gentoo-portage-dev] How to extract the version/revision of an installed package? Amit Dor-Shifer
2008-11-25 16:13 ` Andrew Gaffney
2008-11-25 22:03 ` Brian Harring
@ 2008-11-26 0:15 ` Ned Ludd
2008-11-26 8:29 ` Fabian Groffen
2008-11-26 9:29 ` Amit Dor-Shifer
2 siblings, 2 replies; 16+ messages in thread
From: Ned Ludd @ 2008-11-26 0:15 UTC (permalink / raw
To: gentoo-portage-dev
On Tue, 2008-11-25 at 18:05 +0200, 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"?
>
> (I don't necessarily need to use qlist. Just want to get the version of
> an installed package within a bash script)
>
qatom $(qlist -ICv sys-apps/portage) | awk '{print $3}'
--
Ned Ludd <solar@gentoo.org>
Gentoo Linux
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-25 22:03 ` Brian Harring
@ 2008-11-26 0:18 ` Ned Ludd
2008-11-26 0:31 ` Brian Harring
2008-11-26 4:54 ` Zac Medico
0 siblings, 2 replies; 16+ messages in thread
From: Ned Ludd @ 2008-11-26 0:18 UTC (permalink / raw
To: gentoo-portage-dev
On Tue, 2008-11-25 at 14:03 -0800, Brian Harring wrote:
> On Tue, Nov 25, 2008 at 06:05:21PM +0200, 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"?
> >
> > (I don't necessarily need to use qlist. Just want to get the version of an
> > installed package within a bash script)
>
> This *really* should be folded into portageq offhand- it's the initial
> step towards shifting versionator logic (yet another standalone
> parser/comparison implementation) into the PM.
>
> Counter arguements?
> ~brian
Yes. he said a bash script. portageq still takes a few seconds to load
and invokes far far to many instructions for very simple info.
The 3 execve's I just posted are still faster than one portageq call.
So.. foo.c wins again. :p
--
Ned Ludd <solar@gentoo.org>
Gentoo Linux
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-26 0:18 ` Ned Ludd
@ 2008-11-26 0:31 ` Brian Harring
2008-11-26 1:24 ` Ned Ludd
2008-11-26 4:54 ` Zac Medico
1 sibling, 1 reply; 16+ messages in thread
From: Brian Harring @ 2008-11-26 0:31 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]
On Tue, Nov 25, 2008 at 04:18:22PM -0800, Ned Ludd wrote:
>
> On Tue, 2008-11-25 at 14:03 -0800, Brian Harring wrote:
> > On Tue, Nov 25, 2008 at 06:05:21PM +0200, 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"?
> > >
> > > (I don't necessarily need to use qlist. Just want to get the version of an
> > > installed package within a bash script)
> >
> > This *really* should be folded into portageq offhand- it's the initial
> > step towards shifting versionator logic (yet another standalone
> > parser/comparison implementation) into the PM.
> >
> > Counter arguements?
> > ~brian
>
> Yes. he said a bash script. portageq still takes a few seconds to load
> and invokes far far to many instructions for very simple info.
>
> The 3 execve's I just posted are still faster than one portageq call.
> So.. foo.c wins again. :p
Curious, does qatom handle use deps? Slot deps? Plans to add
repository deps (admittedly they've not landed)?
The point of shifting it into portageq isn't speed based; it's to
transfer responsibility for atom parsing from multiple authorities
into a single one.
Besides, just because portageq is slow for heavy data ops doesn't mean
it's going to be slow for doing simple atom splitting. Quick test
locally, cold cache pegs it at 3s- with minor use of snakeoil
demandload that's likely halvable.
~brian
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-26 0:31 ` Brian Harring
@ 2008-11-26 1:24 ` Ned Ludd
0 siblings, 0 replies; 16+ messages in thread
From: Ned Ludd @ 2008-11-26 1:24 UTC (permalink / raw
To: gentoo-portage-dev
On Tue, 2008-11-25 at 16:31 -0800, Brian Harring wrote:
> On Tue, Nov 25, 2008 at 04:18:22PM -0800, Ned Ludd wrote:
> >
> > On Tue, 2008-11-25 at 14:03 -0800, Brian Harring wrote:
> > > On Tue, Nov 25, 2008 at 06:05:21PM +0200, 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"?
> > > >
> > > > (I don't necessarily need to use qlist. Just want to get the version of an
> > > > installed package within a bash script)
> > >
> > > This *really* should be folded into portageq offhand- it's the initial
> > > step towards shifting versionator logic (yet another standalone
> > > parser/comparison implementation) into the PM.
> > >
> > > Counter arguements?
> > > ~brian
> >
> > Yes. he said a bash script. portageq still takes a few seconds to load
> > and invokes far far to many instructions for very simple info.
> >
> > The 3 execve's I just posted are still faster than one portageq call.
> > So.. foo.c wins again. :p
>
> Curious, does qatom handle use deps? Slot deps? Plans to add
> repository deps (admittedly they've not landed)?
Nope. I'm sticking with EAPI=0 behaviorism's and the development of
those utils has pretty much stopped. Well I did slip in some :slot
handling a little while ago due to the syntax of the world file changing
a while back after being annoyed.
> The point of shifting it into portageq isn't speed based; it's to
> transfer responsibility for atom parsing from multiple authorities
> into a single one.
It's still a good idea to expend the functionality of portageq. But for
scripting from bash, reality wins as most everything python-portage
related falls a little short due to the sheer number of file i/o calls
python makes looking for files that might not pertain at all to the info
the user is after. Granted today it's a heck of a lot faster than it
used to be a few years ago when the loading problem was first noticed.
> Besides, just because portageq is slow for heavy data ops doesn't mean
> it's going to be slow for doing simple atom splitting. Quick test
> locally, cold cache pegs it at 3s- with minor use of snakeoil
> demandload that's likely halvable.
>
> ~brian
I'm all in favor of using the right tool for the task at hand whatever
that may be.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-26 0:18 ` Ned Ludd
2008-11-26 0:31 ` Brian Harring
@ 2008-11-26 4:54 ` Zac Medico
2008-11-27 2:03 ` Brian Harring
1 sibling, 1 reply; 16+ messages in thread
From: Zac Medico @ 2008-11-26 4:54 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ned Ludd wrote:
> On Tue, 2008-11-25 at 14:03 -0800, Brian Harring wrote:
>> On Tue, Nov 25, 2008 at 06:05:21PM +0200, 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"?
>>>
>>> (I don't necessarily need to use qlist. Just want to get the version of an
>>> installed package within a bash script)
>> This *really* should be folded into portageq offhand- it's the initial
>> step towards shifting versionator logic (yet another standalone
>> parser/comparison implementation) into the PM.
>>
>> Counter arguements?
>> ~brian
>
> Yes. he said a bash script. portageq still takes a few seconds to load
> and invokes far far to many instructions for very simple info.
>
> The 3 execve's I just posted are still faster than one portageq call.
> So.. foo.c wins again. :p
Well, I think portageq will be fine if it's limited to a small
number of calls. Here's a simple test, with portage-2.2_rc16:
# time python -c "import portage.versions"
real 0m0.141s
user 0m0.124s
sys 0m0.016s
It's not so bad if it only has to be called a few times. For cases
where a large number need to be split, they could be processed in a
batch by a single portageq call, by either passing all the inputs in
as arguments or writing them to stdin.
- --
Thanks,
Zac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAkks1oQACgkQ/ejvha5XGaM/fgCfQwG2gD0viF5qjcN0WBewlCxi
08sAoKBZYQy3Ttkb4KhFIChPVsbFjpQR
=fc1x
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-26 0:15 ` Ned Ludd
@ 2008-11-26 8:29 ` Fabian Groffen
2008-11-26 9:29 ` Amit Dor-Shifer
1 sibling, 0 replies; 16+ messages in thread
From: Fabian Groffen @ 2008-11-26 8:29 UTC (permalink / raw
To: gentoo-portage-dev
On 25-11-2008 16:15:09 -0800, Ned Ludd wrote:
> On Tue, 2008-11-25 at 18:05 +0200, 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"?
> >
> > (I don't necessarily need to use qlist. Just want to get the version of
> > an installed package within a bash script)
>
> qatom $(qlist -ICv sys-apps/portage) | awk '{print $3}'
I happen to do it in bash for my update script, it hasn't broke yet:
get_ebuildversion() {
if [[ -z $1 ]] ; then
return
fi
# strip extension
t=${1%.ebuild}
# abort if this is not an ebuild
if [[ $t == $1 ]] ; then
return
fi
# strip package name
t=${t#*-}
# sometimes there are dashes in the package name
while [[ ${t:0:1} < "0" || ${t:0:1} > "9" ]] ; do
[[ $t != ${t#*-} ]] \
&& t=${t#*-} \
|| break
done
echo ${t}
}
you might want to remove the .ebuild check and strip the category ($1#*/})
--
Fabian Groffen
Gentoo on a different level
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-26 0:15 ` Ned Ludd
2008-11-26 8:29 ` Fabian Groffen
@ 2008-11-26 9:29 ` Amit Dor-Shifer
1 sibling, 0 replies; 16+ messages in thread
From: Amit Dor-Shifer @ 2008-11-26 9:29 UTC (permalink / raw
To: gentoo-portage-dev
Great! the usage of -C escaped me, and I was wondering why I was
getting bad output...
Thanks,
Amit
Ned Ludd wrote:
> On Tue, 2008-11-25 at 18:05 +0200, 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"?
>>
>> (I don't necessarily need to use qlist. Just want to get the version of
>> an installed package within a bash script)
>>
>>
>
>
> qatom $(qlist -ICv sys-apps/portage) | awk '{print $3}'
>
>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-25 17:03 ` René 'Necoro' Neumann
@ 2008-11-26 11:13 ` Amit Dor-Shifer
2008-11-27 7:08 ` Alec Warner
0 siblings, 1 reply; 16+ messages in thread
From: Amit Dor-Shifer @ 2008-11-26 11:13 UTC (permalink / raw
To: gentoo-portage-dev
Is there syntax in eix for querying: "is package X installed with a
version X.Y or higher?"
Amit
René 'Necoro' Neumann wrote:
> Amit Dor-Shifer schrieb:
> > 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
>
> You could also use eix ... though I needed quite a time to figure it
> out ;)
>
> # PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages
> --format "<installedversionsshort>"
> 1.9.6-r2 1.10.1-r1
>
> Note however, that if you a package has multiple installed versions,
> they are seperated by space. One could use
>
>
> # PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages
> --format "<installedversionsshort:\n>"
>
> But this prints an additional empty line at the beginning.
>
> > 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:'
> >>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-26 4:54 ` Zac Medico
@ 2008-11-27 2:03 ` Brian Harring
0 siblings, 0 replies; 16+ messages in thread
From: Brian Harring @ 2008-11-27 2:03 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 1548 bytes --]
On Tue, Nov 25, 2008 at 08:54:29PM -0800, Zac Medico wrote:
> Ned Ludd wrote:
> > On Tue, 2008-11-25 at 14:03 -0800, Brian Harring wrote:
> >> On Tue, Nov 25, 2008 at 06:05:21PM +0200, 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"?
> >>>
> >>> (I don't necessarily need to use qlist. Just want to get the version of an
> >>> installed package within a bash script)
> >> This *really* should be folded into portageq offhand- it's the initial
> >> step towards shifting versionator logic (yet another standalone
> >> parser/comparison implementation) into the PM.
> >>
> >> Counter arguements?
> >> ~brian
> >
> > Yes. he said a bash script. portageq still takes a few seconds to load
> > and invokes far far to many instructions for very simple info.
> >
> > The 3 execve's I just posted are still faster than one portageq call.
> > So.. foo.c wins again. :p
>
> Well, I think portageq will be fine if it's limited to a small
> number of calls. Here's a simple test, with portage-2.2_rc16:
>
> # time python -c "import portage.versions"
>
> real 0m0.141s
> user 0m0.124s
> sys 0m0.016s
>
> It's not so bad if it only has to be called a few times. For cases
> where a large number need to be split, they could be processed in a
> batch by a single portageq call, by either passing all the inputs in
> as arguments or writing them to stdin.
So.. eapi3 meanwhile?
~brian
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
2008-11-26 11:13 ` Amit Dor-Shifer
@ 2008-11-27 7:08 ` Alec Warner
0 siblings, 0 replies; 16+ messages in thread
From: Alec Warner @ 2008-11-27 7:08 UTC (permalink / raw
To: gentoo-portage-dev
On Wed, Nov 26, 2008 at 3:13 AM, Amit Dor-Shifer <amitds@oversi.com> wrote:
> Is there syntax in eix for querying: "is package X installed with a version
> X.Y or higher?"
> Amit
portageq has_version / <ATOM>
>
> René 'Necoro' Neumann wrote:
>>
>> Amit Dor-Shifer schrieb:
>> > 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
>>
>> You could also use eix ... though I needed quite a time to figure it out
>> ;)
>>
>> # PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages
>> --format "<installedversionsshort>"
>> 1.9.6-r2 1.10.1-r1
>>
>> Note however, that if you a package has multiple installed versions,
>> they are seperated by space. One could use
>>
>>
>> # PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages
>> --format "<installedversionsshort:\n>"
>>
>> But this prints an additional empty line at the beginning.
>>
>> > 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:'
>> >>
>>
>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2008-11-27 7:08 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-25 16:05 [gentoo-portage-dev] How to extract the version/revision of an installed package? Amit Dor-Shifer
2008-11-25 16:13 ` Andrew Gaffney
2008-11-25 16:19 ` Andrew Gaffney
2008-11-25 16:43 ` Amit Dor-Shifer
2008-11-25 17:03 ` René 'Necoro' Neumann
2008-11-26 11:13 ` Amit Dor-Shifer
2008-11-27 7:08 ` Alec Warner
2008-11-25 22:03 ` Brian Harring
2008-11-26 0:18 ` Ned Ludd
2008-11-26 0:31 ` Brian Harring
2008-11-26 1:24 ` Ned Ludd
2008-11-26 4:54 ` Zac Medico
2008-11-27 2:03 ` Brian Harring
2008-11-26 0:15 ` Ned Ludd
2008-11-26 8:29 ` Fabian Groffen
2008-11-26 9:29 ` Amit Dor-Shifer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox