commit: 45c2514156d641c00b9bbefa8ac018d34b8c2024
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 25 00:34:19 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Aug 26 17:29:25 2014 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=45c25141
makeconf.py: Ensures disable/enable compatibility
To reflect the ability to disable or enable an overlay, makeconf.py
needed to be able to go from the old style make.conf file to the
new style automatically when layman wrote to the make.conf.
---
layman/config_modules/makeconf/makeconf.py | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/layman/config_modules/makeconf/makeconf.py
b/layman/config_modules/makeconf/makeconf.py
index 140e694..6a6890c 100644
--- a/layman/config_modules/makeconf/makeconf.py
+++ b/layman/config_modules/makeconf/makeconf.py
@@ -235,20 +235,23 @@ class ConfigHandler:
if i.strip()]
for i in (disabled_overlays, enabled_overlays, overlays):
- for o in i:
+ for o in (i or []):
if o[:len(self.storage)] == self.storage:
oname = os.path.basename(o)
if oname in self.db.keys():
if i == disabled_overlays:
- self.disabled.append(path([self.storage,
oname]))
+ self.disabled.append(path([self.storage,
+ oname]))
self.overlays.append(self.db[oname])
else:
# These are additional overlays that we dont know
- # anything about. The user probably added them
manually
+ # know anything about. The user probably added
+ # them manually.
self.extra.append(o)
else:
- # These are additional overlays that we dont know
anything
- # about. The user probably added them manually
+ # These are additional overlays that we dont know
+ # anything about. The user probably added them
+ # manually.
self.extra.append(o)
else:
@@ -346,6 +349,10 @@ class ConfigHandler:
overlays += '\n'.join(self.extra)
overlays += '"'
+ if not re.search('ENABLED=', self.data):
+ self.data = '\n'.join((enabled_overlays, disabled_overlays,
+ overlays))
+
enabled_content = self.my_enabled_re.sub(enabled_overlays, self.data)
disabled_content = self.my_disabled_re.sub(disabled_overlays,
enabled_content)
content = self.my_portdir_re.sub(overlays, disabled_content)