]> git.decadent.org.uk Git - dak.git/blobdiff - dak/check_proposed_updates.py
Merge branch 'master' into security
[dak.git] / dak / check_proposed_updates.py
index 0dafb64885bc25e405fb1321fcbef452d4b9a267..afb0faaeb9a1832552e6bd75c762f5bfcf0fda43 100755 (executable)
 ################################################################################
 
 # | > amd64 is more mature than even some released architectures
-# |  
+# |
 # | This might be true of the architecture, unfortunately it seems to be the
 # | exact opposite for most of the people involved with it.
-# 
+#
 # <1089213290.24029.6.camel@descent.netsplit.com>
 
 ################################################################################
 
 import pg, sys, os
 import apt_pkg, apt_inst
-import dak.lib.database as database
-import dak.lib.utils as utils
+from daklib import database
+from daklib import utils
 
 ################################################################################
 
@@ -183,16 +183,16 @@ def check_changes (filename):
 
     # Move to the pool directory
     cwd = os.getcwd()
-    file = files.keys()[0]
-    pool_dir = Cnf["Dir::Pool"] + '/' + utils.poolify(changes["source"], files[file]["component"])
+    f = files.keys()[0]
+    pool_dir = Cnf["Dir::Pool"] + '/' + utils.poolify(changes["source"], files[f]["component"])
     os.chdir(pool_dir)
 
     changes_result = 0
-    for file in files.keys():
-        if file.endswith(".deb"):
-            result = check_package(file, files)
+    for f in files.keys():
+        if f.endswith(".deb"):
+            result = check_package(f, files)
             if Options["verbose"]:
-                pass_fail(file, result)
+                pass_fail(f, result)
             changes_result += result
 
     pass_fail (filename, changes_result)
@@ -210,12 +210,12 @@ def check_deb (filename):
 ################################################################################
 
 def check_joey (filename):
-    file = utils.open_file(filename)
+    f = utils.open_file(filename)
 
     cwd = os.getcwd()
     os.chdir("%s/dists/proposed-updates" % (Cnf["Dir::Root"]))
 
-    for line in file.readlines():
+    for line in f.readlines():
         line = line.rstrip()
         if line.find('install') != -1:
             split_line = line.split()
@@ -228,7 +228,7 @@ def check_joey (filename):
             if Options["debug"]:
                 print "Processing %s..." % (changes_filename)
             check_changes(changes_filename)
-    file.close()
+    f.close()
 
     os.chdir(cwd)
 
@@ -274,8 +274,8 @@ def main ():
                  ('v',"verbose","Check-Proposed-Updates::Options::Verbose"),
                  ('h',"help","Check-Proposed-Updates::Options::Help")]
     for i in [ "debug", "quiet", "verbose", "help" ]:
-       if not Cnf.has_key("Check-Proposed-Updates::Options::%s" % (i)):
-           Cnf["Check-Proposed-Updates::Options::%s" % (i)] = ""
+        if not Cnf.has_key("Check-Proposed-Updates::Options::%s" % (i)):
+            Cnf["Check-Proposed-Updates::Options::%s" % (i)] = ""
 
     arguments = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
     Options = Cnf.SubTree("Check-Proposed-Updates::Options")
@@ -292,15 +292,15 @@ def main ():
     parse_packages()
     print "done."
 
-    for file in arguments:
-        if file.endswith(".changes"):
-            check_changes(file)
-        elif file.endswith(".deb"):
-            check_deb(file)
-        elif file.endswith(".joey"):
-            check_joey(file)
+    for f in arguments:
+        if f.endswith(".changes"):
+            check_changes(f)
+        elif f.endswith(".deb"):
+            check_deb(f)
+        elif f.endswith(".joey"):
+            check_joey(f)
         else:
-            utils.fubar("Unrecognised file type: '%s'." % (file))
+            utils.fubar("Unrecognised file type: '%s'." % (f))
 
 #######################################################################################