[yum-commits] Branch 'yum-3_2_X' - 5 commits - rpmUtils/miscutils.py yum/depsolve.py yum/__init__.py yum/packages.py

skvidal at osuosl.org skvidal at osuosl.org
Thu Apr 8 20:23:29 UTC 2010


 rpmUtils/miscutils.py |   44 ++++++++++++++++++++++----------------------
 yum/__init__.py       |    7 ++++++-
 yum/depsolve.py       |   32 +++++++++++++++++++-------------
 yum/packages.py       |   20 ++++++++++++++++++++
 4 files changed, 67 insertions(+), 36 deletions(-)

New commits:
commit c508ed6723b73b7606637376b374ee72e5afd42b
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Apr 8 16:22:04 2010 -0400

    - clean up debug statement :(
    - make provides_for use misc.re_primary_filename/dirname

diff --git a/yum/packages.py b/yum/packages.py
index 58be729..f4a00eb 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -438,7 +438,6 @@ class RpmBase(object):
                 continue
 
             if f == '=':
-                print 'hmm'
                 f = 'EQ'
             if f != 'EQ' and prcotype == 'provides':
                 # isn't this odd, it's not 'EQ' and it is a provides
@@ -468,7 +467,15 @@ class RpmBase(object):
             return True
         
         if reqtuple[0].startswith('/'):
-            if reqtuple[0] in self.filelist + self.dirlist + self.ghostlist:
+            if misc.re_primary_filename(reqtuple[0]) or misc.re_primary_dirname(reqtuple[0]):
+                pri_only = True
+            else:
+                pri_only = False
+
+            files = self.returnFileEntries('file', pri_only) + \
+                    self.returnFileEntries('dir', pri_only) + \
+                    self.returnFileEntries('ghost', pri_only)
+            if reqtuple[0] in files:
                 return True
         
         return False
commit 8f7e8978263d9c60bdfa37abaf0c6a44ed42b46d
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Apr 8 14:05:25 2010 -0400

    fix for testRL_dcbd1 unittest -
    
    When we're doing an install for dep - make sure what we're installing provides for the thing we need.
    this should really only ever happen on the obsolete pathway.
    
    provides_for as a kwarg should probably be added to update(), too.

diff --git a/yum/__init__.py b/yum/__init__.py
index 917fa1f..d83da8d 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3037,8 +3037,13 @@ class YumBase(depsolve.Depsolve):
                     self.verbose_logger.warning(_('Package %s is obsoleted by %s which is already installed'), 
                                                 po, already_obs)
                 else:
+                    if 'provides_for' in kwargs:
+                        if not obsoleting_pkg.provides_for(kwargs['provides_for']):
+                            self.verbose_logger.warning(_('Package %s is obsoleted by %s, but obsoleting package does not provide for requirements'),
+                                                  po.name, obsoleting_pkg.name)
+                            continue
                     self.verbose_logger.warning(_('Package %s is obsoleted by %s, trying to install %s instead'),
-                        po.name, obsoleting_pkg.name, obsoleting_pkg)               
+                        po.name, obsoleting_pkg.name, obsoleting_pkg)
                     tx_return.extend(self.install(po=obsoleting_pkg))
                 continue
             
diff --git a/yum/depsolve.py b/yum/depsolve.py
index f654d84..48f77d5 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -562,19 +562,25 @@ class Depsolve(object):
         else:
             self.verbose_logger.debug(_('TSINFO: Marking %s as install for %s'), best,
                 requiringPo)
-            # FIXME: Don't we want .install() here, so obsoletes get done?
-            txmbr = self.tsInfo.addInstall(best)
-            txmbr.setAsDep(po=requiringPo)
-            txmbr.reason = "dep"
-            self._last_req = best
-
-            # if we had other packages with this name.arch that we found
-            # before, they're not going to be installed anymore, so we
-            # should mark them to be re-checked
-            if best.pkgtup in upgraded:
-                map(self.tsInfo.remove, upgraded[best.pkgtup])
-
-        checkdeps = 1
+            reqtuple = misc.string_to_prco_tuple(needname + str(needflags) + needversion)
+            txmbrs = self.install(best, provides_for=reqtuple)
+            for txmbr in txmbrs:
+                txmbr.setAsDep(po=requiringPo)
+                txmbr.reason = "dep"
+                self._last_req = txmbr.po
+
+                # if we had other packages with this name.arch that we found
+                # before, they're not going to be installed anymore, so we
+                # should mark them to be re-checked
+                if txmbr.pkgtup in upgraded:
+                    map(self.tsInfo.remove, upgraded[txmbr.pkgtup])
+            if not txmbrs:
+                missingdep = 1
+                checkdeps = 0
+                msg = self._err_missing_requires(requiringPo, requirement)
+                errorlist.append(msg)
+            else:
+                checkdeps = 1
         
         return checkdeps, missingdep
 
commit f1a101abc68463b1400f5cd54b0922fd1daec045
Merge: 72e0bbb... 7a56e51...
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Apr 8 11:30:03 2010 -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:
      Don't traceback when lock holder doesn't exist anymore
      Use TMPDIR for people who don't want to use /var/tmp, yum#337
      Add testcase for dcbd and lldpad in F13
      Fix make check due to groupremove_leaf_only
      Should work around the reget MD problems
      Pkgname caching for rpmdb.returnPackages() so update is as fast as install
      Add searchProvides() into the false positive cache
      Speedup repeated calls to .install() with a pattern, via. returnPackages().

commit 72e0bbb2d2dd704071e222b2b3cea86d31d22985
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Apr 8 11:28:45 2010 -0400

    add a provides_for method to package objects
    
    so we can check if this package satisfies the specific requirement
    completely (including file deps).

diff --git a/yum/packages.py b/yum/packages.py
index 33cbc39..58be729 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -438,6 +438,7 @@ class RpmBase(object):
                 continue
 
             if f == '=':
+                print 'hmm'
                 f = 'EQ'
             if f != 'EQ' and prcotype == 'provides':
                 # isn't this odd, it's not 'EQ' and it is a provides
@@ -458,7 +459,19 @@ class RpmBase(object):
 
         return result
 
-
+    def provides_for(self, reqtuple):
+        """check to see if the package object provides for the requirement
+           passed, including searching filelists if the requirement is a file
+           dep"""
+        
+        if self.checkPrco('provides', reqtuple):
+            return True
+        
+        if reqtuple[0].startswith('/'):
+            if reqtuple[0] in self.filelist + self.dirlist + self.ghostlist:
+                return True
+        
+        return False
         
     def returnChangelog(self):
         """return changelog entries"""
commit c6ffca42ae0c542e0c16ef7d5d2fbba1db1c5fb6
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Apr 8 11:27:45 2010 -0400

    make rangecompare accept <, <=, >, >=, = instead of just letterflags and numerics
    
    makes certain types of comparisons simpler when coming from text.

diff --git a/rpmUtils/miscutils.py b/rpmUtils/miscutils.py
index a925027..b5f3566 100644
--- a/rpmUtils/miscutils.py
+++ b/rpmUtils/miscutils.py
@@ -170,45 +170,45 @@ def rangeCompare(reqtuple, provtuple):
 
     # does not match unless
     if rc >= 1:
-        if reqf in ['GT', 'GE', 4, 12]:
+        if reqf in ['GT', 'GE', 4, 12, '>', '>=']:
             return 1
-        if reqf in ['EQ', 8]:
-            if f in ['LE', 10, 'LT', 2]:
-                return 1                
-        if reqf in ['LE', 'LT', 'EQ', 10, 2, 8]:
-            if f in ['LE', 'LT', 10, 2]:
+        if reqf in ['EQ', 8, '=']:
+            if f in ['LE', 10, 'LT', 2,'<=', '<']:
+                return 1
+        if reqf in ['LE', 'LT', 'EQ', 10, 2, 8, '<=', '<', '=']:
+            if f in ['LE', 'LT', 10, 2, '<=', '<']:
                 return 1
 
     if rc == 0:
-        if reqf in ['GT', 4]:
-            if f in ['GT', 'GE', 4, 12]:
+        if reqf in ['GT', 4, '>']:
+            if f in ['GT', 'GE', 4, 12, '>', '>=']:
                 return 1
-        if reqf in ['GE', 12]:
-            if f in ['GT', 'GE', 'EQ', 'LE', 4, 12, 8, 10]:
+        if reqf in ['GE', 12, '>=']:
+            if f in ['GT', 'GE', 'EQ', 'LE', 4, 12, 8, 10, '>', '>=', '=', '<=']:
                 return 1
-        if reqf in ['EQ', 8]:
-            if f in ['EQ', 'GE', 'LE', 8, 12, 10]:
+        if reqf in ['EQ', 8, '=']:
+            if f in ['EQ', 'GE', 'LE', 8, 12, 10, '=', '>=', '<=']:
                 return 1
-        if reqf in ['LE', 10]:
-            if f in ['EQ', 'LE', 'LT', 'GE', 8, 10, 2, 12]:
+        if reqf in ['LE', 10, '<=']:
+            if f in ['EQ', 'LE', 'LT', 'GE', 8, 10, 2, 12, '=', '<=', '<' , '>=']:
                 return 1
-        if reqf in ['LT', 2]:
-            if f in ['LE', 'LT', 10, 2]:
+        if reqf in ['LT', 2, '<']:
+            if f in ['LE', 'LT', 10, 2, '<=', '<']:
                 return 1
     if rc <= -1:
-        if reqf in ['GT', 'GE', 'EQ', 4, 12, 8]:
-            if f in ['GT', 'GE', 4, 12]:
+        if reqf in ['GT', 'GE', 'EQ', 4, 12, 8, '>', '>=', '=']:
+            if f in ['GT', 'GE', 4, 12, '>', '>=']:
                 return 1
-        if reqf in ['LE', 'LT', 10, 2]:
+        if reqf in ['LE', 'LT', 10, 2, '<=', '<']:
             return 1
 #                if rc >= 1:
-#                    if reqf in ['GT', 'GE', 4, 12]:
+#                    if reqf in ['GT', 'GE', 4, 12, '>', '>=']:
 #                        return 1
 #                if rc == 0:
-#                    if reqf in ['GE', 'LE', 'EQ', 8, 10, 12]:
+#                    if reqf in ['GE', 'LE', 'EQ', 8, 10, 12, '>=', '<=', '=']:
 #                        return 1
 #                if rc <= -1:
-#                    if reqf in ['LT', 'LE', 2, 10]:
+#                    if reqf in ['LT', 'LE', 2, 10, '<', '<=']:
 #                        return 1
 
     return 0


More information about the Yum-commits mailing list