1 |
On Tue, 17 Feb 2015 11:26:27 -0800 |
2 |
Zac Medico <zmedico@g.o> wrote: |
3 |
|
4 |
> On 02/17/2015 10:42 AM, Brian Dolbec wrote: |
5 |
> > |
6 |
> > overall, there is no way I know the code well enough to know if you |
7 |
> > screwed up. But the code looks decent, so... |
8 |
> > |
9 |
> > My only questions are: |
10 |
> > |
11 |
> > pym/portage/dbapi/bintree.py: |
12 |
> > |
13 |
> > You removed several functions from the binarytree class and |
14 |
> > essentially reduced prevent_collision to a warning message. Can |
15 |
> > you briefly say why they are not needed please. |
16 |
> |
17 |
> Okay, I'll include this info in an updated patch: |
18 |
> |
19 |
|
20 |
Actually, I think this one patch could be split into a few logical |
21 |
ones. Tag them |
22 |
|
23 |
binpkg-multi-instance 1 of... |
24 |
|
25 |
in the commit message so it is clear they |
26 |
belong together. That way the commit messages can more clearly be |
27 |
relevant to the file(s) changed. |
28 |
|
29 |
The commit message is already a short story in length ;) before adding |
30 |
these new explanations. |
31 |
|
32 |
|
33 |
> _pkgindex_cpv_map_latest_build: |
34 |
> |
35 |
> This is what binhost clients running older versions of portage will |
36 |
> use to select to select the latest builds when their binhost server |
37 |
> switches to FEATURES=binpkg-multi-instance. New portage won't need |
38 |
> this anymore because it is capable of examining multiple builds and |
39 |
> it uses sorting to ensure that the latest builds are preferred when |
40 |
> appropriate. |
41 |
> |
42 |
> _remove_symlink, _create_symlink, prevent_collision, _move_to_all, and |
43 |
> _move_from_all: |
44 |
> |
45 |
> These are all related to the oldest PKGDIR layout, which put all of |
46 |
> the tbz2 files in $PKGDIR/All, and created symlinks to them in the |
47 |
> category directories. The $PKGDIR/All layout should be practically |
48 |
> extinct by now. New portage recognizes all existing layouts, or |
49 |
> mixtures of them, and uses the old packages in place. It never puts |
50 |
> new packages in $PKGDIR/All, so there's no need to move packages |
51 |
> around to prevent file name collisions between packages from |
52 |
> different categories. It also only uses regular files (any symlinks |
53 |
> are ignored). |
54 |
> |
55 |
> > _populate() ==> it is some 500+ LOC nasty. From what I can see |
56 |
> > I think you added slightly more loc than you deleted/changed. |
57 |
> > While I don't expect a breakup of this function to be directly a |
58 |
> > part of this commit. |
59 |
> > |
60 |
> > IT IS BADLY NEEDED. |
61 |
> > |
62 |
> > I'd like to see this function properly split into pieces and act |
63 |
> > as a driver for the smaller tasks. Currently it is a mess of nested |
64 |
> > if/else, for,... that is extremely difficult to keep straight and |
65 |
> > make logic changes to. It's almost as bad as repomans 1000+ LOC |
66 |
> > main loop. Why "if TRUE:" <== just fix the indent... At the |
67 |
> > same time, I noticed _ensure_dirs, _file_permissions functions |
68 |
> > defined in that class. Shouldn't these just be util functions |
69 |
> > available everywhere. |
70 |
> |
71 |
> Yeah, I will work on cleaning that up, and submit it as a separate |
72 |
> patch. |
73 |
> |
74 |
> > |
75 |
> > |
76 |
> > pym/portage/versions.py |
77 |
> > |
78 |
> > class _pkg_str(_unicode) |
79 |
> > |
80 |
> > in __init__() |
81 |
> > |
82 |
> > if build_time is not None: |
83 |
> > try: |
84 |
> > build_time = long(build_time) |
85 |
> > except ValueError: |
86 |
> > if build_time: |
87 |
> > build_time = -1 |
88 |
> > else: |
89 |
> > build_time = 0 |
90 |
> > if build_id is not None: |
91 |
> > try: |
92 |
> > build_id = long(build_id) |
93 |
> > except ValueError: |
94 |
> > if build_id: |
95 |
> > build_id = -1 |
96 |
> > else: |
97 |
> > build_id = None |
98 |
> > if file_size is not None: |
99 |
> > try: |
100 |
> > file_size = long(file_size) |
101 |
> > except ValueError: |
102 |
> > if file_size: |
103 |
> > file_size = -1 |
104 |
> > else: |
105 |
> > file_size = None |
106 |
> > if mtime is not None: |
107 |
> > try: |
108 |
> > mtime = long(mtime) |
109 |
> > except ValueError: |
110 |
> > if mtime: |
111 |
> > mtime = -1 |
112 |
> > else: |
113 |
> > mtime = None |
114 |
> > |
115 |
> > |
116 |
> > I hate repeating code. This can be done using one universal small |
117 |
> > function and will clean up the __init__() |
118 |
> > |
119 |
> > @static_method |
120 |
> > def _long(var, default): |
121 |
> > if var is not None: |
122 |
> > try: |
123 |
> > var = long(var) |
124 |
> > except ValueError: |
125 |
> > if var: |
126 |
> > var = -1 |
127 |
> > else: |
128 |
> > var = default |
129 |
> > return var |
130 |
> |
131 |
> Okay, I'll do that and post the updated patch. |
132 |
|
133 |
|
134 |
|
135 |
-- |
136 |
Brian Dolbec <dolsen> |