Gentoo Archives: gentoo-commits

From: Devan Franchini <twitch153@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
Date: Thu, 28 Aug 2014 22:01:53
Message-Id: 1409247380.1bf062247723f546500c59f60c8869c1b30a4e23.twitch153@gentoo
1 commit: 1bf062247723f546500c59f60c8869c1b30a4e23
2 Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 28 17:36:20 2014 +0000
4 Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 28 17:36:20 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=1bf06224
7
8 reposconf.py: Adds check to write all ovelays to blank file
9
10 If a user has a blank repos.conf file then a check should be
11 make to ensure that the user has all his/her installed overlays
12 written to that repos.conf file.
13
14 ---
15 layman/config_modules/reposconf/reposconf.py | 10 ++++++++--
16 1 file changed, 8 insertions(+), 2 deletions(-)
17
18 diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
19 index 344c779..864e86b 100644
20 --- a/layman/config_modules/reposconf/reposconf.py
21 +++ b/layman/config_modules/reposconf/reposconf.py
22 @@ -109,7 +109,7 @@ class ConfigHandler:
23 '''
24 self.repo_conf.remove_section(overlay.name)
25
26 - return self.write()
27 + return self.write(delete=overlay.name)
28
29
30 def disable(self, overlay):
31 @@ -162,7 +162,7 @@ class ConfigHandler:
32 return self.write()
33
34
35 - def write(self, disable=None):
36 + def write(self, delete=None, disable=None):
37 '''
38 Writes changes from ConfigParser to /etc/portage/repos.conf/layman.conf.
39
40 @@ -171,6 +171,12 @@ class ConfigHandler:
41 '''
42 try:
43 with fileopen(self.path, 'w') as laymanconf:
44 + # If the repos.conf is empty check to see if we can write
45 + # all the overlays to the file.
46 + if not self.repo_conf.sections():
47 + for i in self.overlays:
48 + if not i == delete:
49 + self.add(self.overlays[i])
50 self.repo_conf.write(laymanconf)
51 if disable:
52 # comments out section header of the overlay.