X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fcheck_proposed_updates.py;h=16a9876348d24f78b80179950e338915b58057c5;hb=b612f3da207fa0d75a5d3b204ac8f02bb244231a;hp=0dafb64885bc25e405fb1321fcbef452d4b9a267;hpb=7aaaad3135c9164390af5897925660842368660b;p=dak.git diff --git a/dak/check_proposed_updates.py b/dak/check_proposed_updates.py index 0dafb648..16a98763 100755 --- a/dak/check_proposed_updates.py +++ b/dak/check_proposed_updates.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Dependency check proposed-updates +""" Dependency check proposed-updates """ # Copyright (C) 2001, 2002, 2004, 2006 James Troup # This program is free software; you can redistribute it and/or modify @@ -20,18 +20,19 @@ ################################################################################ # | > 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 +from daklib.regexes import re_no_epoch ################################################################################ @@ -91,7 +92,7 @@ def check_dep (depends, dep_type, check_archs, filename, files): unsat = 0 break # As part of the same .changes? - epochless_version = utils.re_no_epoch.sub('', version) + epochless_version = re_no_epoch.sub('', version) dep_filename = "%s_%s_%s.deb" % (dep, epochless_version, arch) if files.has_key(dep_filename): if Options["debug"]: @@ -175,6 +176,9 @@ def check_changes (filename): try: changes = utils.parse_changes(filename) files = utils.build_file_list(changes) + except ChangesUnicodeError: + utils.warn("Improperly encoded changes file, not utf-8") + return except: utils.warn("Error parsing changes file '%s'" % (filename)) return @@ -183,16 +187,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 +214,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 +232,7 @@ def check_joey (filename): if Options["debug"]: print "Processing %s..." % (changes_filename) check_changes(changes_filename) - file.close() + f.close() os.chdir(cwd) @@ -241,7 +245,7 @@ def parse_packages(): suite = "stable" stable = {} components = Cnf.ValueList("Suite::%s::Components" % (suite)) - architectures = filter(utils.real_arch, Cnf.ValueList("Suite::%s::Architectures" % (suite))) + architectures = filter(utils.real_arch, database.get_suite_architectures(suite)) for component in components: for architecture in architectures: filename = "%s/dists/%s/%s/binary-%s/Packages" % (Cnf["Dir::Root"], suite, component, architecture) @@ -274,8 +278,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 +296,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)) #######################################################################################