[gentoo-commits] proj/layman:master commit in: layman/, layman/config_modules/reposconf/

2016-04-30 Thread Devan Franchini
commit: 6f4d6dc0552b1bad10f8953de786cf0e78d975ee
Author: Devan Franchini  gentoo  org>
AuthorDate: Sat Apr 30 22:08:12 2016 +
Commit: Devan Franchini  gentoo  org>
CommitDate: Sat Apr 30 22:18:41 2016 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=6f4d6dc0

Repairs layman-updater rebuild functionality

reposconf.py: Adds rebuild __init__ parameter to fix rebuild
functionality
updater.py: Sets rebuild parameter for repos.conf ConfigHandler class

 layman/config_modules/reposconf/reposconf.py | 9 +
 layman/updater.py| 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py 
b/layman/config_modules/reposconf/reposconf.py
index 1f0fd04..79991c9 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -53,7 +53,7 @@ def check_conf_path(conf_path):
 
 class ConfigHandler:
 
-def __init__(self, config, overlays):
+def __init__(self, config, overlays, rebuild=False):
 
 self.config = config
 self.output = config['output']
@@ -61,7 +61,7 @@ class ConfigHandler:
 self.path = check_conf_path(config['repos_conf'])
 self.storage = config['storage']
 self.repo_config = None
-self.rebuild = False
+self.rebuild = rebuild
 
 self.read()
 
@@ -193,14 +193,15 @@ class ConfigHandler:
 if self.rebuild:
 # start over with a fresh instance
 self.repo_conf = ConfigParser.ConfigParser()
-if not self.repo_conf.sections():
+for i in sorted(self.overlays):
+self.add(self.overlays[i], no_write=True)
+if not self.repo_conf.sections() and not self.rebuild:
 if ('disable' in self.config.keys() and not
 self.config['disable'][0].lower() == 'all'):
 for i in sorted(self.overlays):
 if not i == delete:
 self.add(self.overlays[i], no_write=True)
 self.repo_conf.write(laymanconf)
-self.rebuild = False
 return True
 except IOError as error:
 self.output.error('ReposConf: ConfigHandler.write(); Failed to 
write "'\

diff --git a/layman/updater.py b/layman/updater.py
index 6384429..2bfc241 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -273,7 +273,7 @@ class Main(object):
 # can write the overlays to it.
 open(self.config['repos_conf'], 'w').close()
 from layman.config_modules.reposconf.reposconf import ConfigHandler
-repos_conf = ConfigHandler(self.config, overlays)
+repos_conf = ConfigHandler(self.config, overlays, rebuild=True)
 repos_conf.write()
 
 



[gentoo-commits] proj/layman:master commit in: layman/, layman/config_modules/reposconf/

2014-08-15 Thread Devan Franchini
commit: 34fd5c98fbd9674b6197327cca5c1ef5b26854d6
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Fri Aug 15 20:28:33 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Aug 15 22:20:49 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=34fd5c98

reposconf.py: Converts to config plug-in module

---
 layman/config_modules/reposconf/__init__.py| 29 ++
 layman/{ = config_modules/reposconf}/reposconf.py |  0
 2 files changed, 29 insertions(+)

diff --git a/layman/config_modules/reposconf/__init__.py 
b/layman/config_modules/reposconf/__init__.py
new file mode 100644
index 000..f8f69bc
--- /dev/null
+++ b/layman/config_modules/reposconf/__init__.py
@@ -0,0 +1,29 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+'''
+Reposconf plug-in module for layman.
+'''
+
+module_spec = {
+'name': 'reposconf',
+'description': __doc__,
+'provides':{
+'reposconf-module': {
+'name': 'reposconf',
+'class': 'ConfigHandler',
+'description': __doc__,
+'functions': ['add', 'delete', 'disable', 'enable', 'read',
+  'update', 'write'],
+'func_desc': {
+'add': 'Adds overlay information to config',
+'delete': 'Removes overlay information from config',
+'disable': 'Comments out specific overlay config entry',
+'enable': 'Uncomments specific overlay config entry',
+'read': 'Reads the config file',
+'update': 'Updates the source URL for the specified overlay',
+'write': 'Writes the overlay information to the config',
+},
+}
+}
+}

diff --git a/layman/reposconf.py b/layman/config_modules/reposconf/reposconf.py
similarity index 100%
rename from layman/reposconf.py
rename to layman/config_modules/reposconf/reposconf.py