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

James Antill james at osuosl.org
Fri Jun 19 21:55:38 UTC 2009


 yum/__init__.py |   18 +++++++++++++++++-
 yum/packages.py |    5 ++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 8608f024b3db9fabd80c086793257ac55cb183c7
Author: James Antill <james at and.org>
Date:   Fri Jun 19 17:55:25 2009 -0400

    Don't die accessing local pkgs. for yumdb_info

diff --git a/yum/__init__.py b/yum/__init__.py
index c2d573d..2a1f806 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1046,6 +1046,19 @@ class YumBase(depsolve.Depsolve):
                 if csum is not None:
                     po.yumdb_info.checksum_type = str(csum[0])
                     po.yumdb_info.checksum_data = str(csum[1])
+
+                if isinstance(rpo, YumLocalPackage):
+                    try:
+                        st = os.stat(rpo.localPkg())
+                        lp_ctime = str(int(st.st_ctime))
+                        lp_mtime = str(int(st.st_mtime))
+                        po.yumdb_info.from_repo_revision  = lp_ctime
+                        po.yumdb_info.from_repo_timestamp = lp_mtime
+                    except: pass
+
+                if not hasattr(rpo.repo, 'repoXML'):
+                    continue
+
                 md = rpo.repo.repoXML
                 if md and md.revision is not None:
                     po.yumdb_info.from_repo_revision  = str(md.revision)
commit 662ae41ded902ff174b6164b8835d417cb6180dd
Author: James Antill <james at and.org>
Date:   Fri Jun 19 17:47:45 2009 -0400

    Fix po usage for reinstall, reinstall local etc.

diff --git a/yum/__init__.py b/yum/__init__.py
index 1a3ee3f..c2d573d 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3190,7 +3190,10 @@ class YumBase(depsolve.Depsolve):
                              rpm.RPMPROB_FILTER_REPLACEOLDFILES)
 
         tx_mbrs = []
-        tx_mbrs.extend(self.remove(po, **kwargs))
+        if po: # The po, is the "available" po ... we want the installed po
+            tx_mbrs.extend(self.remove(pkgtup=po.pkgtup))
+        else:
+            tx_mbrs.extend(self.remove(**kwargs))
         if not tx_mbrs:
             raise Errors.ReinstallRemoveError, _("Problem in reinstall: no package matched to remove")
         templen = len(tx_mbrs)
commit 99dbfea86506aad99234d9950f787c00648dd56d
Author: James Antill <james at and.org>
Date:   Fri Jun 19 17:43:57 2009 -0400

    Do the right thing when attribute isn't in the hdr

diff --git a/yum/packages.py b/yum/packages.py
index 9827f9d..1ad0762 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1123,7 +1123,10 @@ class YumHeaderPackage(YumAvailablePackage):
         if thing.startswith('__') and thing.endswith('__'):
             if not hasattr(self, thing):
                 raise AttributeError, "%s has no attribute %s" % (self, thing)
-        return self.hdr[thing]
+        try:
+            return self.hdr[thing]
+        except KeyError:
+            raise AttributeError, "%s has no attribute %s" % (self, thing)
 
     def doepoch(self):
         tmpepoch = self.hdr['epoch']


More information about the Yum-commits mailing list