public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] get unversioned list of installed packages without eix or esearch
@ 2006-06-26  6:44 Bo Ørsted Andresen
  2006-06-26  8:36 ` Richard Fish
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bo Ørsted Andresen @ 2006-06-26  6:44 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]

I know that I can get a list of installed packages without their version 
numbers with eix:

# eix -nI --format '<category>/<name>' | \
	grep -vr '^$\|^\[[0-9]*\]\|^Found\ [0-9]*'

This is probably possible with esearch too. But does anybody know of a way to 
get it with portage, bash or gentoolkit?

I was of course considering something like this:

# cd /var/db/pkg && ls * | ${some_magic_regular_expression_to_remove_version}

But I have found it impossible to make a regular expression that does break 
for at least one of those:

media-fonts/font-adobe-100dpi-1.0.0
media-fonts/font-adobe-75dpi-1.0.0
media-fonts/font-adobe-utopia-type1-1.0.1
media-libs/jpeg-6b-r7
net-misc/cisco-vpnclient-3des-4.8.00.0490
sys-apps/portage-2.1.1_pre1-r2
sys-fs/udev-090
sys-fs/udev-090-r1
sys-libs/libstdc++-v3-3.3.6
sys-libs/timezone-data-2006g

Which are:

media-fonts/font-adobe-100dpi
media-fonts/font-adobe-75dpi
media-fonts/font-adobe-utopia-type1
media-libs/jpeg
net-misc/cisco-vpnclient-3des
sys-apps/portage
sys-fs/udev
sys-fs/udev
sys-libs/libstdc++-v3
sys-libs/timezone-data

Any ideas?

-- 
Bo Andresen

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
  2006-06-26  6:44 [gentoo-user] get unversioned list of installed packages without eix or esearch Bo Ørsted Andresen
@ 2006-06-26  8:36 ` Richard Fish
  2006-06-26 14:30   ` Alexander Skwar
  2006-06-26  8:45 ` Jure Varlec
  2006-06-26  9:03 ` Zac Medico
  2 siblings, 1 reply; 6+ messages in thread
From: Richard Fish @ 2006-06-26  8:36 UTC (permalink / raw
  To: gentoo-user

On 6/25/06, Bo Ørsted Andresen <bo.andresen@zlin.dk> wrote:
> This is probably possible with esearch too. But does anybody know of a way to
> get it with portage, bash or gentoolkit?

Well, there is probably a better way to write this script, but here is
a method that will do it with bash.  The idea is for each package in
portage, to determine whether that is installed or not.  This seems a
bit easier than working backwards from the installed package database:

cd /usr/portage
find . -name "*.ebuild" | sed -e 's/\.\///g' | while read ebuild; do
    pkg=`dirname $ebuild`
    category=`dirname $pkg`
    pkgdir=`basename $ebuild .ebuild`
    test -d /var/db/pkg/$category/$pkgdir && echo $pkg
done | sort

This works, but it does seem to take a long time!

-Richard

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
  2006-06-26  6:44 [gentoo-user] get unversioned list of installed packages without eix or esearch Bo Ørsted Andresen
  2006-06-26  8:36 ` Richard Fish
@ 2006-06-26  8:45 ` Jure Varlec
  2006-06-26  9:53   ` Bo Ørsted Andresen
  2006-06-26  9:03 ` Zac Medico
  2 siblings, 1 reply; 6+ messages in thread
From: Jure Varlec @ 2006-06-26  8:45 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

On Monday 26 June 2006 08:44, Bo Ørsted Andresen wrote:
> I was of course considering something like this:
>
> # cd /var/db/pkg && ls * |
> ${some_magic_regular_expression_to_remove_version}
>
> But I have found it impossible to make a regular expression that does break
> for at least one of those:

sed -r 's/-[^-]+(-r[0-9]+)*$//'
It works on the examples you provided. I don't think anything in the tree 
uses '-' in the version number, unless it's a case of '-rN'. But you never 
know, of course, so I always double check all package names I ever filter 
through anything.

Regards
Jure

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
  2006-06-26  6:44 [gentoo-user] get unversioned list of installed packages without eix or esearch Bo Ørsted Andresen
  2006-06-26  8:36 ` Richard Fish
  2006-06-26  8:45 ` Jure Varlec
@ 2006-06-26  9:03 ` Zac Medico
  2 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2006-06-26  9:03 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bo Ørsted Andresen wrote:
> But I have found it impossible to make a regular expression that does break 
> for at least one of those:
> 
> media-fonts/font-adobe-100dpi-1.0.0
> media-fonts/font-adobe-75dpi-1.0.0
> media-fonts/font-adobe-utopia-type1-1.0.1
> media-libs/jpeg-6b-r7
> net-misc/cisco-vpnclient-3des-4.8.00.0490
> sys-apps/portage-2.1.1_pre1-r2
> sys-fs/udev-090
> sys-fs/udev-090-r1
> sys-libs/libstdc++-v3-3.3.6
> sys-libs/timezone-data-2006g

Just pipe the above list through the attached script.

Zac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEn6Lk/ejvha5XGaMRAhGyAJ4rhUGQ3J6KL1DBXNpP0HlMETFugQCcCRSB
ibY4cSDupWfPJjSbhNX2bOE=
=bbr5
-----END PGP SIGNATURE-----

[-- Attachment #2: dep_getkey.py --]
[-- Type: text/x-python, Size: 122 bytes --]

#!/usr/bin/env python

from sys import stdin
from portage import dep_getkey

for pkg in stdin:
	print dep_getkey("="+pkg)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
  2006-06-26  8:45 ` Jure Varlec
@ 2006-06-26  9:53   ` Bo Ørsted Andresen
  0 siblings, 0 replies; 6+ messages in thread
From: Bo Ørsted Andresen @ 2006-06-26  9:53 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

On Monday 26 June 2006 10:45, Jure Varlec wrote:
> sed -r 's/-[^-]+(-r[0-9]+)*$//'

This was exactly what I was looking for. Since the following command did not 
produce any relevant output I can confirm that this works for everything 
currently in portage.

# cd /usr/portage && \
	find . -name '*.ebuild' | sed -e 's/\.ebuild$//' | \
	awk -F/ '{print $2"/"$4}' | sed -r 's/-[^-]+(-r[0-9]+)*$//' | \
	awk -F/ '{system("eix -C "$1" -e "$2" -c | grep -q ^Found\\ 1\\ matches || \
	 echo "$0)}'

Thank you to everyone who replied. :)

-- 
Bo Andresen

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
  2006-06-26  8:36 ` Richard Fish
@ 2006-06-26 14:30   ` Alexander Skwar
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Skwar @ 2006-06-26 14:30 UTC (permalink / raw
  To: gentoo-user

Richard Fish wrote:

> This works, but it does seem to take a long time!

Probably because of all those dirnames and basename calls. Try:

cd /usr/portage
find . -name "*.ebuild" | sed -e 's/\.\///g' | while read ebuild; do
	pkg=${ebuild%/*}
	category=${pkg%/*}
	pkgdir=${ebuild##*/} ; pkgdir=${pkgdir%.ebuild}
	[[ -d "/var/db/pkg/$category/$pkgdir" ]] && echo "$pkg"
done | sort

Alexander Skwar
-- 
Some people pray for more than they are willing to work for.
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-06-26 14:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-26  6:44 [gentoo-user] get unversioned list of installed packages without eix or esearch Bo Ørsted Andresen
2006-06-26  8:36 ` Richard Fish
2006-06-26 14:30   ` Alexander Skwar
2006-06-26  8:45 ` Jure Varlec
2006-06-26  9:53   ` Bo Ørsted Andresen
2006-06-26  9:03 ` Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox