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