commit:     8293c7223f748dab6a1fd1faade3b3ea6183ce86
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 28 17:43:22 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Aug 28 21:59:45 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8293c722

updater.py: Adds repos.conf module plug-in

In order to allow users to migrate/incorporate their config file to
a repos.conf config file, the repos.conf plug-in has been added when
creating the repos.conf to write all overlays to the config file.

---
 layman/updater.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index aa5f82e..874e3c3 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -175,7 +175,13 @@ class Main(object):
 
     def create_repos_conf(self):
         self.output.info("  Creating layman's repos.conf file")
-        # create layman's %(repos_conf)
-        # so layman won't error.
-        with fileopen(self.config['repos_conf'], 'w') as repos_conf:
-            repos_conf.write('')
+        layman_inst = LaymanAPI(config=self.config)
+        overlays = {}
+        for ovl in layman_inst.get_installed():
+            overlays[ovl] = layman_inst._get_installed_db().select(ovl)
+        # create layman's %(repos_conf) so layman
+        # 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.write()

Reply via email to