Gentoo Archives: gentoo-dev

From: "Gregory M. Turner" <gmt@×××××.us>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] cygwin prefix patch: request for eyeballs
Date: Tue, 27 Mar 2012 06:41:11
Message-Id: c16ca798-cec1-4f52-af8f-396e669101ae@malth.us
In Reply to: Re: [gentoo-dev] cygwin prefix patch: request for eyeballs by Alec Warner
1 ----- Original Message -----
2 > On Mon, Mar 26, 2012 at 4:12 PM, Gregory M. Turner <gmt@×××××.us>
3 > wrote:
4 > > https://github.com/gmt/gmt-cygwin-overlay/blob/master/sys-apps/portage/files/portage-2.2.01.20271-cygdll_protect.patch
5
6 > Consistency in the style would be nice.
7 >
8 > For instance in cygdll-update:
9 >
10 > # Here you have spaces after the $( and before the )
11 > extra_protection="$( portageq cygdll_protect_list ${EROOT} )"
12 >
13 > # Later on you don't put spaces...
14 > eval $(portageq envvar -v CYGDLL_PROTECT PORTAGE_HOSTNAME \
15 > + PORTAGE_CONFIGROOT PORTAGE_INST_GID PORTAGE_INST_UID \
16 > + PORTAGE_TMPDIR EROOT USERLAND)
17
18 yes, good point, (the latter is cut-and-paste from etc-update, the former my own; I do that habitually as a way to avoid learning how tokenization works in bash :)
19
20 > Assuming $PORTAGE_BASH is always bash, you should use [[ consistently
21 > in your bash.
22
23 vs. "["? That sounds like cut-paste from etc-update again -- it seems to have been coded with sh support in mind. Don't think that matters for cygwin (in fact it'd better not, the way I coded it), so, well spotted, I'll fix it.
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 Got me there -- I'm a getopts ignoramus.
29
30 > Onto the python:
31 >
32 > if os.environ.__contains__("PORTAGE_PYTHONPATH"):
33 >
34 > Any reason why
35 > if "PORTAGE_PYTHONPATH" not in os.environ:
36 > was not used?
37
38 indeed, couldn't I just use 'if not os.environ["PORTAGE_PYTONPATH"]:' (if the python executable were "False" or "0" would something stupid happen?)? Also cut-paste from portage, but I did notice it, and had the exact same question. After my initial, unprintable reaction :)
39
40 Maybe the answer is buried somewhere in the docs ... afaik in 2.7, "x in foo" <=> "foo.__contains__(x)" (?). Guess I'd need to double check 2.7 and 3.2 docs as well to be sure.
41
42 One idea: maybe meant as future-proofing against security bugs that could open up in future pythons. I'll try to find blame (or whatever they call that in cvs) on this line of code, maybe we can ask the culprit himself.
43
44 > Python functions are not perl, don't pass 'argv' to the function.
45 >
46 > If the function takes to arguments, it should be:
47 >
48 > def func1(arg1, arg2)
49 > If some of the args have defaults:
50 > def func1(arg1, arg2=5)
51
52 Hm, are you looking at bin/portage_master_lock when you mention this? It's cut-and-paste from portageq (starting to see a pattern yet? :) )
53
54 > I've never seen anyone use <> before; I didn't even know it existed.
55 > Most folks use !=.
56
57 Sounds right, I'll seek and destroy.
58
59 > I can't really imagine why people do stuff like share
60 > /var/lib/portage
61 > across machines, so adding a bunch of complexity just to make it work
62 > seems nuts to me. That being said I have not worked on portage in
63 > years and Zac seems happier to support weird use cases.
64
65 Yikes, that's a pretty good critique, I'm afraid. Almost painful to read :)
66
67 I decided to go ahead and implement this first, because I've seen some real-world file-sharing setups serving cygwin to clusters of development workstations, and secondly, because the consensus on #gentoo-portage was that this was a supported use-case.
68
69 Anyhow, seeing as how I already implemented it, it's too late for me to decide that it's too much work :)
70
71 In my defense, I thought it would be way less involved and it just kinda feature-creep'ed up on me. By the time I figured out what a monster I'd created I was kinda pot-stuck.
72
73 -gmt

Replies

Subject Author
Re: [gentoo-dev] cygwin prefix patch: request for eyeballs Alec Warner <antarus@g.o>