- for i in q.getresult():
- package = i[0];
- if type == "deb" or type == "udeb":
- if not packages.has_key(package):
- if not src_packages.has_key(package):
- print "DELETING: %s" % (package);
- if not Options["No-Action"]:
- projectB.query("DELETE FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s" % (package, suite_id, component_id, type_id));
- else:
- print "MAKING SOURCE: %s" % (package);
- if not Options["No-Action"]:
- projectB.query("DELETE FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s" % (package, suite_id, component_id, type_id));
- # Then if source doesn't already have a copy, insert it into source
- q = projectB.query("SELECT package FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s" % (package, suite_id, component_id, dsc_type_id));
- if not q.getresult() and not Options["No-Action"]:
- projectB.query("INSERT INTO override (package, suite, component, priority, section, type, maintainer) VALUES ('%s', %s, %s, %s, %s, %s, '%s')" % (package, suite_id, component_id, i[1], i[2], dsc_type_id, i[3]));
- else: # dsc
- if not src_packages.has_key(package):
- print "DELETING: %s" % (package);
+ if type == "dsc":
+ for i in q.getresult():
+ package = i[0];
+ if src_packages.has_key(package):
+ src_packages[package] = 1
+ else:
+ if blacklist.has_key(package):
+ utils.warn("%s in incoming, not touching" % package)
+ continue
+ Logger.log(["removing unused override", osuite, component,
+ type, package, priorities[i[1]], sections[i[2]], i[3]])
+ if not Options["No-Action"]:
+ projectB.query("""DELETE FROM override WHERE package =
+ '%s' AND suite = %s AND component = %s AND type =
+ %s""" % (package, osuite_id, component_id, type_id));
+ # create source overrides based on binary overrides, as source
+ # overrides not always get created
+ q = projectB.query(""" SELECT package, priority, section,
+ maintainer FROM override WHERE suite = %s AND component = %s
+ """ % (osuite_id, component_id));
+ for i in q.getresult():
+ package = i[0]
+ if not src_packages.has_key(package) or src_packages[package]:
+ continue
+ src_packages[package] = 1
+
+ Logger.log(["add missing override", osuite, component,
+ type, package, "source", sections[i[2]], i[3]])
+ if not Options["No-Action"]:
+ projectB.query("""INSERT INTO override (package, suite,
+ component, priority, section, type, maintainer) VALUES
+ ('%s', %s, %s, %s, %s, %s, '%s')""" % (package,
+ osuite_id, component_id, source_priority_id, i[2],
+ dsc_type_id, i[3]));
+ # Check whether originosuite has an override for us we can
+ # copy
+ if originosuite:
+ q = projectB.query("""SELECT origin.package, origin.priority,
+ origin.section, origin.maintainer, target.priority,
+ target.section, target.maintainer FROM override origin LEFT
+ JOIN override target ON (origin.package = target.package AND
+ target.suite=%s AND origin.component = target.component AND origin.type =
+ target.type) WHERE origin.suite = %s AND origin.component = %s
+ AND origin.type = %s""" %
+ (osuite_id, originosuite_id, component_id, type_id));
+ for i in q.getresult():
+ package = i[0]
+ if not src_packages.has_key(package) or src_packages[package]:
+ if i[4] and (i[1] != i[4] or i[2] != i[5] or i[3] != i[6]):
+ Logger.log(["syncing override", osuite, component,
+ type, package, "source", sections[i[5]], i[6], "source", sections[i[2]], i[3]])
+ if not Options["No-Action"]:
+ projectB.query("""UPDATE override SET section=%s,
+ maintainer='%s' WHERE package='%s' AND
+ suite=%s AND component=%s AND type=%s""" %
+ (i[2], i[3], package, osuite_id, component_id,
+ dsc_type_id));
+ continue
+ # we can copy
+ src_packages[package] = 1
+ Logger.log(["copying missing override", osuite, component,
+ type, package, "source", sections[i[2]], i[3]])
+ if not Options["No-Action"]:
+ projectB.query("""INSERT INTO override (package, suite,
+ component, priority, section, type, maintainer) VALUES
+ ('%s', %s, %s, %s, %s, %s, '%s')""" % (package,
+ osuite_id, component_id, source_priority_id, i[2],
+ dsc_type_id, i[3]));
+
+ for package, hasoverride in src_packages.items():
+ if not hasoverride:
+ utils.warn("%s has no override!" % package)
+
+ else: # binary override
+ for i in q.getresult():
+ package = i[0];
+ if packages.has_key(package):
+ packages[package] = 1
+ else:
+ if blacklist.has_key(package):
+ utils.warn("%s in incoming, not touching" % package)
+ continue
+ Logger.log(["removing unused override", osuite, component,
+ type, package, priorities[i[1]], sections[i[2]], i[3]])