---
 yum/__init__.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index d53db6d..dd56399 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -44,6 +44,7 @@ import logging
 import logging.config
 import operator
 import tempfile
+import shutil
 
 import yum.i18n
 # This is required to make gaftonmode work...
@@ -2220,6 +2221,24 @@ much more problems).
         # nothing *sigh*.
         self.history.close()
 
+        # Preload RPMs from user cache.
+        for po in pkglist:
+            if hasattr(po, 'pkgtype') and po.pkgtype == 'local':
+                continue
+            local = po.localPkg()
+            if not os.path.exists(local):
+                suffix = '/%s/packages/%s' % (po.repo.id, 
os.path.basename(po.remote_path))
+                for user in getattr(self, '_preload_from_user', ()):
+                    user += suffix
+                    st = misc.stat_f(user)
+                    if st and st.st_size == po.size:
+                        try:
+                            shutil.copy2(user, local) # user-writable, must 
copy
+                            if po.verifyLocalPkg():
+                                break
+                        except IOError: pass
+                        misc.unlink_f(local)
+
         self.plugins.run('predownload', pkglist=pkglist)
         repo_cached = False
         remote_pkgs = []
-- 
1.7.4.4

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to