public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* Re: [gentoo-dev] portage without portage
  2003-10-27  7:32 [gentoo-dev] portage without portage Andrew Gaffney
@ 2003-10-26  8:25 ` Kumba
  2003-10-26 12:29 ` Bartosch Pixa
  1 sibling, 0 replies; 7+ messages in thread
From: Kumba @ 2003-10-26  8:25 UTC (permalink / raw
  To: gentoo-dev

Andrew Gaffney wrote:

> In an effort to better understand the way that Portage works, I'm trying 
> to write a perl program that can generate a dependency tree like emerge 
> does. Since I'm using Perl and not Python, I can't use the Portage API. 
> Here is my code so far:

All I can say is "good luck"...


> This gets me a nice list of the packages that the ebuild depends on. As 
> for the USE flags, I only get the ones defined in /etc/make.conf, not 
> the full set. Is there an easy way to do this?

You might try parsing /usr/portage/profiles/use.desc and 
/usr/portage/use.local.desc for all the use flags.


--Kumba

-- 
"Such is oft the course of deeds that move the wheels of the world: 
small hands do them because they must, while the eyes of the great are 
elsewhere."  --Elrond


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] portage without portage
  2003-10-27  7:32 [gentoo-dev] portage without portage Andrew Gaffney
  2003-10-26  8:25 ` Kumba
@ 2003-10-26 12:29 ` Bartosch Pixa
  2003-10-27 16:16   ` Andrew Gaffney
  1 sibling, 1 reply; 7+ messages in thread
From: Bartosch Pixa @ 2003-10-26 12:29 UTC (permalink / raw
  To: Gentoo Dev

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

On Mon, 2003-10-27 at 08:32, Andrew Gaffney wrote:
> In an effort to better understand the way that Portage works, I'm trying to write a perl 
> program that can generate a dependency tree like emerge does. Since I'm using Perl and not 
> Python, I can't use the Portage API. Here is my code so far:

you could try to use the portage API with the help of this:

http://search.cpan.org/~gaas/pyperl-1.0/Python-Object/lib/Python.pm

-- 
Bartosch Pixa
Gentoo Linux Developer                    http://www.gentoo.org

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-dev] portage without portage
  2003-10-27 16:16   ` Andrew Gaffney
@ 2003-10-26 18:25     ` Kain
  2003-10-29 16:37     ` Nick Jones
  1 sibling, 0 replies; 7+ messages in thread
From: Kain @ 2003-10-26 18:25 UTC (permalink / raw
  To: Andrew Gaffney; +Cc: gentoo-dev

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

On Mon, Oct 27, 2003 at 10:16:38AM -0600, Andrew Gaffney wrote:
> nls? ( sys-devel/gettext ) media-sound/cdparanoia gif? ( media-libs/giflib 
> media-libs/libungif )
> 
> and pull out each 'key? ( value )', 'key? ( value value )', or just 'value' 
> where its alone. Anyone have any idea where I'm going wrong?
You need to write a state machine that runs over words in the full DEPEND text for the ebuild to determine the meaning of each word depending on what came previously (i.e. USEflag -> descend until finished with ( and ) and so on)
-- 
Bryon Roche
Professional {Developer,Guru,Mad Scientist}
<kain@kain.org>
PGP Key Fingerprint: FE0D EC23 6464 726A CD54  48D3 04AD 86FE 6878 ABD5
Success, recognition, and conformity are the bywords of the modern world where
everyone seems to crave the anesthetizing security of being identified with the
majority...Human salvation lies in the hands of the creatively maladjusted.
  -- Martin Luther King, Jr.

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

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

* [gentoo-dev] portage without portage
@ 2003-10-27  7:32 Andrew Gaffney
  2003-10-26  8:25 ` Kumba
  2003-10-26 12:29 ` Bartosch Pixa
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Gaffney @ 2003-10-27  7:32 UTC (permalink / raw
  To: Gentoo Dev

In an effort to better understand the way that Portage works, I'm trying to write a perl 
program that can generate a dependency tree like emerge does. Since I'm using Perl and not 
Python, I can't use the Portage API. Here is my code so far:

[code]
#!/usr/bin/perl -w

my $dbpath = '/usr/portage';
my $pkgregex =
     '^(.+?)'.                                   # name
     '-(\d+(?:\.\d+)*\w*)'.                      # version, eg 1.23.4a
     '((?:(?:_alpha|_beta|_pre|_rc)\d*)?)'.      # special suffix
     '((?:-r\d+)?)$';                            # revision, eg r12

my $pkg = shift;

$depend = `source ${dbpath}/${pkg}; echo \${DEPEND}; echo \${RDEPEND}`;
print $depend;

$useflags = `source /etc/make.conf; echo \${USE}`;
print $useflags;
[/code]

This gets me a nice list of the packages that the ebuild depends on. As for the USE flags, 
I only get the ones defined in /etc/make.conf, not the full set. Is there an easy way to 
do this?

-- 
Andrew Gaffney


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] portage without portage
  2003-10-26 12:29 ` Bartosch Pixa
@ 2003-10-27 16:16   ` Andrew Gaffney
  2003-10-26 18:25     ` Kain
  2003-10-29 16:37     ` Nick Jones
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Gaffney @ 2003-10-27 16:16 UTC (permalink / raw
  To: Gentoo Dev

Bartosch Pixa wrote:
> On Mon, 2003-10-27 at 08:32, Andrew Gaffney wrote:
> 
>>In an effort to better understand the way that Portage works, I'm trying to write a perl 
>>program that can generate a dependency tree like emerge does. Since I'm using Perl and not 
>>Python, I can't use the Portage API. Here is my code so far:
> 
> 
> you could try to use the portage API with the help of this:
> 
> http://search.cpan.org/~gaas/pyperl-1.0/Python-Object/lib/Python.pm

I think I'll just stick with what I know. For now, I'm just doing 'emerge info | grep USE' 
to get a complete list of USE flags. As for the DEPEND line, I'm using a regex to extract 
each item, although its not going too well.

[code]
while($deplist =~ /((\w+\?)?) (\(?) (\S+) (\)?)/cg) {
   print "$2 - $4\n";
}
[/code]

which is supposed to pull apart a string like:

nls? ( sys-devel/gettext ) media-sound/cdparanoia gif? ( media-libs/giflib 
media-libs/libungif )

and pull out each 'key? ( value )', 'key? ( value value )', or just 'value' where its 
alone. Anyone have any idea where I'm going wrong?

-- 
Andrew Gaffney


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] portage without portage
  2003-10-27 16:16   ` Andrew Gaffney
  2003-10-26 18:25     ` Kain
@ 2003-10-29 16:37     ` Nick Jones
  2003-10-29 17:46       ` Andrew Gaffney
  1 sibling, 1 reply; 7+ messages in thread
From: Nick Jones @ 2003-10-29 16:37 UTC (permalink / raw
  To: Andrew Gaffney; +Cc: Gentoo Dev

> I think I'll just stick with what I know. For now, I'm just doing 'emerge 
> info | grep USE' to get a complete list of USE flags. As for the DEPEND 
> line, I'm using a regex to extract each item, although its not going too 
> well.

You can't do it that way. Portage does a lot of calculations based on
things like virtuals, inherited-values, and eclasses. USE flags also
have the potential to change during dep calculation due to binary
package restrictions and eventually USE requirements as well.

The way you're getting USE is ok for single packages.

The DEPEND info isn't right. DEPEND, RDEPEND, and PDEPEND all can vary
inside of an eclass, and depending upon if they are unset, empty, or
set, they can affect the final output.

--NJ

--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] portage without portage
  2003-10-29 16:37     ` Nick Jones
@ 2003-10-29 17:46       ` Andrew Gaffney
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Gaffney @ 2003-10-29 17:46 UTC (permalink / raw
  To: Gentoo Dev

Nick Jones wrote:
>>I think I'll just stick with what I know. For now, I'm just doing 'emerge 
>>info | grep USE' to get a complete list of USE flags. As for the DEPEND 
>>line, I'm using a regex to extract each item, although its not going too 
>>well.
> 
> You can't do it that way. Portage does a lot of calculations based on
> things like virtuals, inherited-values, and eclasses. USE flags also
> have the potential to change during dep calculation due to binary
> package restrictions and eventually USE requirements as well.
> 
> The way you're getting USE is ok for single packages.
> 
> The DEPEND info isn't right. DEPEND, RDEPEND, and PDEPEND all can vary
> inside of an eclass, and depending upon if they are unset, empty, or
> set, they can affect the final output.

I'm just going to pretend I didn't hear any of that :) Something I'm curious about: what 
is the difference between the different *DEPEND lines?

-- 
Andrew Gaffney


--
gentoo-dev@gentoo.org mailing list


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

end of thread, other threads:[~2003-10-29 17:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-27  7:32 [gentoo-dev] portage without portage Andrew Gaffney
2003-10-26  8:25 ` Kumba
2003-10-26 12:29 ` Bartosch Pixa
2003-10-27 16:16   ` Andrew Gaffney
2003-10-26 18:25     ` Kain
2003-10-29 16:37     ` Nick Jones
2003-10-29 17:46       ` Andrew Gaffney

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