[yum-commits] Branch 'yum-3_2_X' - 5 commits - docs/yum.conf.5 output.py yum/depsolve.py yum/__init__.py yum/packages.py

James Antill james at osuosl.org
Tue Jun 14 14:20:34 UTC 2011


 docs/yum.conf.5 |    2 +-
 output.py       |    7 +++++--
 yum/__init__.py |   51 ++++++++++++++++++++++++++++++++++++++++++++++-----
 yum/depsolve.py |    8 ++++++--
 yum/packages.py |    5 +++++
 5 files changed, 63 insertions(+), 10 deletions(-)

New commits:
commit ac09b3e92bc30ec2a8faa721dc37a814320c6a6f
Author: Nick Jacek <njacek at redhat.com>
Date:   Mon Jun 13 16:16:29 2011 -0400

     Stops "Finished dependency resolution" from being printed multiple times
    when --skip-broken is used. BZ 626569.

diff --git a/yum/__init__.py b/yum/__init__.py
index a6c50b7..53c21bd 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1184,7 +1184,7 @@ class YumBase(depsolve.Depsolve):
                 else:
                     self.verbose_logger.debug('SKIPBROKEN: resetting already resolved packages (no packages to skip)' )
                     self.tsInfo.resetResolved(hard=True)
-            rescode, restring = self.resolveDeps(True)
+            rescode, restring = self.resolveDeps(True, skipping_broken=True)
             endTs = set(self.tsInfo)
              # Check if tsInfo has changes since we started to skip packages
              # if there is no changes then we got a loop.
diff --git a/yum/depsolve.py b/yum/depsolve.py
index 44ccfd7..6d744c0 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -721,7 +721,7 @@ class Depsolve(object):
         p.print_stats(20)
         return rc
 
-    def resolveDeps(self, full_check=True):
+    def resolveDeps(self, full_check=True, skipping_broken=False):
 
         if not len(self.tsInfo):
             return (0, [_('Success - empty transaction')])
@@ -795,7 +795,11 @@ class Depsolve(object):
                 txmbr.ts_state = 'i'
                 txmbr.output_state = TS_INSTALL
 
-        if self.dsCallback: self.dsCallback.end()
+        if self.dsCallback:
+            if not self.conf.skip_broken:
+                self.dsCallback.end()
+            elif not skipping_broken and not errors:
+                self.dsCallback.end()
         self.verbose_logger.log(logginglevels.DEBUG_1, _('Dependency Process ending'))
 
         self.tsInfo.changed = False
commit ef4c4570560d7105cba69dd950926669e67d4e38
Author: Marcelo Moreira de Mello <mmello at redhat.com>
Date:   Mon Jun 13 16:14:23 2011 -0300

    - Fixed small typo at protected_multilib description on yum.conf man page
    
    Hello,
    
      This patches fixes a small type at protected_multilib description on
    yum.conf man page.
    
     Cheers,
    Marcelo
    --
    Marcelo Moreira de Mello
    
    From: Marcelo Moreira de Mello <mmello at redhat.com>
    Date: Mon, 13 Jun 2011 16:10:07 -0300
    Subject: [PATCH]  Fixed small typo at protected_multilib description at yum.conf man page

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index bebc050..515aa73 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -79,7 +79,7 @@ Either `1' or `0'. This tells yum whether or not it should perform a check to
 make sure that multilib packages are the same version. For example, if this
 option is off (rpm behaviour) pkgA-1.x86_64 and pkgA-2.i386 can be installed
 at the same time. However this is very rarely desired.
-install only packages, like the kernel, are excempt from this check.
+Install only packages, like the kernel, are exempt from this check.
 The default is `1'.
 
 .IP
commit 7d880df5b9cd02d35bebf7258d9d951956b8d7c4
Author: James Antill <james at and.org>
Date:   Mon Jun 13 15:53:12 2011 -0400

    Show the correct "duplicate" package for search without --showduplicates.

diff --git a/yum/__init__.py b/yum/__init__.py
index ab2bb9d..a6c50b7 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2586,18 +2586,53 @@ class YumBase(depsolve.Depsolve):
                 sorted_lists[count] = []
             sorted_lists[count].append((pkg, totkeys, totvals))
 
+        #  To explain why the following code looks like someone took drugs
+        # before/during/after coding:
+        #
+        # We are sorting a list of: (po, tmpkeys, tmpvalues).
+        #                  Eg.      (po, ['foo', 'bar'], ['matches foo',
+        #                                                 'matches barx'])
+        #
+        # So we sort, and get a result like:
+        #        po    | repo | matching value
+        #     1. yum-1 |  fed | -2
+        #     2. yum-2 |  fed | -2 
+        #     3. yum-2 | @fed | -2
+        #     4. yum-3 |  ups | -1
+        # ...but without showdups we want to output _just_ #3, which requires
+        # we find the newest EVR po for the best "matching value". Without keys
+        # it's the same, except we just want the newest EVR.
+        #  If we screw it up it's probably not even noticable most of the time
+        # either, so it's pretty thankless. HTH. HAND.
         # By default just sort using package sorting
         sort_func = operator.itemgetter(0)
+        dup = lambda x: True
         if keys:
             # Take into account the keys found, their original order,
             # and number of fields hit as well
             sort_func = lambda x: (-sum((critweights[y] for y in x[1])),
-                                   "\0".join(sorted(x[1])), -len(x[2]), x[0])
+                                   -len(x[2]), "\0".join(sorted(x[1])), x[0])
+            dup = lambda x,y: sort_func(x)[:-1] == sort_func(y)[:-1]
         yielded = {}
         for val in reversed(sorted(sorted_lists)):
-            for (po, ks, vs) in sorted(sorted_lists[val], key=sort_func):
-                if not showdups and (po.name, po.arch) in yielded:
-                    continue
+            last = None
+            for sl_vals in sorted(sorted_lists[val], key=sort_func):
+                if showdups:
+                    (po, ks, vs) = sl_vals
+                else:
+                    if (sl_vals[0].name, sl_vals[0].arch) in yielded:
+                        continue
+
+                    na = (sl_vals[0].name, sl_vals[0].arch)
+                    if last is None or (last[0] == na and dup(last[1],sl_vals)):
+                        last = (na, sl_vals)
+                        continue
+
+                    (po, ks, vs) = last[1]
+                    if last[0] == na: # Dito. yielded test above.
+                        last = None
+                    else:
+                        last = (na, sl_vals)
 
                 if keys:
                     yield (po, ks, vs)
@@ -2606,6 +2641,12 @@ class YumBase(depsolve.Depsolve):
 
                 if not showdups:
                     yielded[(po.name, po.arch)] = 1
+            if last is not None:
+                (po, ks, vs) = last[1]
+                if keys:
+                    yield (po, ks, vs)
+                else:
+                    yield (po, vs)
 
     def searchPackageTags(self, criteria):
         results = {} # name = [(criteria, taglist)]
commit 771647e512cc1cbafd2c25d4363b2a53b7642993
Author: James Antill <james at and.org>
Date:   Mon Jun 13 15:14:52 2011 -0400

    Always sort installed repos. after available repos.

diff --git a/yum/packages.py b/yum/packages.py
index 0d16293..d8043f9 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -299,6 +299,11 @@ class PackageObject(object):
             ret = cmp(self.arch, other.arch)
         if ret == 0 and hasattr(self, 'repoid') and hasattr(other, 'repoid'):
             ret = cmp(self.repoid, other.repoid)
+            # We want 'installed' to appear over 'abcd' and 'xyz', so boost that
+            if ret and self.repoid == 'installed':
+                return 1
+            if ret and other.repoid == 'installed':
+                return -1
         return ret
     def __eq__(self, other):
         """ Compare packages for yes/no equality, includes everything in the
commit 32ab703fdfde62837bcb8536eb48bba095f3cdac
Author: James Antill <james at and.org>
Date:   Mon Jun 13 11:51:04 2011 -0400

    Show from_repo in matchcallback. Only print "Matched from" is there is more.

diff --git a/output.py b/output.py
index 398dafa..3840f82 100755
--- a/output.py
+++ b/output.py
@@ -897,13 +897,16 @@ class YumOutput:
         if not verbose:
             return
 
-        print _("Repo        : %s") % po.repoid
-        print _('Matched from:')
+        print _("Repo        : %s") % po.ui_from_repo
+        done = False
         for item in yum.misc.unique(values):
             item = to_utf8(item)
             if to_utf8(po.name) == item or to_utf8(po.summary) == item:
                 continue # Skip double name/summary printing
 
+            if not done:
+                print _('Matched from:')
+                done = True
             can_overflow = True
             if False: pass
             elif to_utf8(po.description) == item:


More information about the Yum-commits mailing list