Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Re: Bugzilla Bug 112779: New and Improved Way to Handle /etc/portage
Date: Fri, 18 Nov 2005 15:02:49
Message-Id: 20051118150138.GD2704@nightcrawler
In Reply to: Re: [gentoo-portage-dev] Re: Bugzilla Bug 112779: New and Improved Way to Handle /etc/portage by Zac Medico
1 On Thu, Nov 17, 2005 at 07:36:05PM -0800, Zac Medico wrote:
2 > Okay, I wrote a small patch that handles everything supported by
3 > /etc/portage except bashrc (package.mask, package.unmask, package.keywords,
4 > package.use, mirrors, categories). I tested it by moving
5 > /etc/portage/package* into /etc/portage/includes/test/ and it seems to have
6 > behaved expectedly. Feedback is welcome and appreciated. ;)
7
8 Feedback? Well, I don't like it mainly. :)
9
10 This makes portage go looking in two different locations for
11 overrides; I know from looking through the code,
12 /etc/portage/package.* overrides the includes, but users won't.
13
14 Configuration in two seperate locations of the same thing is usually a
15 bad idea (exempting global configuration, user configuration, which
16 this is not). It's not intuitive, mainly.
17
18 I'd argue for extending the existing files syntax rather then this
19 tbh, tag in a source command makes a bit more sense to me.
20
21 Plus side, with a source command, you just comment it out and you've
22 disabled that import. With your solution, have to remove the file
23 from the directory.
24
25
26 > Index: pym/portage_util.py
27 > ===================================================================
28 > --- pym/portage_util.py (revision 2314)
29 > +++ pym/portage_util.py (working copy)
30 > @@ -463,3 +463,12 @@
31 > writemsg(line, noiselevel=1)
32 > writemsg("Please file a bug for %s\n" % sys.argv[0], noiselevel=1)
33 > writemsg("====================================\n\n", noiselevel=1)
34 > +
35 > +def subdir_paths(parent):
36 > + full_paths=[]
37 > + if os.path.exists(parent) and os.path.isdir(parent):
38 > + for x in os.listdir(parent):
39 > + full_path=os.path.join(parent,x)
40 > + if os.path.isdir(full_path):
41 > + full_paths.append(full_path)
42 > + return full_paths
43
44 Why the additional function when filter/for loop + listdir handles
45 this already? You're sidestepping the stat caching via this, which
46 potentially isn't a horrid thing (don't like (cache|list)dir
47 personally), but it seems unintended.
48
49 Additionally...
50 mkdir d && ln -s d d2 && python -c'import os;print os.path.isdir("d2")'
51
52 os.path.isdir doesn't discern between symlinks targetting a dir, and a
53 dir, so
54 mkdir -p a/b/ && ln -sf ../../ a/b/c
55
56 Will induce a cycle, and this code will shoot right on through till
57 either it hits a sys limit (path length), or runs out of memory.
58
59 ~harring

Replies