1 |
commit: 45c2514156d641c00b9bbefa8ac018d34b8c2024 |
2 |
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 25 00:34:19 2014 +0000 |
4 |
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 26 17:29:25 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=45c25141 |
7 |
|
8 |
makeconf.py: Ensures disable/enable compatibility |
9 |
|
10 |
To reflect the ability to disable or enable an overlay, makeconf.py |
11 |
needed to be able to go from the old style make.conf file to the |
12 |
new style automatically when layman wrote to the make.conf. |
13 |
|
14 |
--- |
15 |
layman/config_modules/makeconf/makeconf.py | 17 ++++++++++++----- |
16 |
1 file changed, 12 insertions(+), 5 deletions(-) |
17 |
|
18 |
diff --git a/layman/config_modules/makeconf/makeconf.py b/layman/config_modules/makeconf/makeconf.py |
19 |
index 140e694..6a6890c 100644 |
20 |
--- a/layman/config_modules/makeconf/makeconf.py |
21 |
+++ b/layman/config_modules/makeconf/makeconf.py |
22 |
@@ -235,20 +235,23 @@ class ConfigHandler: |
23 |
if i.strip()] |
24 |
|
25 |
for i in (disabled_overlays, enabled_overlays, overlays): |
26 |
- for o in i: |
27 |
+ for o in (i or []): |
28 |
if o[:len(self.storage)] == self.storage: |
29 |
oname = os.path.basename(o) |
30 |
if oname in self.db.keys(): |
31 |
if i == disabled_overlays: |
32 |
- self.disabled.append(path([self.storage, oname])) |
33 |
+ self.disabled.append(path([self.storage, |
34 |
+ oname])) |
35 |
self.overlays.append(self.db[oname]) |
36 |
else: |
37 |
# These are additional overlays that we dont know |
38 |
- # anything about. The user probably added them manually |
39 |
+ # know anything about. The user probably added |
40 |
+ # them manually. |
41 |
self.extra.append(o) |
42 |
else: |
43 |
- # These are additional overlays that we dont know anything |
44 |
- # about. The user probably added them manually |
45 |
+ # These are additional overlays that we dont know |
46 |
+ # anything about. The user probably added them |
47 |
+ # manually. |
48 |
self.extra.append(o) |
49 |
|
50 |
else: |
51 |
@@ -346,6 +349,10 @@ class ConfigHandler: |
52 |
overlays += '\n'.join(self.extra) |
53 |
overlays += '"' |
54 |
|
55 |
+ if not re.search('ENABLED=', self.data): |
56 |
+ self.data = '\n'.join((enabled_overlays, disabled_overlays, |
57 |
+ overlays)) |
58 |
+ |
59 |
enabled_content = self.my_enabled_re.sub(enabled_overlays, self.data) |
60 |
disabled_content = self.my_disabled_re.sub(disabled_overlays, enabled_content) |
61 |
content = self.my_portdir_re.sub(overlays, disabled_content) |