[yum-cvs] yum-utils reposync.py,1.4,1.5

Seth Vidal skvidal at linux.duke.edu
Sun Apr 30 02:49:16 UTC 2006


Update of /home/groups/yum/cvs/yum-utils
In directory login1.linux.duke.edu:/tmp/cvs-serv19620

Modified Files:
	reposync.py 
Log Message:

- make it create the subdirs properly
- fix it to download all versions by default


Index: reposync.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/reposync.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- reposync.py	11 Apr 2006 09:06:36 -0000	1.4
+++ reposync.py	30 Apr 2006 02:49:14 -0000	1.5
@@ -78,8 +78,8 @@
         default=os.getcwd(), help="Path to download packages to")
     parser.add_option("-u", "--urls", default=False, action="store_true", 
         help="Just list urls of what would be downloaded, don't download")
-    parser.add_option("--all-versions", dest='allversions', default=False, action="store_true", 
-        help="Download all versions of all packages, not just newest per-repo")
+    parser.add_option("-n", "--newest-only", dest='newest', default=False, action="store_true", 
+        help="Download only newest packages per-repo")
     parser.add_option("-q", "--quiet", default=False, action="store_true", 
         help="Output as little as possible")
         
@@ -143,17 +143,20 @@
             
         reposack = ListPackageSack(my.pkgSack.returnPackages(repoid=repo.id))
             
-        if opts.allversions:
-            download_list = list(reposack)
-        else:
+        if opts.newest:
             download_list = reposack.returnNewestByNameArch()
+        else:
+            download_list = list(reposack)
         
         download_list.sort(sortPkgObj)
         for pkg in download_list:
             repo = my.repos.getRepo(pkg.repoid)
             remote = pkg.returnSimple('relativepath')
-            local = os.path.basename(remote)
-            local = os.path.join(local_repo_path, local)
+            local = local_repo_path + '/' + remote
+            localdir = os.path.dirname(local)
+            if not os.path.exists(localdir):
+                os.makedirs(localdir)
+
             if (os.path.exists(local) and 
                 str(os.path.getsize(local)) == pkg.returnSimple('packagesize')):
                 




More information about the Yum-cvs-commits mailing list