On Feb 5, 2008 4:21 AM, Ryan Hill <[EMAIL PROTECTED]> wrote: > Heath N. Caldwell wrote: > > On 2008-02-04 14:51, Ryan Hill wrote: > >> Can someone provide a tool that given a package name simply prints the > >> category or cat/pkg, or if ambiguous, prints the multiple cat/pkgs or > >> returns an error code? I don't care what it's written in as long as it's > >> relatively quick. I'm sick of depending on udept (which is an incredible > >> tool but a lot heavy for a simple shell script) just to get a simple > >> category. > > > > What about something like this: > > > > -- > > #!/bin/bash > > > > source /etc/make.globals > > source /etc/make.conf > > > > for i in ${PORTDIR} ${PORTDIR_OVERLAY}; do > > (cd $i; a=(*/$1); [ -e ${a[0]} ] && ls -1 -d */$1) > > done | sort | uniq > > -- > > > > It's really fast, at least. > > Also very good, thanks. Instead of sourcing, we can instead use > > $ portageq envvar PORTDIR > $ portageq portdir_overlay > > How do paludis and pkgcore make this info available?
You can get PORTDIR with: paludis --configuration-variable gentoo location AFAIK, PORTDIR_OVERLAY is more tricky: for r in $(paludis --list-repositories | sed -e "s/^*\ //g") ; do if [[ $(paludis --configuration-variable ${r} format) = "ebuild" ]] ; then paludis --configuration-variable ${r} location fi done -- Santiago M. Mola Jabber ID: [EMAIL PROTECTED] -- gentoo-dev@lists.gentoo.org mailing list