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

James Antill james at osuosl.org
Wed Apr 1 19:53:28 UTC 2009


 yum/rpmsack.py |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 70348198e831e77fda0f90027587f1c5bdfcd172
Author: James Antill <james at and.org>
Date:   Wed Apr 1 15:23:08 2009 -0400

    Cleanup old directories, when we delete the last attribute

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 209e1c7..aa69f57 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -754,6 +754,12 @@ class RPMDBAdditionalDataPackage(object):
                 os.unlink(fn)
             except (IOError, OSError):
                 raise AttributeError, "Cannot delete attribute %s on " % (attr, self)
+            else:
+                if not self._read_cached_data:
+                    try:
+                        os.rmdir(self._mydir)
+                    except:
+                        pass
     
     def __getattr__(self, attr):
         return self._read(attr)
commit 9aa7ebc4717117a574fa3cdbdf6ad0aa63e036cb
Author: James Antill <james at and.org>
Date:   Wed Apr 1 15:20:57 2009 -0400

    Fix delete for cached attrs

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 52d9e6c..209e1c7 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -747,13 +747,13 @@ class RPMDBAdditionalDataPackage(object):
 
         self.get(attr)
         fn = self._mydir + '/' + attr
+        if attr in self._read_cached_data:
+            del self._read_cached_data[attr]
         if os.path.exists(fn):
             try:
                 os.unlink(fn)
             except (IOError, OSError):
                 raise AttributeError, "Cannot delete attribute %s on " % (attr, self)
-        return None
-    
     
     def __getattr__(self, attr):
         return self._read(attr)


More information about the Yum-commits mailing list