1 |
commit: 4ca8d87b69a8552da9e6ad575d831e6c9dab2e2b |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 5 12:43:08 2015 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 5 12:43:08 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=4ca8d87b |
7 |
|
8 |
make-worldconf: search package.{,un}mask |
9 |
|
10 |
make-worldconf | 30 ++++++++++++++++++++---------- |
11 |
1 file changed, 20 insertions(+), 10 deletions(-) |
12 |
|
13 |
diff --git a/make-worldconf b/make-worldconf |
14 |
index 09de316..9f27266 100755 |
15 |
--- a/make-worldconf |
16 |
+++ b/make-worldconf |
17 |
@@ -89,21 +89,27 @@ def keywords(config, p): |
18 |
|
19 |
|
20 |
def envvars(config, p): |
21 |
- try: |
22 |
- fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, 'package.env') |
23 |
+ fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, 'package.env') |
24 |
+ if os.path.isfile(fpath): |
25 |
with open(fpath, 'r') as g: |
26 |
for l in g.readlines(): |
27 |
# This matching needs to be made more strick. |
28 |
if re.search('%s' % re.escape(p.cpv_split[1]), l): |
29 |
- config[p.slot_atom]['+package.env'] = '%s %s' % (p.slot_atom, |
30 |
- re.sub('[/:]', '_', p.slot_atom)) |
31 |
+ p_slot_atom = re.sub('[/:]', '_', p.slot_atom) |
32 |
+ config[p.slot_atom]['+package.env'] = '%s %s' % (p.slot_atom, p_slot_atom) |
33 |
m = re.search('(\S+)\s+(\S+)', l) |
34 |
env_file = os.path.join(CONST.PORTAGE_CONFIGDIR, 'env') |
35 |
env_file = os.path.join(env_file, m.group(2)) |
36 |
with open(env_file, 'r') as h: |
37 |
- config[p.slot_atom]['env/%s' % re.sub('[/:]', '_', p.slot_atom)] = h.read() |
38 |
- except FileNotFoundError: |
39 |
- pass |
40 |
+ config[p.slot_atom]['env/%s' % p_slot_atom] = h.read() |
41 |
+ |
42 |
+ |
43 |
+def others(config, p, subdir): |
44 |
+ rpath = '%s/%s' % (subdir, re.sub('[/:]', '_', p.slot_atom)) |
45 |
+ fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, rpath) |
46 |
+ if os.path.isile(fpath): |
47 |
+ with open(fpath, 'r') as g: |
48 |
+ config[p.slot_atom][rpath] = g.read() |
49 |
|
50 |
|
51 |
def main(): |
52 |
@@ -127,15 +133,19 @@ def main(): |
53 |
except AttributeError: |
54 |
continue |
55 |
|
56 |
- # Populate package.use |
57 |
+ # Populate package.use - these are read out of p |
58 |
useflags(config, p) |
59 |
|
60 |
- # Populate package.accept_keywords |
61 |
+ # Populate package.accept_keywords - these are read out of p |
62 |
keywords(config, p) |
63 |
|
64 |
- # Populate package.env and env/* |
65 |
+ # Populate package.env and env/* - these are read out of /etc/portage |
66 |
envvars(config, p) |
67 |
|
68 |
+ # Others - these are read out of /etc/portage |
69 |
+ others(config, p, 'package.mask') |
70 |
+ others(config, p, 'package.unmask') |
71 |
+ |
72 |
# Remove any empty sections |
73 |
if config[p.slot_atom] == {}: |
74 |
config.remove_section(p.slot_atom) |