Include repo info in emerge --info
authorSebastian Luther <SebastianLuther@gmx.de>
Sun, 3 Oct 2010 17:54:23 +0000 (19:54 +0200)
committerZac Medico <zmedico@gentoo.org>
Sun, 3 Oct 2010 19:05:55 +0000 (12:05 -0700)
pym/_emerge/actions.py
pym/portage/repository/config.py

index 7b7114849006a0eced3f4e274a82afad41b0eea9..a5bb0e52cf9ccd68624838300643c2b01c3d7c3f 100644 (file)
@@ -1355,6 +1355,11 @@ def action_info(settings, trees, myopts, myfiles):
 
        libtool_vers = ",".join(trees["/"]["vartree"].dbapi.match("sys-devel/libtool"))
 
+       repos = portdb.settings.repositories
+       writemsg_stdout("Repositories:\n\n")
+       for repo in repos:
+               writemsg_stdout(repo.info_string())
+
        if "--verbose" in myopts:
                myvars = list(settings)
        else:
index 0e2507a8225de3ae77e6616e33ea125201b68f53..29116c176aa6d3d2225cf943eed91783f1cdf52b 100644 (file)
@@ -129,6 +129,31 @@ class RepoConfig(object):
                except EnvironmentError:
                        return "x-" + os.path.basename(repo_path), True
 
+       def info_string(self):
+               """
+               Returns a formatted string containing informations about the repository.
+               Used by emerge --info.
+               """
+               indent = " " * 4
+               repo_msg = []
+               repo_msg.append(self.name)
+               if self.format:
+                       repo_msg.append(indent + "format: " + self.format)
+               if self.user_location:
+                       repo_msg.append(indent + "location: " + self.user_location)
+               if self.sync:
+                       repo_msg.append(indent + "sync: " + self.sync)
+               if self.masters:
+                       repo_msg.append(indent + "masters: " + " ".join(master.name for master in self.masters))
+               if self.priority:
+                       repo_msg.append(indent + "priority: " + str(self.priority))
+               if self.aliases:
+                       repo_msg.append(indent + "aliases: " + self.aliases)
+               if self.eclass_overrides:
+                       repo_msg.append(indent + "eclass_overrides: " + self.eclass_overrides)
+               repo_msg.append("")
+               return "\n".join(repo_msg) + "\n"
+
 class RepoConfigLoader(object):
        """Loads and store config of several repositories, loaded from PORTDIR_OVERLAY or repos.conf"""
        def __init__(self, paths, settings):