[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH rhel5-branch] Ignore duplicate opening of installed rpm package file (#506361).



This is second take on the fix, the first one broke some other
methods of installation (bug #752507)
The patch is relative to 5.7 not to the previous take.

Yum calls open file callback twice when installing some packages which
makes our callback try second download and fail in specific
case of nfs: method and http: additional repository.

The fail is caused by self.method.unlinkFilename(fn) in
RPMCALLBACK_INST_CLOSE_FILE being driven by method (i.e. do nothing
for nfs, remove rpm file from cache for http), not by repo in question.
In the problematic case the package of additional http repository
is not removed from cache because the install method is nfs.
As a consequence, in the second call of RPMCALLBACK_INST_OPEN_FILE
repo.getPackage(po) fails to download the package.

The second call of the OPEN_FILE callback is a bug in yum.

Resolves: rhbz#506361
---
 yuminstall.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index 209a8d6..6d2b670 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -134,6 +134,10 @@ class simpleCallback:
 
             nvra = "%s" %(po,)
             self.instLog.write(self.modeText % (nvra,))
+            if nvra in self.files:
+                fn = self.files[nvra].name
+            else:
+                fn = None
 
             self.instLog.flush()
             self.files[nvra] = None
@@ -142,8 +146,8 @@ class simpleCallback:
 
             while self.files[nvra] == None:
                 try:
-                    fn = repo.getPackage(po)
-
+                    if not (fn and os.path.exists(fn)):
+                        fn = repo.getPackage(po)
                     f = open(fn, 'r')
                     self.files[nvra] = f
                 except NoMoreMirrorsRepoError:
-- 
1.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]