X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Foverride.py;h=72b0836e57810cfbcff2aeeb3e554d00d13fb265;hb=935bd2ad8079341123590d80658562d81ac87c86;hp=ca3cb41d6a77d2245c25afd56454a51d59805ebb;hpb=16f731a893f0ba036a995c25b8b5f3490394070e;p=dak.git diff --git a/dak/override.py b/dak/override.py index ca3cb41d..72b0836e 100755 --- a/dak/override.py +++ b/dak/override.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Microscopic modification and query tool for overrides in projectb +""" Microscopic modification and query tool for overrides in projectb """ # Copyright (C) 2004, 2006 Daniel Silverstone # This program is free software; you can redistribute it and/or modify @@ -27,7 +27,7 @@ import pg, sys import apt_pkg -from daklib import logging +from daklib import daklog from daklib import database from daklib import utils @@ -107,9 +107,9 @@ def main (): # Retrieve current section/priority... oldsection, oldsourcesection, oldpriority = None, None, None - for type in ['source', 'binary']: + for packagetype in ['source', 'binary']: eqdsc = '!=' - if type == 'source': + if packagetype == 'source': eqdsc = '=' q = projectB.query(""" SELECT priority.priority AS prio, section.section AS sect, override_type.type AS type @@ -129,11 +129,12 @@ def main (): utils.fubar("%s is ambiguous. Matches %d packages" % (package,q.ntuples())) r = q.getresult() - if type == 'binary': + if packagetype == 'binary': oldsection = r[0][1] oldpriority = r[0][0] else: oldsourcesection = r[0][1] + oldpriority = 'source' if not oldpriority and not oldsourcesection: utils.fubar("Unable to find package %s" % (package)) @@ -144,13 +145,8 @@ def main (): oldsection = oldsourcesection if not arguments: - if oldpriority: - print "%s is in section '%s' at priority '%s'" % ( - package,oldsection,oldpriority) - elif oldsourcesection: - # no use printing this line if also binary - print "%s is in section '%s'" % ( - package,oldsourcesection) + print "%s is in section '%s' at priority '%s'" % ( + package,oldsection,oldpriority) sys.exit(0) # At this point, we have a new section and priority... check they're valid... @@ -179,8 +175,8 @@ def main (): print "I: Doing nothing" sys.exit(0) - if newpriority and not oldpriority: - utils.fubar("Trying to set priority of a source-only package") + if oldpriority == 'source' and newpriority != 'source': + utils.fubar("Trying to change priority of a source-only package") # If we're in no-action mode if Options["No-Action"]: @@ -206,7 +202,7 @@ def main (): game_over() - Logger = logging.Logger(Cnf, "override") + Logger = daklog.Logger(Cnf, "override") projectB.query("BEGIN WORK") # We're in "do it" mode, we have something to do... do it