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

James Antill james at osuosl.org
Wed May 20 19:47:30 UTC 2009


 yum/__init__.py |   12 +++++++++++-
 yum/rpmsack.py  |   16 ++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit 7e8a9fd87a8cffdab0fb46e1e27d57af5fa331c1
Author: James Antill <james at and.org>
Date:   Wed May 20 15:42:36 2009 -0400

    Don't show .tmp attributes

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 8556e9a..66d8186 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -738,6 +738,9 @@ class RPMDBAdditionalDataPackage(object):
     def _read(self, attr):
         attr = _sanitize(attr)
 
+        if attr.endswith('.tmp'):
+            raise AttributeError, "%s has no attribute %s" % (self, attr)
+
         if attr in self._read_cached_data:
             return self._read_cached_data[attr]
 
@@ -754,7 +757,7 @@ class RPMDBAdditionalDataPackage(object):
     def _delete(self, attr):
         """remove the attribute file"""
 
-        self.get(attr)
+        attr = _sanitize(attr)
         fn = self._mydir + '/' + attr
         if attr in self._read_cached_data:
             del self._read_cached_data[attr]
@@ -779,18 +782,20 @@ class RPMDBAdditionalDataPackage(object):
         else:
             object.__delattr__(self, attr)
 
-    def __iter__(self):
+    def __iter__(self, show_hidden=False):
         for item in self._read_cached_data:
             yield item
         for item in glob.glob(self._mydir + '/*'):
             item = item[(len(self._mydir) + 1):]
             if item in self._read_cached_data:
                 continue
+            if not show_hidden and item.endswith('.tmp'):
+                continue
             yield item
 
     def clean(self):
         # purge out everything
-        for item in self:
+        for item in self.__iter__(show_hidden=True):
             self._delete(item)
         try:
             os.rmdir(self._mydir)
commit 06a98ee7d20ce5f5639aa92f210221dd58bca7fd
Author: James Antill <james at and.org>
Date:   Wed May 20 15:39:14 2009 -0400

    Fix python shutdown weirdo

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 5189b18..8556e9a 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -140,7 +140,10 @@ class RPMDBPackageSack(PackageSackBase):
         self._simple_pkgtup_list = []
         self._get_pro_cache = {}
         self._get_req_cache = {}
-        misc.unshare_data()
+        #  We can be called on python shutdown (due to yb.__del__), at which
+        # point other modules might not be available.
+        if misc is not None:
+            misc.unshare_data()
         self._cache = {
             'provides' : { },
             'requires' : { },
commit b9905edb5d843aeae3cf4facb77735f2b256c8a3
Author: James Antill <james at and.org>
Date:   Wed May 20 15:24:58 2009 -0400

    Add more data to the yumdb

diff --git a/yum/__init__.py b/yum/__init__.py
index cc57e98..942244e 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1021,11 +1021,21 @@ class YumBase(depsolve.Depsolve):
                                            ' but is not!' % txmbr.po))
                     continue
                 po = self.rpmdb.searchPkgTuple(txmbr.pkgtup)[0]
-                po.yumdb_info.from_repo = txmbr.po.repoid
+                rpo = txmbr.po
+                po.yumdb_info.from_repo = rpo.repoid
                 po.yumdb_info.reason = txmbr.reason
                 po.yumdb_info.releasever = self.yumvar['releasever']
                 if hasattr(self, 'cmds') and self.cmds:
                     po.yumdb_info.command_line = ' '.join(self.cmds)
+                csum = rpo.returnIdSum()
+                if csum is not None:
+                    po.yumdb_info.checksum_type = str(csum[0])
+                    po.yumdb_info.checksum_data = str(csum[1])
+                md = rpo.repo.repoXML
+                if md and md.revision is not None:
+                    po.yumdb_info.from_repo_revision  = str(md.revision)
+                if md:
+                    po.yumdb_info.from_repo_timestamp = str(md.timestamp)
             
             elif txmbr.output_state in TS_REMOVE_STATES:
                 if self.rpmdb.contains(po=txmbr.po):


More information about the Yum-commits mailing list