提交 a29878d1 编写于 作者: J Joerg Jaspert

Fix a number of syntax errors. Also do not remove elements from a dict where we iterate through

上级 7a7563b8
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
################################################################################ ################################################################################
import os, sys import os, pg, sys
import apt_pkg import apt_pkg
import daklib.database import daklib.database
import daklib.utils import daklib.utils
...@@ -70,6 +70,9 @@ def usage (exit_code=0): ...@@ -70,6 +70,9 @@ def usage (exit_code=0):
def main(): def main():
global Cnf global Cnf
init()
# Only check if there is a file defined (and existant) with checks. It's a little bit # Only check if there is a file defined (and existant) with checks. It's a little bit
# specific to Debian, not much use for others, so return early there. # specific to Debian, not much use for others, so return early there.
if not Cnf.has_key("Dinstall::Reject::ReleaseTransitions") or not os.path.exists("%s" % (Cnf["Dinstall::Reject::ReleaseTransitions"])): if not Cnf.has_key("Dinstall::Reject::ReleaseTransitions") or not os.path.exists("%s" % (Cnf["Dinstall::Reject::ReleaseTransitions"])):
...@@ -79,8 +82,9 @@ def main(): ...@@ -79,8 +82,9 @@ def main():
# Parse the yaml file # Parse the yaml file
sourcefile = file(Cnf["Dinstall::Reject::ReleaseTransitions"], 'r') sourcefile = file(Cnf["Dinstall::Reject::ReleaseTransitions"], 'r')
sourcecontent = sourcefile.read()
try: try:
transitions = load(sourcefile) transitions = load(sourcecontent)
except error, msg: except error, msg:
# This shouldn't happen, the release team has a wrapper to check the file, but better # This shouldn't happen, the release team has a wrapper to check the file, but better
# safe then sorry # safe then sorry
...@@ -88,9 +92,9 @@ def main(): ...@@ -88,9 +92,9 @@ def main():
sys.exit(2) sys.exit(2)
to_dump = 0 to_dump = 0
to_remove = []
# Now look through all defined transitions # Now look through all defined transitions
for trans in transition: for trans in transitions:
t = transition[trans] t = transition[trans]
source = t["source"] source = t["source"]
new_vers = t["new"] new_vers = t["new"]
...@@ -99,15 +103,13 @@ def main(): ...@@ -99,15 +103,13 @@ def main():
curvers = daklib.database.get_testing_version(source) curvers = daklib.database.get_testing_version(source)
print """ print """
Looking at transition: %s Looking at transition: %s
Source: %s Source: %s
New Version: %s New Version: %s
Responsible: %s Responsible: %s
Reason: %s Reason: %s
Blocked Packages (total: %d): Blocked Packages (total: %d): %s
""" % (trans, source, new_vers, t["rm"], t["reason"]) """ % (trans, source, new_vers, t["rm"], t["reason"], len(t["packages"]), ", ".join(t["packages"]))
for i in t["packages"]:
print " %s" % (i)
if curvers and apt_pkg.VersionCompare(new_vers, curvers) == 1: if curvers and apt_pkg.VersionCompare(new_vers, curvers) == 1:
# This is still valid, the current version in database is older than # This is still valid, the current version in database is older than
...@@ -116,13 +118,15 @@ def main(): ...@@ -116,13 +118,15 @@ def main():
else: else:
print "This transition is over, the target package reached testing, removing" print "This transition is over, the target package reached testing, removing"
print "%s wanted version: %s, has %s" % (source, new_vers, curvers) print "%s wanted version: %s, has %s" % (source, new_vers, curvers)
del transition[trans] to_remove.append(trans)
to_dump = 1 to_dump = 1
print "-------------------------------------------------------------------------" print "-------------------------------------------------------------------------"
if to_dump: if to_dump:
for remove in to_remove:
del transitions[remove]
destfile = file(Cnf["Dinstall::Reject::ReleaseTransitions"], 'w') destfile = file(Cnf["Dinstall::Reject::ReleaseTransitions"], 'w')
dump(transition, destfile) dump(transitions, destfile)
################################################################################ ################################################################################
......
...@@ -1013,8 +1013,9 @@ def check_transition(sourcepkg): ...@@ -1013,8 +1013,9 @@ def check_transition(sourcepkg):
# Parse the yaml file # Parse the yaml file
sourcefile = file(Cnf["Dinstall::Reject::ReleaseTransitions"], 'r') sourcefile = file(Cnf["Dinstall::Reject::ReleaseTransitions"], 'r')
sourcecontent = sourcefile.read()
try: try:
transitions = load(sourcefile) transitions = load(sourcecontent)
except error, msg: except error, msg:
# This shouldn't happen, the release team has a wrapper to check the file, but better # This shouldn't happen, the release team has a wrapper to check the file, but better
# safe then sorry # safe then sorry
...@@ -1022,8 +1023,8 @@ def check_transition(sourcepkg): ...@@ -1022,8 +1023,8 @@ def check_transition(sourcepkg):
return return
# Now look through all defined transitions # Now look through all defined transitions
for trans in transition: for trans in transitions:
t = transition[trans] t = transitions[trans]
source = t["source"] source = t["source"]
new_vers = t["new"] new_vers = t["new"]
......
...@@ -41,6 +41,7 @@ maintainer_cache = {} ...@@ -41,6 +41,7 @@ maintainer_cache = {}
fingerprint_id_cache = {} fingerprint_id_cache = {}
queue_id_cache = {} queue_id_cache = {}
uid_id_cache = {} uid_id_cache = {}
testing_version_cache = {}
################################################################################ ################################################################################
...@@ -229,7 +230,7 @@ def get_testing_version(source): ...@@ -229,7 +230,7 @@ def get_testing_version(source):
if testing_version_cache.has_key(source): if testing_version_cache.has_key(source):
return testing_version_cache[source] return testing_version_cache[source]
q = Upload.projectB.query(""" q = projectB.query("""
SELECT s.version FROM source s, suite su, src_associations sa SELECT s.version FROM source s, suite su, src_associations sa
WHERE sa.source=s.id WHERE sa.source=s.id
AND sa.suite=su.id AND sa.suite=su.id
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册