[yum-git] reposync.py

Tim Lauridsen timlau at linux.duke.edu
Tue Aug 5 13:30:26 UTC 2008


 reposync.py |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 37da058f888c2e7cef292a78c779f61c9d3a59fd
Author: tla at dk.ibm.com <tla at tlaws.local>
Date:   Tue Aug 5 15:30:14 2008 +0200

    Add option to fetch comps.xml to reposync by Mohd Izhar Firdaus Ismail (duke bz#856)

diff --git a/reposync.py b/reposync.py
index 5635cd6..339a6ca 100755
--- a/reposync.py
+++ b/reposync.py
@@ -115,6 +115,8 @@ def parseArgs():
         help="Output as little as possible")
     parser.add_option("-l", "--plugins", default=False, action="store_true", 
         help="enable yum plugin support")
+    parser.add_option("-m", "--downloadcomps", default=False, action="store_true",
+        help="also download comps.xml")
         
     (opts, args) = parser.parse_args()
     return (opts, args)
@@ -202,6 +204,23 @@ def main():
                     my.logger.info("Removing obsolete %s", pkg)
                 os.unlink(current_pkgs[pkg]['path'])
 
+        if opts.downloadcomps:
+            try: # download comps.xml
+               compsfile = repo.getGroups()
+
+               if not os.path.exists(local_repo_path):
+                   try:
+                       os.makedirs(local_repo_path)
+                   except IOError, e:
+                       my.logger.error("Could not make repo subdir: %s" % e)
+                       my.closeRpmDB()
+                       sys.exit(1)
+    
+               shutil.copyfile(compsfile,"%s/%s" % (local_repo_path,'comps.xml'))
+            except yum.Errors.RepoMDError:
+               if not opts.quiet:
+                  my.logger.error("Unable to fetch comps.xml")
+
         download_list.sort(sortPkgObj)
         n = 0
         for pkg in download_list:



More information about the Yum-cvs-commits mailing list