Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [1/3] Cache subsystem rewrite
Date: Thu, 03 Nov 2005 18:01:26
Message-Id: 20051103180010.GA5073@nightcrawler
In Reply to: Re: [gentoo-portage-dev] [1/3] Cache subsystem rewrite by Jason Stubbs
1 On Fri, Nov 04, 2005 at 12:43:33AM +0900, Jason Stubbs wrote:
2 > On Monday 31 October 2005 02:14, Brian Harring wrote:
3 >
4 > +++ pym/cache/util.py (revision 0)
5 > + def exception(self, key, *arg): print "exec",key,arg
6 >
7 > Should "exec" be "exec"?
8 print "key '%s' caught exception '%s'" % key, arg
9
10 > +++ pym/cache/mappings.py (revision 0)
11 > + def __init__(self, pull_items, initial_items=[]):
12 > ...
13 > + self.pull = pull_items
14 > ...
15 > + self.d.update(self.pull())
16 >
17 > What is pull_items? A function that returns a dict? If so, might be a good
18 > idea to name the parameter to something with "func" in it.
19
20 Or tag that info into the docstring, since the docstring is wrong
21 quickly glancing at it...
22
23 > +++ pym/cache/metadata.py (revision 0)
24 > + for idx, c in enumerate(line):
25 idx=-1
26 for c in enumerate(line):
27 idx += 1
28
29 will be substituted into the stable commit instead of enumerate...
30
31 > "enumerate" is a new one. Do you know which python version that was added in?
32 2.3
33
34 > +++ pym/cache/sql_template.py (revision 0)
35 > + SCHEMA_VALUES_CREATE = "CREATE TABLE %s ( pkgid integer references %s
36 > (pkgid) on delete cascade, \
37 >
38 > There's plenty more, but this is a good enough example. You realize that MySQL
39 > won't be supported (until 5.1) ? Not saying that MySQL need be supported;
40 > just ensuring that you realize it.
41
42 Well aware... which is why it's broken out as (essentially) a global
43 var. If it were just a syntax issues, derivatives only have to modify
44 the sql used.
45
46 If the underlying sql engine lacks a feature (triggers/refs), well,
47 you modify the sql statements bound to the class so that it works.
48
49 The use of delete trigger and foreign key there is for ease of use for
50 _all_ derivatives of the sql template- if a backend lacks capabilities
51 that others have, well, they have to implement their own trickery (aim
52 for maximal reuse for derivatives, with the odd balls having to do a
53 bit more work).
54
55 Fex... for the bit above, would override SCHEMA_VALUES_CREATE to nuke
56 the ref/trigger, then shift the delete sql into the class namespace,
57 and have mysql override that.
58
59 > Haven't had a close look yet. It will probably all make more sense after
60 > looking at the second patch. You should probably commit the lot to subversion
61 > though. Tracing out bugs when they appear will speed up understanding
62 > greatly. ;)
63
64 /me cackles...
65 finally going to kill off the crap cache subsystem in place :)
66
67 I've been thinking about it for a while, only change I'm sitting on
68 the fence about is how the tree path is stored in the backend;
69 thinking of using the tree label instead.
70
71 With stable, moving your tree around is going to invalidate your
72 cache... just how it goes. If the code is shifted over to using
73 labels internally for eclass storage, still is an issue, but only for
74 stable- stable generates the label from the file path.
75
76 Under 3.0's config, user can label the tree/cache seperately, and move
77 it around without this issue- course, changing the label of a tree
78 will then result in invalidation...
79
80 Thoughts?
81 ~harring