[yum-git] Makefile reposync.py

Tim Lauridsen timlau at linux.duke.edu
Wed Sep 24 14:56:36 UTC 2008


 Makefile    |    2 +-
 reposync.py |   34 ++++++++++++++++------------------
 2 files changed, 17 insertions(+), 19 deletions(-)

New commits:
commit 75e410a57b38e42d9dce4ba226f2f2ae742c6732
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date:   Wed Sep 24 16:56:17 2008 +0200

    add reposync to pylint check

diff --git a/Makefile b/Makefile
index f74b4b6..3a56217 100644
--- a/Makefile
+++ b/Makefile
@@ -85,7 +85,7 @@ pylint:
 	@pylint --rcfile=test/yum-utils-pylintrc \
 		yumdownloader.py yum-complete-transaction.py yum-debug-dump.py yum-builddep.py \
                 debuginfo-install.py package-cleanup.py yum-groups-manager.py verifytree.py \
-		repotrack.py \
+		repotrack.py reposync.py \
 		plugins/remove-with-leaves/remove-with-leaves.py \
 		plugins/upgrade-helper/upgrade-helper.py \
 		plugins/security/security.py \
diff --git a/reposync.py b/reposync.py
index 82cf4f0..2719d35 100755
--- a/reposync.py
+++ b/reposync.py
@@ -42,7 +42,6 @@ import yum
 import yum.Errors
 from yum.misc import getCacheDir
 from yum.constants import *
-from yum.packages import parsePackages
 from yum.packageSack import ListPackageSack
 import rpmUtils.arch
 import logging
@@ -64,18 +63,18 @@ class RepoSync(yum.YumBase):
         self.logger = logging.getLogger('yum.verbose.reposync')
         self.opts = opts
 
-def localpkgs(dir):
-    names = os.listdir(dir)
+def localpkgs(directory):
+    names = os.listdir(directory)
 
     cache = {}
     for name in names:
-        fn = os.path.join(dir, name)
+        fn = os.path.join(directory, name)
         try:
             st = os.lstat(fn)
         except os.error:
             continue
         if stat.S_ISDIR(st.st_mode):
-            subcache= localpkgs(fn)
+            subcache = localpkgs(fn)
             for pkg in subcache.keys():
                 cache[pkg] = subcache[pkg]
         elif stat.S_ISREG(st.st_mode) and name.endswith(".rpm"):
@@ -206,20 +205,19 @@ def main():
 
         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'))
+                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")
+                if not opts.quiet:
+                    my.logger.error("Unable to fetch comps.xml")
 
         download_list.sort(sortPkgObj)
         n = 0



More information about the Yum-cvs-commits mailing list