commit: 4ca8d87b69a8552da9e6ad575d831e6c9dab2e2b
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 5 12:43:08 2015 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jul 5 12:43:08 2015 +0000
URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=4ca8d87b
make-worldconf: search package.{,un}mask
make-worldconf | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/make-worldconf b/make-worldconf
index 09de316..9f27266 100755
--- a/make-worldconf
+++ b/make-worldconf
@@ -89,21 +89,27 @@ def keywords(config, p):
def envvars(config, p):
- try:
- fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, 'package.env')
+ fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, 'package.env')
+ if os.path.isfile(fpath):
with open(fpath, 'r') as g:
for l in g.readlines():
# This matching needs to be made more strick.
if re.search('%s' % re.escape(p.cpv_split[1]), l):
- config[p.slot_atom]['+package.env'] = '%s %s' %
(p.slot_atom,
- re.sub('[/:]', '_', p.slot_atom))
+ p_slot_atom = re.sub('[/:]', '_', p.slot_atom)
+ config[p.slot_atom]['+package.env'] = '%s %s' %
(p.slot_atom, p_slot_atom)
m = re.search('(\S+)\s+(\S+)', l)
env_file = os.path.join(CONST.PORTAGE_CONFIGDIR, 'env')
env_file = os.path.join(env_file, m.group(2))
with open(env_file, 'r') as h:
- config[p.slot_atom]['env/%s' % re.sub('[/:]', '_',
p.slot_atom)] = h.read()
- except FileNotFoundError:
- pass
+ config[p.slot_atom]['env/%s' % p_slot_atom] = h.read()
+
+
+def others(config, p, subdir):
+ rpath = '%s/%s' % (subdir, re.sub('[/:]', '_', p.slot_atom))
+ fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, rpath)
+ if os.path.isile(fpath):
+ with open(fpath, 'r') as g:
+ config[p.slot_atom][rpath] = g.read()
def main():
@@ -127,15 +133,19 @@ def main():
except AttributeError:
continue
- # Populate package.use
+ # Populate package.use - these are read out of p
useflags(config, p)
- # Populate package.accept_keywords
+ # Populate package.accept_keywords - these are read out of p
keywords(config, p)
- # Populate package.env and env/*
+ # Populate package.env and env/* - these are read out of /etc/portage
envvars(config, p)
+ # Others - these are read out of /etc/portage
+ others(config, p, 'package.mask')
+ others(config, p, 'package.unmask')
+
# Remove any empty sections
if config[p.slot_atom] == {}:
config.remove_section(p.slot_atom)