Blame SOURCES/BZ-1104995-yumdownloader-redownloading-existing-rpms.patch

74e468
commit 682227430bb2124fb2897371fa5bc5261099064a
74e468
Author: Zdenek Pavlas <zpavlas@redhat.com>
74e468
Date:   Mon Sep 9 15:15:35 2013 +0200
74e468
74e468
    yumdownloader: make --destdir less of a hack. BZ 1004089
74e468
    
74e468
    Instead of changing po.localpath, use the conf.downloaddir option
74e468
    already used to override repo.pkgdir(s).
74e468
74e468
diff --git a/yumdownloader.py b/yumdownloader.py
74e468
index 4c5eefb..b491c7f 100755
74e468
--- a/yumdownloader.py
74e468
+++ b/yumdownloader.py
74e468
@@ -96,6 +96,9 @@ class YumDownloader(YumUtilBase):
74e468
         if not self.setCacheDir():
74e468
             self.logger.error("Error: Could not make cachedir, exiting")
74e468
             sys.exit(50)
74e468
+
74e468
+        # override all pkgdirs
74e468
+        self.conf.downloaddir = opts.destdir
74e468
             
74e468
         # Setup yum (Ts, RPM db, Repo & Sack)
74e468
         self.doUtilYumSetup(opts)
74e468
@@ -202,14 +205,8 @@ class YumDownloader(YumUtilBase):
74e468
                 print urljoin(pkg.repo.urls[0], pkg.relativepath)
74e468
             return 0
74e468
 
74e468
-        # create dest dir
74e468
-        if not os.path.exists(opts.destdir):
74e468
-            os.makedirs(opts.destdir)
74e468
-
74e468
         # set localpaths
74e468
         for pkg in toDownload:
74e468
-            rpmfn = os.path.basename(pkg.remote_path)
74e468
-            pkg.localpath = os.path.join(opts.destdir, rpmfn)
74e468
             pkg.repo.copy_local = True
74e468
             pkg.repo.cache = 0
74e468