[gentoo-user] get unversioned list of installed packages without eix or esearch
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 pgp7Ehw3gXoPL.pgp Description: PGP signature
Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
On 6/25/06, Bo Ørsted Andresen [EMAIL PROTECTED] 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
Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
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 pgp0WsBJENCxI.pgp Description: PGP signature
Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
-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- #!/usr/bin/env python from sys import stdin from portage import dep_getkey for pkg in stdin: print dep_getkey(=+pkg)
Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
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 pgpov8ZEuxTC9.pgp Description: PGP signature
Re: [gentoo-user] get unversioned list of installed packages without eix or esearch
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