re_fdnic = re.compile(r"\n\n")
re_bin_only_nmu = re.compile(r"\+b\d+$")
+################################################################################
+
+# Determine what parts in a .changes are NEW
+
+def determine_new(changes, files, projectB, warn=1):
+ new = {}
+
+ # Build up a list of potentially new things
+ for file in files.keys():
+ f = files[file]
+ # Skip byhand elements
+ if f["type"] == "byhand":
+ continue
+ pkg = f["package"]
+ priority = f["priority"]
+ section = f["section"]
+ type = get_type(f)
+ component = f["component"]
+
+ if type == "dsc":
+ priority = "source"
+ if not new.has_key(pkg):
+ new[pkg] = {}
+ new[pkg]["priority"] = priority
+ new[pkg]["section"] = section
+ new[pkg]["type"] = type
+ new[pkg]["component"] = component
+ new[pkg]["files"] = []
+ else:
+ old_type = new[pkg]["type"]
+ if old_type != type:
+ # source gets trumped by deb or udeb
+ if old_type == "dsc":
+ new[pkg]["priority"] = priority
+ new[pkg]["section"] = section
+ new[pkg]["type"] = type
+ new[pkg]["component"] = component
+ new[pkg]["files"].append(file)
+ if f.has_key("othercomponents"):
+ new[pkg]["othercomponents"] = f["othercomponents"]
+
+ for suite in changes["suite"].keys():
+ suite_id = database.get_suite_id(suite)
+ for pkg in new.keys():
+ component_id = database.get_component_id(new[pkg]["component"])
+ type_id = database.get_override_type_id(new[pkg]["type"])
+ q = projectB.query("SELECT package FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s" % (pkg, suite_id, component_id, type_id))
+ ql = q.getresult()
+ if ql:
+ for file in new[pkg]["files"]:
+ if files[file].has_key("new"):
+ del files[file]["new"]
+ del new[pkg]
+
+ if warn:
+ if changes["suite"].has_key("stable"):
+ print "WARNING: overrides will be added for stable!"
+ if changes["suite"].has_key("oldstable"):
+ print "WARNING: overrides will be added for OLDstable!"
+ for pkg in new.keys():
+ if new[pkg].has_key("othercomponents"):
+ print "WARNING: %s already present in %s distribution." % (pkg, new[pkg]["othercomponents"])
+
+ return new
+
+################################################################################
+
+def get_type(f):
+ # Determine the type
+ if f.has_key("dbtype"):
+ type = f["dbtype"]
+ elif f["type"] in [ "orig.tar.gz", "orig.tar.bz2", "tar.gz", "tar.bz2", "diff.gz", "diff.bz2", "dsc" ]:
+ type = "dsc"
+ else:
+ 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:
+ utils.fubar("invalid type (%s) for new. Say wha?" % (type))
+
+ return type
+
+################################################################################
+
+# check if section/priority values are valid
+
+def check_valid(new):
+ for pkg in new.keys():
+ section = new[pkg]["section"]
+ priority = new[pkg]["priority"]
+ type = new[pkg]["type"]
+ new[pkg]["section id"] = database.get_section_id(section)
+ new[pkg]["priority id"] = database.get_priority_id(new[pkg]["priority"])
+ # Sanity checks
+ di = section.find("debian-installer") != -1
+ if (di and type != "udeb") or (not di and type == "udeb"):
+ new[pkg]["section id"] = -1
+ if (priority == "source" and type != "dsc") or \
+ (priority != "source" and type == "dsc"):
+ new[pkg]["priority id"] = -1
+
+
###############################################################################
# Convenience wrapper to carry around all the package information in
"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
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"])
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.
# (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
# 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
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.
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))
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: