Gentoo Archives: gentoo-dev

From: Jon Portnoy <avenj@g.o>
To: Abraham Marin Perez <abraham@×××××××××.es>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Using some of the emerge features in external programs
Date: Sat, 25 Sep 2004 20:36:13
Message-Id: 20040925203601.GA21746@cerberus.oppresses.us
In Reply to: [gentoo-dev] Using some of the emerge features in external programs by Abraham Marin Perez
1 On Sat, Sep 25, 2004 at 10:32:36PM +0200, Abraham Marin Perez wrote:
2 > Hi everyone,
3 >
4 > Firstly I want to say hello since this is the first e-mail I send to
5 > this mailing list. The second and maybe the most important point is that
6 > I'd like to use one of the features of emerge, and that is a way to know
7 > the version of an application that'd be emerged given the name of the
8 > application or, yet better, the complete name(s) of the file(s) that'd
9 > be downloaded to emerge that application.
10
11 You can access Portage's python library. For example, from the master
12 repository distfiles cleaning script (no idea if it's still in use or
13 not, I'm not involved with distfiles infrastructure anymore):
14
15 URI=`python -c 'import portage; print portage.db["/"]["porttree"].dbapi.aux_get('\"$CATPKG\"',["SRC_URI"])[0]'`
16
17 grabbed the Portage-parsed SRC_URI for foo-bar/xyz in $CATPKG.
18
19 You can then use basename or whatever your preferred method is for
20 parsing out the filenames.
21
22 --
23 Jon Portnoy
24 avenj/irc.freenode.net
25
26 --
27 gentoo-dev@g.o mailing list