]> git.ipfire.org Git - pakfire.git/commitdiff
config: Add get_repos() to get all repository definitions
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 3 Dec 2016 14:01:59 +0000 (15:01 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 3 Dec 2016 14:01:59 +0000 (15:01 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/config.py

index 530397f09be28b1c18fb31ea41090dca1218ff68..01227f6605db2f6b793ac627edb7d4b9559b0ca1 100644 (file)
@@ -91,6 +91,19 @@ class Config(object):
 
                                log.debug("    %-20s: %s" % (option, value))
 
+       def get_repos(self):
+               repos = []
+               for section in self._config.sections():
+                       if not section.startswith("repo:"):
+                               continue
+
+                       name = section[5:]
+
+                       repo = self._config.items(section)
+                       repos.append((name, dict(repo)))
+
+               return repos
+
 
 # Read initial configuration
 config = Config("general.conf")