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

skvidal at osuosl.org skvidal at osuosl.org
Tue Apr 7 15:10:25 UTC 2009


 yum/__init__.py |    8 ++++++--
 yum/config.py   |    5 ++++-
 yum/yumRepo.py  |    2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 5707418282b787fa5c825808b027213758616f85
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Apr 7 11:08:13 2009 -0400

    - revert the copy_local change
    - fix the duplicate / in config dirs when they get the installroot prepended
    - make the unlinking check to see if the file is in the cachedir and only
      unlink it if it is.

diff --git a/yum/__init__.py b/yum/__init__.py
index 6a22e85..313d96a 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1215,8 +1215,12 @@ class YumBase(depsolve.Depsolve):
             cursize = os.stat(fo)[6]
             totsize = long(po.size)
             if cursize >= totsize and not po.repo.cache:
-                os.unlink(fo)
-                                                                                             
+                # if the path to the file is NOT inside the cachedir then don't
+                # unlink it b/c it is probably a file:// url and possibly
+                # unlinkable
+                if fo.startswith(po.repo.cachedir):
+                    os.unlink(fo)
+
             if raiseError:
                 raise URLGrabError(-1, _('Package does not match intended download'))
             else:
diff --git a/yum/config.py b/yum/config.py
index d3ace8f..9a47f1c 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -800,7 +800,10 @@ def readMainConfig(startupconf):
     # Apply the installroot to directory options
     for option in ('cachedir', 'logfile', 'persistdir'):
         path = getattr(yumconf, option)
-        setattr(yumconf, option, yumconf.installroot + path)
+        ir_path = yumconf.installroot + path
+        ir_path = ir_path.replace('//', '/') # os.path.normpath won't fix this and
+                                             # it annoys me
+        setattr(yumconf, option, ir_path)
     
     # Add in some extra attributes which aren't actually configuration values 
     yumconf.yumvar = yumvars
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 71741db..d9e2d77 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -253,7 +253,7 @@ class YumRepository(Repository, config.RepoConf):
         # throw in some stubs for things that will be set by the config class
         self.basecachedir = ""
         self.cost = 1000
-        self.copy_local = 1
+        self.copy_local = 0
         # holder for stuff we've grabbed
         self.retrieved = { 'primary':0, 'filelists':0, 'other':0, 'group':0,
                            'updateinfo':0}


More information about the Yum-commits mailing list