def read_urgencies(file, testing, unstable): urgency = {} f = open(file) line = f.readline() while line: l = string.split(line) if len(l) == 3: uo = urgency.get(l[0], defaulturgency) mo = mindays.get(uo, mindays[defaulturgency]) mn = mindays.get(l[2], mindays[defaulturgency]) if mo <= mn: line = f.readline() continue tsrcv = testing.get_version(l[0]) if tsrcv and britney.versioncmp(tsrcv, l[1]) >= 0: line = f.readline() continue usrcv = unstable.get_version(l[0]) if not usrcv or britney.versioncmp(usrcv, l[1]) < 0: line = f.readline() continue urgency[l[0]] = l[2] line = f.readline() f.close() return urgency
def maxver(pkg, source, pkgs): maxver = source.get_version(pkg) for arch in arches: pkgv = pkgs[arch].get_version(pkg) if pkgv == None: continue if maxver == None or britney.versioncmp(pkgv, maxver) > 0: maxver = pkgv return maxver
def should_upgrade_src(src, suite, orig, origpkgs, new, newpkgs, approvals, excs): srcv = new.get_version(src) if orig.is_present(src): tsrcv = orig.get_version(src) if britney.versioncmp(srcv, tsrcv) == 0: # Candidate for binnmus only return 0 else: tsrcv = None updatecand = 1 ref = src if suite: ref = ref + "_tpu" exc = Excuse(ref) exc.set_vers(tsrcv, srcv) m = new.get_field(src, "Maintainer") if m: exc.set_maint(string.strip(m)) s = new.get_field(src, "Section") if s: exc.set_section(string.strip(s)) if tsrcv and britney.versioncmp(srcv, tsrcv) < 0: # Version in unstable is older! exc.addhtml("ALERT: %s is newer in testing (%s %s)" % (src, tsrcv, srcv)) excs.append(exc) return 0 if unstable.is_fake(src): exc.addhtml("%s source package doesn't exist" % (src)) updatecand = 0 urgency = unstableurg.get(src, defaulturgency) if hints["remove"].has_key(src): if (tsrcv and same_source(tsrcv, hints["remove"][src][0])) or \ same_source(srcv, hints["remove"][src][0]): exc.addhtml("Removal request by %s" % (hints["remove"][src][1])) exc.addhtml("Trying to remove package, not update it") updatecand = 0 if src in allowremovepkgs: exc.addhtml("Trying to remove package, not update it") updatecand = 0 if src in donttouch: exc.addhtml("Not touching package") updatecand = 0 if suite == None: if not unstabledates.has_key(src): unstabledates[src] = (srcv, datenow) elif not same_source(unstabledates[src][0], srcv): unstabledates[src] = (srcv, datenow) daysold = datenow - unstabledates[src][1] mymindays = mindays[urgency] if src in frozen: exc.addhtml("Package is in freeze, doubling delay") mymindays = mymindays * 2 exc.setdaysold(daysold, mymindays) if daysold < mymindays: updatecand = 0 pkgs = { src: ["source"] } anybins = 0 for arch in arches: oodbins = {} for pkg in new.binaries(src,arch): anybins = 1 if not pkgs.has_key(pkg): pkgs[pkg] = [] pkgs[pkg].append(arch) pkgsv = newpkgs[arch].get_sourcever(pkg) if not same_source(srcv, pkgsv): if not oodbins.has_key(pkgsv): oodbins[pkgsv] = [] oodbins[pkgsv].append(pkg) continue if newpkgs[arch].isnt_arch_all(pkg) or \ arch in nobreakarchallarches: excuse_unsat_deps(pkg, arch, origpkgs[arch], newpkgs[arch], exc) if oodbins: oodtxt = "" for v in oodbins.keys(): if oodtxt: oodtxt = oodtxt + "; " oodtxt = oodtxt + "%s (from <a href=\"http://buildd.debian.org/build.php?arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>)" % \ (string.join(oodbins[v], ", "), arch, src, v, v) text = "out of date on <a href=\"http://buildd.debian.org/build.php?arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>: %s" % (arch, src, srcv, arch, oodtxt) if arch in fuckedarches: text = text + " (but %s isn't keeping up," % \ (arch) + " so nevermind)" else: updatecand = 0 if datenow != unstabledates[src][1]: exc.addhtml(text) if not anybins: exc.addhtml("%s has no binaries on any arch" % src) updatecand = 0 if suite == None: for pkg in pkgs.keys(): if not testingbugs.has_key(pkg): testingbugs[pkg] = 0 if not unstablebugs.has_key(pkg): unstablebugs[pkg] = 0 if unstablebugs[pkg] > testingbugs[pkg]: exc.addhtml("%s (%s) is <a href=\"http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=pkg&data=%s&sev-inc=critical&sev-inc=grave&sev-inc=serious\" target=\"_blank\">buggy</a>! (%d > %d)" % \ (pkg, string.join(pkgs[pkg], ", "), pkg, unstablebugs[pkg], testingbugs[pkg])) updatecand = 0 elif unstablebugs[pkg] > 0: exc.addhtml("%s (%s) is (less) <a href=\"http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=pkg&data=%s&sev-inc=critical&sev-inc=grave&sev-inc=serious\" target=\"_blank\">buggy</a>! (%d <= %d)" % \ (pkg, string.join(pkgs[pkg], ", "), pkg, unstablebugs[pkg], testingbugs[pkg])) if suite == None: if not updatecand and src in dosrcanyway: exc.addhtml("Should ignore, but considering anyway") updatecand = 1 if approvals: if approvals.has_key("%s_%s" % (src, srcv)): exc.addhtml("Approved by %s" % approvals["%s_%s" % (src, srcv)]) else: exc.addhtml("NEEDS APPROVAL BY RM") updatecand = 0 if updatecand: exc.addhtml("Valid candidate") else: exc.addhtml("Not considered") excuses.append(exc) return updatecand
def should_upgrade_srcarch(src, arch, suite, tsrcv, orig, opkgsa, new, npkgsa, excs): # binnmu this arch? anywrongver = 0 anyworthdoing = 0 ref = "%s/%s" % (src, arch) if suite: ref = ref + "_%s" % (suite) e = Excuse(ref) e.set_vers(tsrcv, tsrcv) m = new.get_field(src, "Maintainer") if m: e.set_maint(string.strip(m)) s = new.get_field(src, "Section") if s: e.set_section(string.strip(s)) if ref in donttouch: e.addhtml("Not touching package") e.addhtml("Not considered") excs.append(e) return 0 if hints["remove"].has_key(src): if same_source(tsrcv, hints["remove"][src][0]): e.addhtml("Removal request by %s" % (hints["remove"][src][1])) e.addhtml("Trying to remove package, not update it") e.addhtml("Not considered") excs.append(e) return 0 if src in allowremovepkgs: e.addhtml("Trying to remove package, not update it") e.addhtml("Not considered") excs.append(e) return 0 for pkg in new.binaries(src, arch): pkgv = npkgsa.get_version(pkg) pkgsv = npkgsa.get_sourcever(pkg) if npkgsa.is_arch_all(pkg): e.addhtml("Ignoring %s %s (from %s) as it is arch: all" % (pkg, pkgv, pkgsv)) continue if not same_source(tsrcv, pkgsv): anywrongver = 1 e.addhtml("From wrong source: %s %s (%s not %s)" % ( pkg, pkgv, pkgsv, tsrcv)) break if not opkgsa.is_present(pkg): e.addhtml("New binary: %s (%s)" % (pkg, pkgv)) anyworthdoing = 1 continue tpkgv = opkgsa.get_version(pkg) if britney.versioncmp(tpkgv, pkgv) > 0: anywrongver = 1 e.addhtml("Not downgrading: %s (%s to %s)" % ( pkg, tpkgv, pkgv)) break elif britney.versioncmp(tpkgv, pkgv) < 0: e.addhtml("Updated binary: %s (%s to %s)" % ( pkg, tpkgv, pkgv)) anyworthdoing = 1 if not anywrongver and (anyworthdoing or not new.is_fake(src)): srcv = new.get_version(src) ssrc = same_source(tsrcv, srcv) for pkg in orig.binaries(src, arch): if opkgsa.is_arch_all(pkg): e.addhtml("Ignoring removal of %s as it is arch: all" % (pkg)) continue if not npkgsa.is_present(pkg): tpkgv = opkgsa.get_version(pkg) e.addhtml("Removed binary: %s %s" % ( pkg, tpkgv)) if ssrc: anyworthdoing = 1 if not anywrongver and anyworthdoing: e.addhtml("Valid candidate") excs.append(e) return 1 else: if anyworthdoing: e.addhtml("Not considered") excs.append(e) return 0
for pkg in testingbugs.keys() + unstablebugs.keys(): if not testingbugs.has_key(pkg): testingbugs[pkg] = 0 if not unstablebugs.has_key(pkg): unstablebugs[pkg] = 0 maxvert = maxver(pkg, testing, testingpkgs) if maxvert == None: testingbugs[pkg] = 0 continue if testingbugs[pkg] == unstablebugs[pkg]: continue maxveru = maxver(pkg, unstable, unstablepkgs) if maxveru == None: continue if britney.versioncmp(maxvert, maxveru) >= 0: testingbugs[pkg] = unstablebugs[pkg] datenow = int(((time.time() / (60*60)) - 15) / 24); # Next, work out which packages are candidates to be changed. upgrademe = [] excuses = [] # Packages to be removed for src in testing.sources: if should_remove_source(src, testing, unstable, excuses): upgrademe.append("-" + src) # Packages to be upgraded from unstable:
return 0 noutdate = {} for arch in testing.arches: cnt = bizcnt = 0 for pkg in testingpkgs[arch].packages: pkgv = testingpkgs[arch].get_version(pkg) pkgsv = testingpkgs[arch].get_sourcever(pkg) src = testingpkgs[arch].get_source(pkg) srcv = testing.get_version(src) if not same_source(srcv, pkgsv): myarch = arch realarch = testingpkgs[arch].get_field(pkg, "Architecture") if realarch and re.match(r'^all', realarch): myarch = myarch + '/all' if britney.versioncmp(srcv, pkgsv) < 0: bizcnt = bizcnt + 1 print "%s %s %s(%s) %s from %s ***" % \ (src, srcv, pkg, myarch, pkgv, pkgsv) else: print "%s %s %s(%s) %s from %s" % \ (src, srcv, pkg, myarch, pkgv, pkgsv) cnt = cnt + 1 noutdate[arch] = (cnt, bizcnt) print "Columns: number-out-of-date, number-newer-than-source, arch" for arch in testing.arches: print "%8d %4d %s" % (noutdate[arch] + (arch,))
def should_upgrade_src(src, suite, orig, origpkgs, new, newpkgs, approvals, excs): srcv = new.get_version(src) if orig.is_present(src): tsrcv = orig.get_version(src) if britney.versioncmp(srcv, tsrcv) == 0: # Candidate for binnmus only return 0 else: tsrcv = None updatecand = 1 ref = src if suite: ref = ref + "_tpu" exc = Excuse(ref) exc.set_vers(tsrcv, srcv) m = new.get_field(src, "Maintainer") if m: exc.set_maint(string.strip(m)) s = new.get_field(src, "Section") if s: exc.set_section(string.strip(s)) if tsrcv and britney.versioncmp(srcv, tsrcv) < 0: # Version in unstable is older! exc.addhtml("ALERT: %s is newer in testing (%s %s)" % (src, tsrcv, srcv)) excs.append(exc) return 0 if unstable.is_fake(src): exc.addhtml("%s source package doesn't exist" % (src)) updatecand = 0 urgency = unstableurg.get(src, defaulturgency) if hints["remove"].has_key(src): if (tsrcv and same_source(tsrcv, hints["remove"][src][0])) or \ same_source(srcv, hints["remove"][src][0]): exc.addhtml("Removal request by %s" % (hints["remove"][src][1])) exc.addhtml("Trying to remove package, not update it") updatecand = 0 if src in allowremovepkgs: exc.addhtml("Trying to remove package, not update it") updatecand = 0 if src in donttouch: exc.addhtml("Not touching package") updatecand = 0 if suite == None: if not unstabledates.has_key(src): unstabledates[src] = (srcv, datenow) elif not same_source(unstabledates[src][0], srcv): unstabledates[src] = (srcv, datenow) daysold = datenow - unstabledates[src][1] mymindays = mindays[urgency] if src in frozen: exc.addhtml("Package is in freeze, doubling delay") mymindays = mymindays * 2 exc.setdaysold(daysold, mymindays) if daysold < mymindays: updatecand = 0 pkgs = {src: ["source"]} anybins = 0 for arch in arches: oodbins = {} for pkg in new.binaries(src, arch): anybins = 1 if not pkgs.has_key(pkg): pkgs[pkg] = [] pkgs[pkg].append(arch) pkgsv = newpkgs[arch].get_sourcever(pkg) if not same_source(srcv, pkgsv): if not oodbins.has_key(pkgsv): oodbins[pkgsv] = [] oodbins[pkgsv].append(pkg) continue if newpkgs[arch].isnt_arch_all(pkg) or \ arch in nobreakarchallarches: excuse_unsat_deps(pkg, arch, origpkgs[arch], newpkgs[arch], exc) if oodbins: oodtxt = "" for v in oodbins.keys(): if oodtxt: oodtxt = oodtxt + "; " oodtxt = oodtxt + "%s (from <a href=\"http://buildd.debian.org/build.php?arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>)" % \ (string.join(oodbins[v], ", "), arch, src, v, v) text = "out of date on <a href=\"http://buildd.debian.org/build.php?arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>: %s" % ( arch, src, srcv, arch, oodtxt) if arch in fuckedarches: text = text + " (but %s isn't keeping up," % \ (arch) + " so nevermind)" else: updatecand = 0 if datenow != unstabledates[src][1]: exc.addhtml(text) if not anybins: exc.addhtml("%s has no binaries on any arch" % src) updatecand = 0 if suite == None: for pkg in pkgs.keys(): if not testingbugs.has_key(pkg): testingbugs[pkg] = 0 if not unstablebugs.has_key(pkg): unstablebugs[pkg] = 0 if unstablebugs[pkg] > testingbugs[pkg]: exc.addhtml("%s (%s) is <a href=\"http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=pkg&data=%s&sev-inc=critical&sev-inc=grave&sev-inc=serious\" target=\"_blank\">buggy</a>! (%d > %d)" % \ (pkg, string.join(pkgs[pkg], ", "), pkg, unstablebugs[pkg], testingbugs[pkg])) updatecand = 0 elif unstablebugs[pkg] > 0: exc.addhtml("%s (%s) is (less) <a href=\"http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=pkg&data=%s&sev-inc=critical&sev-inc=grave&sev-inc=serious\" target=\"_blank\">buggy</a>! (%d <= %d)" % \ (pkg, string.join(pkgs[pkg], ", "), pkg, unstablebugs[pkg], testingbugs[pkg])) if suite == None: if not updatecand and src in dosrcanyway: exc.addhtml("Should ignore, but considering anyway") updatecand = 1 if approvals: if approvals.has_key("%s_%s" % (src, srcv)): exc.addhtml("Approved by %s" % approvals["%s_%s" % (src, srcv)]) else: exc.addhtml("NEEDS APPROVAL BY RM") updatecand = 0 if updatecand: exc.addhtml("Valid candidate") else: exc.addhtml("Not considered") excuses.append(exc) return updatecand
def should_upgrade_srcarch(src, arch, suite, tsrcv, orig, opkgsa, new, npkgsa, excs): # binnmu this arch? anywrongver = 0 anyworthdoing = 0 ref = "%s/%s" % (src, arch) if suite: ref = ref + "_%s" % (suite) e = Excuse(ref) e.set_vers(tsrcv, tsrcv) m = new.get_field(src, "Maintainer") if m: e.set_maint(string.strip(m)) s = new.get_field(src, "Section") if s: e.set_section(string.strip(s)) if ref in donttouch: e.addhtml("Not touching package") e.addhtml("Not considered") excs.append(e) return 0 if hints["remove"].has_key(src): if same_source(tsrcv, hints["remove"][src][0]): e.addhtml("Removal request by %s" % (hints["remove"][src][1])) e.addhtml("Trying to remove package, not update it") e.addhtml("Not considered") excs.append(e) return 0 if src in allowremovepkgs: e.addhtml("Trying to remove package, not update it") e.addhtml("Not considered") excs.append(e) return 0 for pkg in new.binaries(src, arch): pkgv = npkgsa.get_version(pkg) pkgsv = npkgsa.get_sourcever(pkg) if npkgsa.is_arch_all(pkg): e.addhtml("Ignoring %s %s (from %s) as it is arch: all" % (pkg, pkgv, pkgsv)) continue if not same_source(tsrcv, pkgsv): anywrongver = 1 e.addhtml("From wrong source: %s %s (%s not %s)" % (pkg, pkgv, pkgsv, tsrcv)) break if not opkgsa.is_present(pkg): e.addhtml("New binary: %s (%s)" % (pkg, pkgv)) anyworthdoing = 1 continue tpkgv = opkgsa.get_version(pkg) if britney.versioncmp(tpkgv, pkgv) > 0: anywrongver = 1 e.addhtml("Not downgrading: %s (%s to %s)" % (pkg, tpkgv, pkgv)) break elif britney.versioncmp(tpkgv, pkgv) < 0: e.addhtml("Updated binary: %s (%s to %s)" % (pkg, tpkgv, pkgv)) anyworthdoing = 1 if not anywrongver and (anyworthdoing or not new.is_fake(src)): srcv = new.get_version(src) ssrc = same_source(tsrcv, srcv) for pkg in orig.binaries(src, arch): if opkgsa.is_arch_all(pkg): e.addhtml("Ignoring removal of %s as it is arch: all" % (pkg)) continue if not npkgsa.is_present(pkg): tpkgv = opkgsa.get_version(pkg) e.addhtml("Removed binary: %s %s" % (pkg, tpkgv)) if ssrc: anyworthdoing = 1 if not anywrongver and anyworthdoing: e.addhtml("Valid candidate") excs.append(e) return 1 else: if anyworthdoing: e.addhtml("Not considered") excs.append(e) return 0
for pkg in testingbugs.keys() + unstablebugs.keys(): if not testingbugs.has_key(pkg): testingbugs[pkg] = 0 if not unstablebugs.has_key(pkg): unstablebugs[pkg] = 0 maxvert = maxver(pkg, testing, testingpkgs) if maxvert == None: testingbugs[pkg] = 0 continue if testingbugs[pkg] == unstablebugs[pkg]: continue maxveru = maxver(pkg, unstable, unstablepkgs) if maxveru == None: continue if britney.versioncmp(maxvert, maxveru) >= 0: testingbugs[pkg] = unstablebugs[pkg] datenow = int(((time.time() / (60 * 60)) - 15) / 24) # Next, work out which packages are candidates to be changed. upgrademe = [] excuses = [] # Packages to be removed for src in testing.sources: if should_remove_source(src, testing, unstable, excuses): upgrademe.append("-" + src) # Packages to be upgraded from unstable: