1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
On Saturday 15 May 2004 13:12, Andrew Gaffney wrote: |
5 |
> Jason Stubbs wrote: |
6 |
> > On Wednesday 12 May 2004 12:02, Andrew Gaffney wrote: |
7 |
> >>>I am writing a Perl program that does the same thing as 'emerge'. Yes, I |
8 |
> >>>started a thread about this on -dev about 6 months back, but I'm better |
9 |
> >>>prepared to do this now. I've already written functions that: |
10 |
> >>> |
11 |
> >>> * Build a list of USE flags from /etc/make.profile/make.defaults, |
12 |
> >>>/etc/make.conf, and $ENV{USE} |
13 |
> >>> * Build a list of masked packages from |
14 |
> >>>/etc/make.profile/package.(un)mask and /etc/portage/package.(un)mask |
15 |
> >>> * Build a list of matching ebuild versions from a |
16 |
> >>>'>category/package-version' type string taking masked packages into |
17 |
> >>> account * Extract the DEPEND line from a particular ebuild |
18 |
> >>> * Parse a DEPEND line using active USE flags and build a list of |
19 |
> >>> needed packages |
20 |
> >>> |
21 |
> >>>I'm starting work on the code that generates the actual dependency tree |
22 |
> >>> and then the list of packages to be installed. I don't have any Python |
23 |
> >>> skill, so I don't think that reading the code will help me much. Can |
24 |
> >>> anyone who deals with the Portage code a lot give me a general |
25 |
> >>> breakdown of the way that 'emerge' generates the dependency tree and |
26 |
> >>> then the list of packages to emerge? |
27 |
> > |
28 |
> > As of .51: |
29 |
> > |
30 |
> > Initial startup: |
31 |
> > * Read configuration files |
32 |
> > * Scan system for installed packages and auto-enable use flags and |
33 |
> > virtuals * Create master configuration |
34 |
> > |
35 |
> > Dep calculation: |
36 |
> > * Is blocker? No? Continue... |
37 |
> > * Is a matching package installed? No? Continue... |
38 |
> > * Make record of blocked package and continue... |
39 |
> > * Resolve atom to package |
40 |
> > * Has package's already been added? Yes? Continue... |
41 |
> > * Add package and note its parent |
42 |
> > * Copy master configuration |
43 |
> > * Is binary package? Adjust USE flags from build-time. |
44 |
> > * Is source package? Adjust USE flags from package.use |
45 |
> > * Parse DEPEND and RDEPEND and resolve against USE flags |
46 |
> > -- deps in "|| ( foo bar )" deps get preference by being installed |
47 |
> > * Calculate deps for each atom parsed, with parent as this package |
48 |
> > * Parse PDEPEND and resolve against USE flags |
49 |
> > * Calculate deps for each atom parsed, with no parent |
50 |
> > |
51 |
> > Order resolution: |
52 |
> > * Find first added package that has no parents |
53 |
> > * Add package to order and remove from tree |
54 |
> > * Continue... |
55 |
> > |
56 |
> > There are a number of problems in this logic, some of which you and |
57 |
> > Pieter have noticed. The ones you have mentioned, I've fixed in a |
58 |
> > complete rewrite. To fix the main flaws (package only gets the parent |
59 |
> > from when it is first added, and PDEPENDs having no parents) is next on |
60 |
> > the agenda but is quite difficult. |
61 |
> |
62 |
> You've already done a complete rewrite of the dependency resolver? |
63 |
|
64 |
Yes and no. I started from scratch but used almost exactly the same logic. I |
65 |
guess you could almost call it refactoring. Have a look at: |
66 |
http://www.gentoo.org/cgi-bin/viewcvs.cgi/portage-mod/portageapi/?root=gentoo-src |
67 |
|
68 |
Of interest to you, will probably be dep.py. Even if you do not understand |
69 |
python, the logic should be fairly clear (I hope!). The only real change from |
70 |
the above logic is that installed packages (including their original USE |
71 |
flags and *DEPENDs) are also taken into account. |
72 |
|
73 |
Regards, |
74 |
Jason Stubbs |
75 |
-----BEGIN PGP SIGNATURE----- |
76 |
Version: GnuPG v1.2.4 (GNU/Linux) |
77 |
|
78 |
iQCVAwUBQKW1P1oikN4/5jfsAQLrNgQArwpCmI3DQUHcLhDygRmX7WSl7d55KcQb |
79 |
jo/F6f+lROsQHYz6xFhktiUpvP8j6QalRDtF0c5zpdnUaSGzUZPBqd2Oqh1bjl78 |
80 |
tQbC5IbEw2myFLDNu1/DauSr//IsReFI86wDapjpGOkk6vmqE9LrZZW9TLCgA9UY |
81 |
dvdy3eWMj6c= |
82 |
=o4F2 |
83 |
-----END PGP SIGNATURE----- |
84 |
|
85 |
-- |
86 |
gentoo-portage-dev@g.o mailing list |