Don't print ::${repository} for main repository in output of
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sat, 28 Jan 2012 01:38:24 +0000 (02:38 +0100)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sat, 28 Jan 2012 01:38:24 +0000 (02:38 +0100)
`emerge -pv ${package}` by default. Add --verbose-main-repo-display
option, which enables printing ::${repository} for main repository.

man/emerge.1
pym/_emerge/main.py
pym/_emerge/resolver/output.py
pym/_emerge/resolver/output_helpers.py

index 7b83f648b289b9cb1ae242d846aa25c5d7c1fbc6..7b59040cbf7d834ee8ea4166631ccc1d8148b118 100644 (file)
@@ -755,6 +755,9 @@ Symbol      Location        Meaning
 ()     circumfix       forced, masked, or removed
 .TE
 .TP
+.BR "\-\-verbose\-main\-repo\-display"
+In the package merge list display, print ::repository even for main repository.
+.TP
 .BR "\-\-with\-bdeps < y | n >"
 In dependency calculations, pull in build time dependencies
 that are not strictly required. This defaults to \'n\' for
index 65df99de8adc388137defa7ef9b9492f0c4bae5b..45ca6f5fa7328e9903ce641943b00250fba340b4 100644 (file)
@@ -75,6 +75,7 @@ options=[
 "--unordered-display",
 "--update",
 "--verbose",
+"--verbose-main-repo-display",
 ]
 
 shortmapping={
index ed72b23b6d68e1b9531a259a881cfe5fde58453d..d3fe1d705c914698e57a657f4d79547031c0cb60 100644 (file)
@@ -71,7 +71,7 @@ class Display(object):
                """Processes pkg for blockers and adds colorized strings to
                self.print_msg and self.blockers
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @param fetch_symbol: string
                @rtype: bool
                Modifies class globals: self.blocker_style, self.resolved,
@@ -120,7 +120,7 @@ class Display(object):
        def _display_use(self, pkg, myoldbest, myinslotlist):
                """ USE flag display
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @param myoldbest: list of installed versions
                @param myinslotlist: list of installed slots
                Modifies class globals: self.forced_flags, self.cur_iuse,
@@ -160,7 +160,7 @@ class Display(object):
 
        def gen_mask_str(self, pkg):
                """
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                """
                hardmasked = pkg.isHardMasked()
                mask_str = " "
@@ -222,7 +222,7 @@ class Display(object):
                """ Prevent USE_EXPAND_HIDDEN flags from being hidden if they
                are the only thing that triggered reinstallation.
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                Modifies self.use_expand_hidden, self.use_expand, self.verboseadd
                """
                reinst_flags_map = {}
@@ -301,7 +301,7 @@ class Display(object):
        def verbose_size(self, pkg, repoadd_set, pkg_info):
                """Determines the size of the downloads required
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @param repoadd_set: set of repos to add
                @param pkg_info: dictionary
                Modifies class globals: self.myfetchlist, self.counters.totalsize,
@@ -369,9 +369,10 @@ class Display(object):
                                repoadd_set.add(self.repoadd)
 
 
-       def convert_myoldbest(self, myoldbest):
+       def convert_myoldbest(self, pkg, myoldbest):
                """converts and colorizes a version list to a string
 
+               @param pkg: _emerge.Package.Package instance
                @param myoldbest: list
                @rtype string.
                """
@@ -379,13 +380,13 @@ class Display(object):
                myoldbest_str = ""
                if myoldbest:
                        versions = []
-                       for pos, pkg in enumerate(myoldbest):
-                               key = catpkgsplit(pkg.cpv)[2] + \
-                                       "-" + catpkgsplit(pkg.cpv)[3]
+                       for pos, old_pkg in enumerate(myoldbest):
+                               key = catpkgsplit(old_pkg.cpv)[2] + "-" + catpkgsplit(old_pkg.cpv)[3]
                                if key[-3:] == "-r0":
                                        key = key[:-3]
-                               if self.conf.verbosity == 3 and not self.quiet_repo_display:
-                                       key += _repo_separator + pkg.repo
+                               if self.conf.verbosity == 3 and not self.quiet_repo_display and (self.verbose_main_repo_display or
+                                       (any(x.repo != self.portdb.repositories.mainRepo().name for x in myoldbest + [pkg]))):
+                                       key += _repo_separator + old_pkg.repo
                                versions.append(key)
                        myoldbest_str = blue("["+", ".join(versions)+"]")
                return myoldbest_str
@@ -395,7 +396,7 @@ class Display(object):
                """Increments counters.interactive if the pkg is to
                be merged and it's metadata has interactive set True
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @param ordered: boolean
                @param addl: already defined string to add to
                """
@@ -411,11 +412,12 @@ class Display(object):
 
                @param addl: already defined string to add to
                @param pkg_info: dictionary
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @rtype string
                """
                ver_str = pkg_info.ver
-               if self.conf.verbosity == 3 and not self.quiet_repo_display:
+               if self.conf.verbosity == 3 and not self.quiet_repo_display and (self.verbose_main_repo_display or
+                       (any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg]))):
                        ver_str += _repo_separator + pkg.repo
                if self.conf.quiet:
                        myprint = addl + " " + self.indent + \
@@ -448,12 +450,13 @@ class Display(object):
 
                @param addl: already defined string to add to
                @param pkg_info: dictionary
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @rtype string
                Modifies self.verboseadd
                """
                ver_str = pkg_info.ver
-               if self.conf.verbosity == 3 and not self.quiet_repo_display:
+               if self.conf.verbosity == 3 and not self.quiet_repo_display and (self.verbose_main_repo_display or
+                       (any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg]))):
                        ver_str += _repo_separator + pkg.repo
                if self.conf.quiet:
                        myprint = addl + " " + self.indent + \
@@ -483,13 +486,14 @@ class Display(object):
        def _set_no_columns(self, pkg, pkg_info, addl):
                """prints pkg info without column indentation.
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @param pkg_info: dictionary
                @param addl: the current text to add for the next line to output
                @rtype the updated addl
                """
                pkg_str = pkg.cpv
-               if self.conf.verbosity == 3 and not self.quiet_repo_display:
+               if self.conf.verbosity == 3 and not self.quiet_repo_display and (self.verbose_main_repo_display or
+                       (any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg]))):
                        pkg_str += _repo_separator + pkg.repo
                if not pkg_info.merge:
                        addl = self.empty_space_in_brackets()
@@ -634,7 +638,7 @@ class Display(object):
        def set_pkg_info(self, pkg, ordered):
                """Sets various pkg_info dictionary variables
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @param ordered: bool
                @rtype pkg_info dictionary
                Modifies self.counters.restrict_fetch,
@@ -678,7 +682,7 @@ class Display(object):
        def do_changelog(self, pkg, pkg_info):
                """Processes and adds the changelog text to the master text for output
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @param pkg_info: dictionay
                Modifies self.changelogs
                """
@@ -697,7 +701,7 @@ class Display(object):
        def check_system_world(self, pkg):
                """Checks for any occurances of the package in the system or world sets
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @rtype system and world booleans
                """
                root_config = self.conf.roots[pkg.root]
@@ -727,7 +731,7 @@ class Display(object):
        @staticmethod
        def get_ver_str(pkg):
                """Obtains the version string
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @rtype string
                """
                ver_str = list(catpkgsplit(pkg.cpv)[2:])
@@ -744,7 +748,7 @@ class Display(object):
                param is used for -u, where you still *do* want to see when
                something is being upgraded.
 
-               @param pkg: _emerge.Package instance
+               @param pkg: _emerge.Package.Package instance
                @param pkg_info: dictionay
                @rtype addl, myoldbest: list, myinslotlist: list
                Modifies self.counters.reinst, self.counters.binary, self.counters.new
@@ -816,6 +820,8 @@ class Display(object):
                        # and disable the entire repo display in this case.
                        repoadd_set = set()
 
+               self.verbose_main_repo_display = "--verbose-main-repo-display" in depgraph._frozen_config.myopts
+
                for mylist_index in range(len(mylist)):
                        pkg, depth, ordered = mylist[mylist_index]
                        self.portdb = self.conf.trees[pkg.root]["porttree"].dbapi
@@ -828,12 +834,12 @@ class Display(object):
                                        continue
                        else:
                                pkg_info = self.set_pkg_info(pkg, ordered)
-                               addl, pkg_info.oldbest, myinslotlist = \
+                               addl, pkg_info.oldbest_list, myinslotlist = \
                                        self._get_installed_best(pkg, pkg_info)
                                self.verboseadd = ""
                                if self.quiet_repo_display:
                                        self.repoadd = None
-                               self._display_use(pkg, pkg_info.oldbest, myinslotlist)
+                               self._display_use(pkg, pkg_info.oldbest_list, myinslotlist)
                                self.recheck_hidden(pkg)
                                if self.conf.verbosity == 3:
                                        if self.quiet_repo_display:
@@ -846,7 +852,7 @@ class Display(object):
 
                                self.oldlp = self.conf.columnwidth - 30
                                self.newlp = self.oldlp - 30
-                               pkg_info.oldbest = self.convert_myoldbest(pkg_info.oldbest)
+                               pkg_info.oldbest = self.convert_myoldbest(pkg, pkg_info.oldbest_list)
                                pkg_info.system, pkg_info.world = \
                                        self.check_system_world(pkg)
                                addl = self.set_interactive(pkg, pkg_info.ordered, addl)
@@ -862,7 +868,8 @@ class Display(object):
                                                        addl, pkg_info, pkg)
                                        else:
                                                pkg_str = pkg.cpv
-                                               if self.conf.verbosity == 3 and not self.quiet_repo_display:
+                                               if self.conf.verbosity == 3 and not self.quiet_repo_display and (self.verbose_main_repo_display or
+                                                       (any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg]))):
                                                        pkg_str += _repo_separator + pkg.repo
                                                if not pkg_info.merge:
                                                        addl = self.empty_space_in_brackets()
index 5e5e1066f97f2a490af4fcb0857a3103c419c018..cda0b089616d10f757b5431c2e473d878a00ae48 100644 (file)
@@ -565,10 +565,9 @@ class PkgInfo(object):
        information about the pkg being printed.
        """
        
-       __slots__ = ("ordered", "fetch_symbol", "operation", "merge",
-               "built", "cp", "ebuild_path", "repo_name", "repo_path_real", 
-               "world", "system", "use", "oldbest", "ver"
-               )
+       __slots__ = ("built", "cp", "ebuild_path", "fetch_symbol", "merge",
+               "oldbest", "oldbest_list", "operation", "ordered",
+               "repo_name", "repo_path_real", "system", "use", "ver", "world")
 
 
        def __init__(self):
@@ -578,6 +577,7 @@ class PkgInfo(object):
                self.fetch_symbol = ''
                self.merge = ''
                self.oldbest = ''
+               self.oldbest_list = []
                self.operation = ''
                self.ordered = False
                self.repo_path_real = ''