1 import sys, os, textwrap
4 import daklib.utils, daklib.database
7 import daklib.extensions
8 from daklib.extensions import replace_dak_function
10 def check_transition():
11 changes = dak_module.changes
12 reject = dak_module.reject
15 sourcepkg = changes["source"]
17 # No sourceful upload -> no need to do anything else, direct return
18 if "source" not in changes["architecture"]:
21 # Also only check if there is a file defined (and existant) with
23 transpath = Cnf.get("Dinstall::Reject::ReleaseTransitions", "")
24 if transpath == "" or not os.path.exists(transpath):
28 sourcefile = file(transpath, 'r')
29 sourcecontent = sourcefile.read()
31 transitions = syck.load(sourcecontent)
32 except syck.error, msg:
33 # This shouldn't happen, there is a wrapper to edit the file which
34 # checks it, but we prefer to be safe than ending up rejecting
36 daklib.utils.warn("Not checking transitions, the transitions file is broken: %s." % (msg))
39 # Now look through all defined transitions
40 for trans in transitions:
41 t = transitions[trans]
45 # Will be None if nothing is in testing.
46 current = daklib.database.get_suite_version(source, "testing")
47 if current is not None:
48 compare = apt_pkg.VersionCompare(current, expected)
50 if current is None or compare < 0:
51 # This is still valid, the current version in testing is older than
52 # the new version we wait for, or there is none in testing yet
54 # Check if the source we look at is affected by this.
55 if sourcepkg in t['packages']:
56 # The source is affected, lets reject it.
58 rejectmsg = "%s: part of the %s transition.\n\n" % (
61 if current is not None:
62 currentlymsg = "at version %s" % (current)
64 currentlymsg = "not present in testing"
66 rejectmsg += "Transition description: %s\n\n" % (t["reason"])
68 rejectmsg += "\n".join(textwrap.wrap("""Your package
69 is part of a testing transition designed to get %s migrated (it is
70 currently %s, we need version %s). This transition is managed by the
71 Release Team, and %s is the Release-Team member responsible for it.
72 Please mail debian-release@lists.debian.org or contact %s directly if you
73 need further assistance."""
74 % (source, currentlymsg, expected,t["rm"], t["rm"])))
76 reject(rejectmsg + "\n")
79 @replace_dak_function("process-unchecked", "check_signed_by_key")
80 def check_signed_by_key(oldfn):
81 changes = dak_module.changes
82 reject = dak_module.reject
84 if changes["source"] == "dpkg":
85 fpr = changes["fingerprint"]
86 (uid, uid_name) = dak_module.lookup_uid_from_fingerprint(fpr)
87 if fpr == "5906F687BD03ACAD0D8E602EFCF37657" or uid == "iwj":
88 reject("Upload blocked due to hijack attempt 2008/03/19")
90 # NB: 1.15.0, 1.15.2 signed by this key targetted at unstable
91 # have been made available in the wild, and should remain
92 # blocked until Debian's dpkg has revved past those version