]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/queue.py
merge ftpmaster branch
[dak.git] / daklib / queue.py
old mode 100755 (executable)
new mode 100644 (file)
index 3169e7a..9f8223a
@@ -106,12 +106,12 @@ def get_type(f):
     elif f["type"] in [ "orig.tar.gz", "orig.tar.bz2", "tar.gz", "tar.bz2", "diff.gz", "diff.bz2", "dsc" ]:
         type = "dsc"
     else:
-        fubar("invalid type (%s) for new.  Dazed, confused and sure as heck not continuing." % (type))
+        utils.fubar("invalid type (%s) for new.  Dazed, confused and sure as heck not continuing." % (type))
 
     # Validate the override type
     type_id = database.get_override_type_id(type)
     if type_id == -1:
-        fubar("invalid type (%s) for new.  Say wha?" % (type))
+        utils.fubar("invalid type (%s) for new.  Say wha?" % (type))
 
     return type
 
@@ -134,72 +134,6 @@ def check_valid(new):
            (priority != "source" and type == "dsc"):
             new[pkg]["priority id"] = -1
 
-################################################################################
-
-# We reject packages if the release team defined a transition for them
-def check_transition(sourcepkg, cleanup=0):
-    to_dump = 0
-
-    # 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.
-    if not Cnf.has_key("Dinstall::Reject::ReleaseTransitions") and
-    not os.path.exists("%s" % (Cnf["Dinstall::Reject::ReleaseTransitions"])):
-        return
-    
-    # Parse the yaml file
-    sourcefile = file(Cnf["Dinstall::Reject::ReleaseTransitions"], 'r')
-    try:
-        transitions = load(sourcefile)
-    except error, msg:
-        utils.warn("Not checking transitions, the transitions file is broken: %s." % (msg))
-        return
-
-    # Now look through all defined transitions
-    for trans in transition:
-        t = transition[trans]
-        # We check if the transition is still valid
-        # If not we remove the whole setting from the dictionary and later dump it,
-        # so we don't process it again.
-        source = t["source"]
-        new_vers = t["new"]
-        q = Upload.projectB.query("""
-        SELECT s.version FROM source s, suite su, src_associations sa
-        WHERE sa.source=s.id
-          AND sa.suite=su.id
-          AND su.suite_name='testing'
-          AND s.source='%s'"""
-                                % (source))
-        ql = q.getresult()
-        if ql and apt_pkg.VersionCompare(new_vers, ql[0][0]) == 1:
-            # This is still valid, the current version in database is older than
-            # the new version we wait for
-
-            # Check if the source we look at is affected by this.
-            if sourcepkg in t['packages']:
-                # The source is affected, lets reject it.
-                reject("""%s: part of the %s transition.
-
-                Your package is part of a testing transition to get %s migrated.
-
-                Transition description: %s
-
-                This transition will finish when %s, version %s, reaches testing.
-                This transition is managed by the Release Team and %s
-                is the Release-Team member responsible for it.
-                Please contact them or debian-release@lists.debian.org if you
-                need further assistance.
-                """
-                       % (sourcepkg, trans, source, t["reason"], source, new_vers, t["rm"]))
-                return 0
-        else:
-            # We either have the wanted or a newer version in testing, or the package got
-            # removed completly. In that case we don't need to keep the transition blocker
-            del transition[trans]
-            to_dump = 1
-
-    if cleanup and to_dump:
-        destfile = file(Cnf["Dinstall::Reject::ReleaseTransitions"], 'w')
-        dump(transition, destfile)
 
 ###############################################################################
 
@@ -298,7 +232,8 @@ class Upload:
                    "closes", "changes" ]:
             d_changes[i] = changes[i]
         # Optional changes fields
-        for i in [ "changed-by", "filecontents", "format", "process-new note", "adv id", "distribution-version" ]:
+        for i in [ "changed-by", "filecontents", "format", "process-new note", "adv id", "distribution-version",
+                   "sponsoremail" ]:
             if changes.has_key(i):
                 d_changes[i] = changes[i]
         ## dsc
@@ -350,6 +285,10 @@ class Upload:
             Subst["__MAINTAINER_FROM__"] = changes["maintainer2047"]
             Subst["__MAINTAINER_TO__"] = changes["maintainer2047"]
             Subst["__MAINTAINER__"] = changes.get("maintainer", "Unknown")
+
+        if "sponsoremail" in changes:
+            Subst["__MAINTAINER_TO__"] += ", %s"%changes["sponsoremail"]
+
         if self.Cnf.has_key("Dinstall::TrackingServer") and changes.has_key("source"):
             Subst["__MAINTAINER_TO__"] += "\nBcc: %s@%s" % (changes["source"], self.Cnf["Dinstall::TrackingServer"])
 
@@ -395,8 +334,8 @@ class Upload:
                 files[file]["pool name"] = utils.poolify (changes.get("source",""), files[file]["component"])
                 destination = self.Cnf["Dir::PoolRoot"] + files[file]["pool name"] + file
                 summary += file + "\n  to " + destination + "\n"
-               if not files[file].has_key("type"):
-                   files[file]["type"] = "unknown"
+                if not files[file].has_key("type"):
+                    files[file]["type"] = "unknown"
                 if files[file]["type"] in ["deb", "udeb", "dsc"]:
                     # (queue/unchecked), there we have override entries already, use them
                     # (process-new), there we dont have override entries, use the newly generated ones.
@@ -779,26 +718,26 @@ distribution."""
     # (2) Bin-only NMU                     => 1.0-3+b1 , 1.0-3.1+b1
 
     def source_exists (self, package, source_version, suites = ["any"]):
-       okay = 1
-       for suite in suites:
-           if suite == "any":
-               que = "SELECT s.version FROM source s WHERE s.source = '%s'" % \
-                   (package)
-           else:
-               # source must exist in suite X, or in some other suite that's
-               # mapped to X, recursively... silent-maps are counted too,
-               # unreleased-maps aren't.
-               maps = self.Cnf.ValueList("SuiteMappings")[:]
-               maps.reverse()
-               maps = [ m.split() for m in maps ]
-               maps = [ (x[1], x[2]) for x in maps
-                               if x[0] == "map" or x[0] == "silent-map" ]
-               s = [suite]
-               for x in maps:
-                       if x[1] in s and x[0] not in s:
-                               s.append(x[0])
-
-               que = "SELECT s.version FROM source s JOIN src_associations sa ON (s.id = sa.source) JOIN suite su ON (sa.suite = su.id) WHERE s.source = '%s' AND (%s)" % (package, " OR ".join(["su.suite_name = '%s'" % a for a in s]))
+        okay = 1
+        for suite in suites:
+            if suite == "any":
+                que = "SELECT s.version FROM source s WHERE s.source = '%s'" % \
+                    (package)
+            else:
+                # source must exist in suite X, or in some other suite that's
+                # mapped to X, recursively... silent-maps are counted too,
+                # unreleased-maps aren't.
+                maps = self.Cnf.ValueList("SuiteMappings")[:]
+                maps.reverse()
+                maps = [ m.split() for m in maps ]
+                maps = [ (x[1], x[2]) for x in maps
+                                if x[0] == "map" or x[0] == "silent-map" ]
+                s = [suite]
+                for x in maps:
+                    if x[1] in s and x[0] not in s:
+                        s.append(x[0])
+
+                que = "SELECT s.version FROM source s JOIN src_associations sa ON (s.id = sa.source) JOIN suite su ON (sa.suite = su.id) WHERE s.source = '%s' AND (%s)" % (package, " OR ".join(["su.suite_name = '%s'" % a for a in s]))
             q = self.projectB.query(que)
 
             # Reduce the query results to a list of version numbers
@@ -815,11 +754,11 @@ distribution."""
 
             # No source found...
             okay = 0
-           break
-       return okay
+            break
+        return okay
 
     ################################################################################
-    
+
     def in_override_p (self, package, component, suite, binary_type, file):
         files = self.pkg.files
 
@@ -903,12 +842,12 @@ distribution."""
                     ch = self.pkg.changes
                     cansave = 0
                     if ch.get('distribution-version', {}).has_key(suite):
-                        # we really use the other suite, ignoring the conflicting one ...
+                    # we really use the other suite, ignoring the conflicting one ...
                         addsuite = ch["distribution-version"][suite]
-                    
+
                         add_version = self.get_anyversion(query_result, addsuite)
                         target_version = self.get_anyversion(query_result, target_suite)
-                    
+
                         if not add_version:
                             # not add_version can only happen if we map to a suite
                             # that doesn't enhance the suite we're propup'ing from.
@@ -939,7 +878,7 @@ distribution."""
                             self.pkg.changes.setdefault("propdistribution", {})
                             self.pkg.changes["propdistribution"][addsuite] = 1
                             cansave = 1
-                
+
                     if not cansave:
                         self.reject("%s: old version (%s) in %s <= new version (%s) targeted at %s." % (file, existent_version, suite, new_version, target_suite))
 
@@ -1094,8 +1033,8 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su
 
                     in_unchecked = os.path.join(self.Cnf["Dir::Queue::Unchecked"],dsc_file)
                     # See process_it() in 'dak process-unchecked' for explanation of this
-                   # in_unchecked check dropped by ajt 2007-08-28, how did that
-                   # ever make sense?
+                    # in_unchecked check dropped by ajt 2007-08-28, how did that
+                    # ever make sense?
                     if os.path.exists(in_unchecked) and False:
                         return (self.reject_message, in_unchecked)
                     else: