Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@×××××.com>
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:24:43
Message-Id: 437DF1EA.5000108@gmail.com
In Reply to: Re: [gentoo-portage-dev] Re: Bugzilla Bug 112779: New and Improved Way to Handle /etc/portage by Brian Harring
1 Brian Harring wrote:
2 > This makes portage go looking in two different locations for
3 > overrides; I know from looking through the code,
4 > /etc/portage/package.* overrides the includes, but users won't.
5
6 This behavior could be documented and possibly configurable.
7
8 >
9 > Configuration in two seperate locations of the same thing is usually a
10 > bad idea (exempting global configuration, user configuration, which
11 > this is not). It's not intuitive, mainly.
12 >
13
14 The idea behind my patch was something akin to /etc/env.d, where it's easy to yank things in and out in groups. That makes it easy for tools (unmasking and what else?) to make "transactional" changes, in a sense.
15
16 > I'd argue for extending the existing files syntax rather then this
17 > tbh, tag in a source command makes a bit more sense to me.
18 >
19 > Plus side, with a source command, you just comment it out and you've
20 > disabled that import. With your solution, have to remove the file
21 > from the directory.
22 >
23
24 Rather than remove a directory, you could simpley move it into another directory (easy for tools to handle).
25
26 >
27 >
28 >>Index: pym/portage_util.py
29 >>===================================================================
30 >>--- pym/portage_util.py (revision 2314)
31 >>+++ pym/portage_util.py (working copy)
32 >>@@ -463,3 +463,12 @@
33 >> writemsg(line, noiselevel=1)
34 >> writemsg("Please file a bug for %s\n" % sys.argv[0], noiselevel=1)
35 >> writemsg("====================================\n\n", noiselevel=1)
36 >>+
37 >>+def subdir_paths(parent):
38 >>+ full_paths=[]
39 >>+ if os.path.exists(parent) and os.path.isdir(parent):
40 >>+ for x in os.listdir(parent):
41 >>+ full_path=os.path.join(parent,x)
42 >>+ if os.path.isdir(full_path):
43 >>+ full_paths.append(full_path)
44 >>+ return full_paths
45 >
46 >
47 > Why the additional function when filter/for loop + listdir handles
48 > this already? You're sidestepping the stat caching via this, which
49 > potentially isn't a horrid thing (don't like (cache|list)dir
50 > personally), but it seems unintended.
51 >
52 > Additionally...
53 > mkdir d && ln -s d d2 && python -c'import os;print os.path.isdir("d2")'
54 >
55 > os.path.isdir doesn't discern between symlinks targetting a dir, and a
56 > dir, so
57 > mkdir -p a/b/ && ln -sf ../../ a/b/c
58 >
59 > Will induce a cycle, and this code will shoot right on through till
60 > either it hits a sys limit (path length), or runs out of memory.
61 >
62
63 Good points. I have to admit that I did not put much thought into that function. Like Jason said, the paths should be sorted. It certainly needs improvement. :)
64
65 Zac
66 --
67 gentoo-portage-dev@g.o mailing list

Replies