Blame SOURCES/BZ-1139032-reposync-directory-structure.patch

5b4f08
commit abdc5d04ca75357f7e2cf9852c4b6d3486cf8dd5
5b4f08
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
5b4f08
Date:   Wed Sep 10 09:45:26 2014 +0200
5b4f08
5b4f08
    reposync: preserve directory structure. BZ 1139032
5b4f08
5b4f08
diff --git a/reposync.py b/reposync.py
5b4f08
index bb4c59d..eb8ab21 100755
5b4f08
--- a/reposync.py
5b4f08
+++ b/reposync.py
5b4f08
@@ -291,10 +291,13 @@ def main():
5b4f08
 
5b4f08
         # set localpaths
5b4f08
         for pkg in download_list:
5b4f08
-            rpmfn = os.path.basename(pkg.remote_path)
5b4f08
+            rpmfn = pkg.remote_path
5b4f08
             pkg.localpath = os.path.join(local_repo_path, rpmfn)
5b4f08
             pkg.repo.copy_local = True
5b4f08
             pkg.repo.cache = 0
5b4f08
+            localdir = os.path.dirname(pkg.localpath)
5b4f08
+            if not os.path.exists(localdir):
5b4f08
+                os.makedirs(localdir)
5b4f08
 
5b4f08
         # use downloader from YumBase
5b4f08
         probs = my.downloadPkgs(download_list)