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

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