[yum-commits] Branch 'yum-3_2_X' - 4 commits - utils.py yum/__init__.py

skvidal at osuosl.org skvidal at osuosl.org
Mon Oct 12 13:58:30 UTC 2009


 utils.py        |    5 +++++
 yum/__init__.py |   40 ++++++++++++++++++++--------------------
 2 files changed, 25 insertions(+), 20 deletions(-)

New commits:
commit 4bd200e94c74ad3a8c9ff0ffeae504c0e640f8b4
Merge: 22a3bdb... 14b747b...
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Mon Oct 12 09:58:13 2009 -0400

    Merge branch 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum into yum-3_2_X
    
    * 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum:
      Import sys for sys.hexversion check, BZ 528233
      Update homepage URL and mailing list address.
      Man page spelling fixes.
      Another returnLeafNodes speedup (roughly 10%).

commit 22a3bdba53bef8d9ef48ae6cb6225e3b09396d19
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Mon Oct 12 09:57:45 2009 -0400

    change the lambda/map to a list comprehension

diff --git a/yum/__init__.py b/yum/__init__.py
index 43dae48..8d093db 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3287,7 +3287,7 @@ class YumBase(depsolve.Depsolve):
                 donothingpkgs.append(po)
 
         # handle excludes for a localinstall
-        check_pkgs = installpkgs + map(lambda x: x[0], updatepkgs)
+        check_pkgs = installpkgs + [x[0] for x in updatepkgs]
         if self._is_local_exclude(po, check_pkgs):
             self.verbose_logger.debug(_('Excluding %s'), po)
             return tx_return
commit c6b8d31af731fd684bcab7b050446253413c7ea5
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Oct 9 17:38:08 2009 -0400

    when we are setting up utils handle -q and -v as we do in cli.
    
    part of the fix for: https://bugzilla.redhat.com/show_bug.cgi?id=514513

diff --git a/utils.py b/utils.py
index 945aa65..a053720 100644
--- a/utils.py
+++ b/utils.py
@@ -82,6 +82,11 @@ class YumUtilBase(YumBaseCli):
             sys.exit(0)
         # get the install root to use
         root = self._parser.getRoot(opts)
+        if opts.quiet:
+            opts.debuglevel = 0
+        if opts.verbose:
+            opts.debuglevel = opts.errorlevel = 6
+        
         # Read up configuration options and initialise plugins
         try:
             pc = self.preconf
commit b5173147f29524c3959f03c5441f7ab447743e86
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Oct 9 16:20:59 2009 -0400

    when we do localinstalls/reinstalls/etc - make sure we check
    disableexcludes to see if we've disabled the exclude that might be stopping
    the localinstall.
    
    This creates a new private method of YumBase._is_local_exclude() which takes
    a package object and a list of pkgs to match against it.

diff --git a/yum/__init__.py b/yum/__init__.py
index daa437f..43dae48 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3287,14 +3287,8 @@ class YumBase(depsolve.Depsolve):
                 donothingpkgs.append(po)
 
         # handle excludes for a localinstall
-        toexc = []
-        if len(self.conf.exclude) > 0:
-            exactmatch, matched, unmatched = \
-                   parsePackages(installpkgs + map(lambda x: x[0], updatepkgs),
-                                 self.conf.exclude, casematch=1)
-            toexc = exactmatch + matched
-
-        if po in toexc:
+        check_pkgs = installpkgs + map(lambda x: x[0], updatepkgs)
+        if self._is_local_exclude(po, check_pkgs):
             self.verbose_logger.debug(_('Excluding %s'), po)
             return tx_return
 
@@ -3355,13 +3349,7 @@ class YumBase(depsolve.Depsolve):
             return []
 
         # handle excludes for a local reinstall
-        toexc = []
-        if len(self.conf.exclude) > 0:
-            exactmatch, matched, unmatched = \
-                   parsePackages([po], self.conf.exclude, casematch=1)
-            toexc = exactmatch + matched
-
-        if po in toexc:
+        if self._is_local_exclude(po, [po]):
             self.verbose_logger.debug(_('Excluding %s'), po)
             return []
 
@@ -3444,18 +3432,30 @@ class YumBase(depsolve.Depsolve):
             return []
 
         # handle excludes for a local downgrade
+        if self._is_local_exclude(po, [po]):
+            self.verbose_logger.debug(_('Excluding %s'), po)
+            return []
+
+        return self.downgrade(po=po)
+
+    def _is_local_exclude(self, po, pkglist):
+        """returns True if the local pkg should be excluded"""
+        
+        if "all" in self.conf.disable_excludes or \
+           "main" in self.conf.disable_excludes:
+            return False
+        
         toexc = []
         if len(self.conf.exclude) > 0:
             exactmatch, matched, unmatched = \
-                   parsePackages([po], self.conf.exclude, casematch=1)
+                   parsePackages(pkglist, self.conf.exclude, casematch=1)
             toexc = exactmatch + matched
 
         if po in toexc:
-            self.verbose_logger.debug(_('Excluding %s'), po)
-            return []
-
-        return self.downgrade(po=po)
+            return True
 
+        return False
+        
     def downgrade(self, po=None, **kwargs):
         """ Try to downgrade a package. Works like:
             % yum shell <<EOL


More information about the Yum-commits mailing list