Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/grss:master commit in: grs/
Date: Sun, 05 Jul 2015 16:49:14
Message-Id: 1436115093.7ef9c7af8d8043d659ff5024ed4f09725a0d4c77.blueness@gentoo
1 commit: 7ef9c7af8d8043d659ff5024ed4f09725a0d4c77
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 5 16:51:33 2015 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 5 16:51:33 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=7ef9c7af
7
8 grs/WorldConf.py: cleanup for new world.conf structure.
9
10 grs/WorldConf.py | 30 +++++++++---------------------
11 1 file changed, 9 insertions(+), 21 deletions(-)
12
13 diff --git a/grs/WorldConf.py b/grs/WorldConf.py
14 index f20609b..f9eefe8 100644
15 --- a/grs/WorldConf.py
16 +++ b/grs/WorldConf.py
17 @@ -14,31 +14,20 @@ class WorldConf():
18 """
19
20 @staticmethod
21 - def conf2file(config, s, portage_confdir):
22 - """ doc here
23 - more doc
24 - """
25 - try:
26 - for (f, v) in config[s].items():
27 - filepath = os.path.join(portage_confdir, f)
28 - dirpath = os.path.dirname(filepath)
29 - os.makedirs(dirpath, mode=0o755, exist_ok=True)
30 - with open(filepath, 'w') as g:
31 - g.write('%s\n' % v)
32 - except KeyError:
33 - pass
34 -
35 -
36 - @staticmethod
37 def install():
38 """ doc here
39 more doc
40 """
41 config = configparser.RawConfigParser(delimiters=':', allow_no_value=True, comment_prefixes=None)
42 config.read(CONST.WORLD_CONFIG)
43 -
44 for s in config.sections():
45 - WorldConf.conf2file(config, s, portage_confdir=CONST.PORTAGE_CONFIGDIR)
46 + for (directory, value) in config[s].items():
47 + p_slot_atom = re.sub('[/:]', '_', s)
48 + fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, '%s/%s' % (directory, p_slot_atom))
49 + dpath = os.path.dirname(fpath)
50 + os.makedirs(dpath, mode=0o755, exist_ok=True)
51 + with open(fpath, 'w') as g:
52 + g.write('%s\n' % value)
53
54
55 @staticmethod
56 @@ -71,12 +60,11 @@ class WorldConf():
57 # Only look at select files and directories.
58 # TODO: This needs to be expanded.
59 if not os.path.basename(dirpath) in ['env', 'package.env', \
60 - 'package.accept_keywords', 'package.use', 'package.mask', \
61 - 'package.unmask']:
62 + 'package.accept_keywords', 'package.use', \
63 + 'package.mask', 'package.unmask']:
64 continue
65
66 for f in filenames:
67 fpath = os.path.realpath(os.path.join(dirpath, f))
68 if f in slot_atoms:
69 os.remove(fpath)
70 - continue