Gentoo Archives: gentoo-dev

From: "Santiago M. Mola" <coldwind@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: I want to steal your tools
Date: Tue, 05 Feb 2008 13:29:13
Message-Id: 3c32af40802050528v28ac594aw706116d969253cef@mail.gmail.com
In Reply to: [gentoo-dev] Re: I want to steal your tools by Ryan Hill
1 On Feb 5, 2008 4:21 AM, Ryan Hill <dirtyepic@g.o> wrote:
2 > Heath N. Caldwell wrote:
3 > > On 2008-02-04 14:51, Ryan Hill wrote:
4 > >> Can someone provide a tool that given a package name simply prints the
5 > >> category or cat/pkg, or if ambiguous, prints the multiple cat/pkgs or
6 > >> returns an error code? I don't care what it's written in as long as it's
7 > >> relatively quick. I'm sick of depending on udept (which is an incredible
8 > >> tool but a lot heavy for a simple shell script) just to get a simple
9 > >> category.
10 > >
11 > > What about something like this:
12 > >
13 > > --
14 > > #!/bin/bash
15 > >
16 > > source /etc/make.globals
17 > > source /etc/make.conf
18 > >
19 > > for i in ${PORTDIR} ${PORTDIR_OVERLAY}; do
20 > > (cd $i; a=(*/$1); [ -e ${a[0]} ] && ls -1 -d */$1)
21 > > done | sort | uniq
22 > > --
23 > >
24 > > It's really fast, at least.
25 >
26 > Also very good, thanks. Instead of sourcing, we can instead use
27 >
28 > $ portageq envvar PORTDIR
29 > $ portageq portdir_overlay
30 >
31 > How do paludis and pkgcore make this info available?
32
33 You can get PORTDIR with:
34 paludis --configuration-variable gentoo location
35
36 AFAIK, PORTDIR_OVERLAY is more tricky:
37 for r in $(paludis --list-repositories | sed -e "s/^*\ //g") ; do
38 if [[ $(paludis --configuration-variable ${r} format) = "ebuild" ]] ; then
39 paludis --configuration-variable ${r} location
40 fi
41 done
42
43
44 --
45 Santiago M. Mola
46 Jabber ID: cooldwind@×××××.com
47 --
48 gentoo-dev@l.g.o mailing list