1 |
On Mon, Mar 26, 2012 at 4:12 PM, Gregory M. Turner <gmt@×××××.us> wrote: |
2 |
> Hello, I would appreciate if those of you with portage development experience and a moment to spare could please take a look at: |
3 |
> |
4 |
> https://github.com/gmt/gmt-cygwin-overlay/blob/master/sys-apps/portage/files/portage-2.2.01.20271-cygdll_protect.patch |
5 |
> |
6 |
> Not gunning for upstream or anything, but I would eventually like to start moving towards "not a complete pile of crap" status :) |
7 |
> |
8 |
> Notes: |
9 |
|
10 |
Consistency in the style would be nice. |
11 |
|
12 |
For instance in cygdll-update: |
13 |
|
14 |
# Here you have spaces after the $( and before the ) |
15 |
extra_protection="$( portageq cygdll_protect_list ${EROOT} )" |
16 |
|
17 |
# Later on you don't put spaces... |
18 |
eval $(portageq envvar -v CYGDLL_PROTECT PORTAGE_HOSTNAME \ |
19 |
+ PORTAGE_CONFIGROOT PORTAGE_INST_GID PORTAGE_INST_UID \ |
20 |
+ PORTAGE_TMPDIR EROOT USERLAND) |
21 |
|
22 |
Assuming $PORTAGE_BASH is always bash, you should use [[ consistently |
23 |
in your bash. |
24 |
|
25 |
IMHO it is a common mistake to write your own argument processing, is |
26 |
there a reason getops is not appropriate (portability?) |
27 |
|
28 |
Onto the python: |
29 |
|
30 |
if os.environ.__contains__("PORTAGE_PYTHONPATH"): |
31 |
|
32 |
Any reason why |
33 |
if "PORTAGE_PYTHONPATH" not in os.environ: |
34 |
was not used? |
35 |
|
36 |
Python functions are not perl, don't pass 'argv' to the function. |
37 |
|
38 |
If the function takes to arguments, it should be: |
39 |
|
40 |
def func1(arg1, arg2) |
41 |
If some of the args have defaults: |
42 |
def func1(arg1, arg2=5) |
43 |
|
44 |
> |
45 |
> o based against a-few-weeks-old rsync prefix-portage |
46 |
> |
47 |
> o may contain a very few hunks that should arguably go |
48 |
> upstream--I will make bugs for them and they are not |
49 |
> what (I feel) needs eyeballs. |
50 |
> |
51 |
> o trying to actually run this may be difficult. let me |
52 |
> know where you're stuck and I'll try to help. |
53 |
> |
54 |
> o I must admit, I pretty much learned python as I went, |
55 |
> so... if you are thinking "that looks like a total |
56 |
> rookie mistake" it probably is, and I'd probably |
57 |
> appreciate your constructive critique. |
58 |
|
59 |
I've never seen anyone use <> before; I didn't even know it existed. |
60 |
Most folks use !=. |
61 |
|
62 |
I can't really imagine why people do stuff like share /var/lib/portage |
63 |
across machines, so adding a bunch of complexity just to make it work |
64 |
seems nuts to me. That being said I have not worked on portage in |
65 |
years and Zac seems happier to support weird use cases. |
66 |
|
67 |
> |
68 |
> o I'll probably keep hacking on this so... moving target. |
69 |
> But it's mostly working, I think. |
70 |
> |
71 |
> o This doesn't make any big changes to upstream code. So, |
72 |
> If it looks like it might be a big indentation change, |
73 |
> it probably is. |
74 |
> |
75 |
> o this is to solve the problem that, in cygwin, a running python |
76 |
> crashes as soon as you change any filesystem .dll's on which |
77 |
> it depends and fork() -- this is semi-orthogonal to the |
78 |
> typical cygwin "rebasing" problem and distinct from it. |
79 |
> The problem has nothing to do with locked files (except |
80 |
> that my solution does use some standard portage file- |
81 |
> locking features). |
82 |
> |
83 |
> -gmt |
84 |
> |