Several improvements in algorithms and performances.

bzr-import-20160707
Fabio Tranchitella 19 years ago
parent a9e7101d65
commit 6f69de7da0

@ -383,7 +383,7 @@ class Britney:
if source: if source:
dpkg['source'] = source.split(" ")[0] dpkg['source'] = source.split(" ")[0]
if "(" in source: if "(" in source:
dpkg['source-ver'] = source.split("(")[1].split(")")[0] dpkg['source-ver'] = source[source.find("(")+1:source.find(")")]
# if the source package is available in the distribution, then register this binary package # if the source package is available in the distribution, then register this binary package
if dpkg['source'] in sources[distribution]: if dpkg['source'] in sources[distribution]:
@ -450,7 +450,7 @@ class Britney:
filename = os.path.join(basedir, "Bugs") filename = os.path.join(basedir, "Bugs")
self.__log("Loading RC bugs count from %s" % filename) self.__log("Loading RC bugs count from %s" % filename)
for line in open(filename): for line in open(filename):
l = line.strip().split() l = line.split()
if len(l) != 2: continue if len(l) != 2: continue
try: try:
bugs[l[0]] = int(l[1]) bugs[l[0]] = int(l[1])
@ -529,7 +529,7 @@ class Britney:
filename = os.path.join(basedir, "Dates") filename = os.path.join(basedir, "Dates")
self.__log("Loading upload data from %s" % filename) self.__log("Loading upload data from %s" % filename)
for line in open(filename): for line in open(filename):
l = line.strip().split() l = line.split()
if len(l) != 3: continue if len(l) != 3: continue
try: try:
dates[l[0]] = (l[1], int(l[2])) dates[l[0]] = (l[1], int(l[2]))
@ -555,7 +555,7 @@ class Britney:
filename = os.path.join(basedir, "Urgency") filename = os.path.join(basedir, "Urgency")
self.__log("Loading upload urgencies from %s" % filename) self.__log("Loading upload urgencies from %s" % filename)
for line in open(filename): for line in open(filename):
l = line.strip().split() l = line.split()
if len(l) != 3: continue if len(l) != 3: continue
# read the minimum days associated to the urgencies # read the minimum days associated to the urgencies
@ -603,7 +603,7 @@ class Britney:
filename = os.path.join(basedir, "Approved", approver) filename = os.path.join(basedir, "Approved", approver)
self.__log("Loading approvals list from %s" % filename) self.__log("Loading approvals list from %s" % filename)
for line in open(filename): for line in open(filename):
l = line.strip().split() l = line.split()
if len(l) != 2: continue if len(l) != 2: continue
approvals["%s_%s" % (l[0], l[1])] = approver approvals["%s_%s" % (l[0], l[1])] = approver
return approvals return approvals
@ -1407,7 +1407,7 @@ class Britney:
self.upgrade_me = sorted(upgrade_me) self.upgrade_me = sorted(upgrade_me)
# write excuses to the output file # write excuses to the output file
self.__log("Writing Excuses to %s" % self.options.excuses_output, type="I") self.__log("> Writing Excuses to %s" % self.options.excuses_output, type="I")
f = open(self.options.excuses_output, 'w') f = open(self.options.excuses_output, 'w')
f.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n") f.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n")
@ -1589,7 +1589,7 @@ class Britney:
# local copies for better performances # local copies for better performances
excuse_unsat_deps = self.excuse_unsat_deps excuse_unsat_deps = self.excuse_unsat_deps
binaries = self.binaries binaries = self.binaries['testing']
sources = self.sources sources = self.sources
architectures = self.options.architectures architectures = self.options.architectures
nobreakall_arches = self.options.nobreakall_arches nobreakall_arches = self.options.nobreakall_arches
@ -1612,28 +1612,31 @@ class Britney:
skip_archall = True skip_archall = True
else: skip_archall = False else: skip_archall = False
broken = []
nuninst[arch] = nuninst_comp[arch][:] nuninst[arch] = nuninst_comp[arch][:]
broken = nuninst[arch][:]
l = -1 to_check = [x[0] for x in affected if x[1] == arch]
while len(broken) > l and not (l == 0 and l == len(broken)):
l = len(broken) old_broken = None
for p in filter(lambda x: x[1] == arch, affected): while old_broken != broken:
if p[0] not in binaries['testing'][arch][0] or \ old_broken = broken[:]
skip_archall and binaries['testing'][arch][0][p[0]]['architecture'] == 'all': continue for p in to_check:
r = excuse_unsat_deps(p[0], None, arch, 'testing', None, excluded=broken, conflicts=True) if p not in binaries[arch][0] or \
if not r and p[0] not in broken: skip_archall and binaries[arch][0][p]['architecture'] == 'all': continue
broken.append(p[0]) r = excuse_unsat_deps(p, None, arch, 'testing', None, excluded=broken, conflicts=True)
elif r and p[0] in nuninst[arch]: if not r and p not in broken:
nuninst[arch].remove(p[0]) broken.append(p)
elif r and p in nuninst[arch]:
broken.remove(p)
nuninst[arch].remove(p)
l = 0 l = 0
while l < len(broken): while l < len(broken):
l = len(broken) l = len(broken)
for j in broken: for j in broken:
for p in binaries['testing'][arch][0][j]['rdepends']: if j not in binaries[arch][0]: continue
if p[0] not in binaries['testing'][arch][0] or \ for p in binaries[arch][0][j]['rdepends']:
skip_archall and binaries['testing'][arch][0][p[0]]['architecture'] == 'all': continue if p[0] not in binaries[arch][0] or \
skip_archall and binaries[arch][0][p[0]]['architecture'] == 'all': continue
r = excuse_unsat_deps(p[0], None, arch, 'testing', None, excluded=broken, conflicts=True) r = excuse_unsat_deps(p[0], None, arch, 'testing', None, excluded=broken, conflicts=True)
if not r and p[0] not in broken: if not r and p[0] not in broken:
broken.append(p[0]) broken.append(p[0])
@ -1677,12 +1680,12 @@ class Britney:
if pkg in sources[suite]: if pkg in sources[suite]:
for p in sources[suite][pkg]['binaries']: for p in sources[suite][pkg]['binaries']:
binary, arch = p.split("/") binary, arch = p.split("/")
del binaries['testing'][arch][0][binary] del binaries[arch][0][binary]
# undo the changes (binaries) # undo the changes (binaries)
for p in undo['binaries'].keys(): for p in undo['binaries'].keys():
binary, arch = p.split("/") binary, arch = p.split("/")
binaries['testing'][arch][0][binary] = undo['binaries'][p] binaries[arch][0][binary] = undo['binaries'][p]
output.write(" finish: [%s]\n" % ",".join(self.selected)) output.write(" finish: [%s]\n" % ",".join(self.selected))
output.write("endloop: %s\n" % (self.eval_nuninst(self.nuninst_orig))) output.write("endloop: %s\n" % (self.eval_nuninst(self.nuninst_orig)))
@ -1694,10 +1697,12 @@ class Britney:
return (nuninst_comp, extra) return (nuninst_comp, extra)
def do_all(self, output, maxdepth=0, init=None): def do_all(self, output, maxdepth=0, init=None):
self.__log("> Calculating current uninstallability counters", type="I")
nuninst_start = self.get_nuninst() nuninst_start = self.get_nuninst()
output.write("start: %s\n" % self.eval_nuninst(nuninst_start)) output.write("start: %s\n" % self.eval_nuninst(nuninst_start))
output.write("orig: %s\n" % self.eval_nuninst(nuninst_start)) output.write("orig: %s\n" % self.eval_nuninst(nuninst_start))
self.__log("> First loop on the packages with depth = 0", type="I")
self.selected = [] self.selected = []
self.nuninst_orig = nuninst_start self.nuninst_orig = nuninst_start
(nuninst_end, extra) = self.iter_packages(self.upgrade_me[:], output) (nuninst_end, extra) = self.iter_packages(self.upgrade_me[:], output)

Loading…
Cancel
Save