Implemented the hint-tester interface to interactively test easy, force-hint and hint hints; removed djpig from the hinters.

This commit is contained in:
Fabio Tranchitella 2008-01-15 16:09:51 +00:00
parent 0b5c20b589
commit 24cf4c0dbb
2 changed files with 67 additions and 32 deletions

View File

@ -46,7 +46,6 @@ HINTS_ABA = ALL
HINTS_HE = ALL HINTS_HE = ALL
HINTS_LUK = ALL HINTS_LUK = ALL
HINTS_JOEYH = STANDARD force HINTS_JOEYH = STANDARD force
HINTS_DJPIG = STANDARD
HINTS_ADEODATO = STANDARD HINTS_ADEODATO = STANDARD
HINTS_ZOBEL = STANDARD HINTS_ZOBEL = STANDARD
HINTS_BALLOMBE = STANDARD HINTS_BALLOMBE = STANDARD

View File

@ -299,6 +299,8 @@ class Britney:
help="override architectures from configuration file") help="override architectures from configuration file")
self.parser.add_option("", "--actions", action="store", dest="actions", default=None, self.parser.add_option("", "--actions", action="store", dest="actions", default=None,
help="override the list of actions to be performed") help="override the list of actions to be performed")
self.parser.add_option("", "--hint-tester", action="store_true", dest="hint_tester", default=None,
help="provide a command line interface to test hints")
self.parser.add_option("", "--dry-run", action="store_true", dest="dry_run", default=False, self.parser.add_option("", "--dry-run", action="store_true", dest="dry_run", default=False,
help="disable all outputs to the testing directory") help="disable all outputs to the testing directory")
self.parser.add_option("", "--compatible", action="store_true", dest="compatible", default=False, self.parser.add_option("", "--compatible", action="store_true", dest="compatible", default=False,
@ -1496,8 +1498,8 @@ 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
if not self.options.dry_run:
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")
f.write("<html><head><title>excuses...</title>") f.write("<html><head><title>excuses...</title>")
@ -2165,22 +2167,24 @@ class Britney:
nuninst[arch].remove(p) nuninst[arch].remove(p)
# broken packages (second round, reverse dependencies of the first round) # broken packages (second round, reverse dependencies of the first round)
while to_check: # XXX: let's disable this block, we don't need the list of all the broken packages
j = to_check.pop(0) # in the archive after an upgrade from unstable to testing.
if j not in binaries[arch][0]: continue # while to_check:
for p in binaries[arch][0][j][RDEPENDS]: # j = to_check.pop(0)
if p in broken or p not in binaries[arch][0]: continue # if j not in binaries[arch][0]: continue
r = systems[arch].is_installable(p) # for p in binaries[arch][0][j][RDEPENDS]:
if not r and p not in broken: # if p in broken or p not in binaries[arch][0]: continue
broken.append(p) # r = systems[arch].is_installable(p)
to_check.append(p) # if not r and p not in broken:
if not (skip_archall and binaries[arch][0][p][ARCHITECTURE] == 'all'): # broken.append(p)
nuninst[arch].append(p) # to_check.append(p)
elif r and p in nuninst[arch + "+all"]: # if not (skip_archall and binaries[arch][0][p][ARCHITECTURE] == 'all'):
broken.remove(p) # nuninst[arch].append(p)
to_check.append(p) # elif r and p in nuninst[arch + "+all"]:
if not (skip_archall and binaries[arch][0][p][ARCHITECTURE] == 'all'): # broken.remove(p)
nuninst[arch].remove(p) # to_check.append(p)
# if not (skip_archall and binaries[arch][0][p][ARCHITECTURE] == 'all'):
# nuninst[arch].remove(p)
# if we are processing hints, go ahead # if we are processing hints, go ahead
if hint: if hint:
@ -2484,6 +2488,30 @@ class Britney:
self.__output.close() self.__output.close()
self.__log("Test completed!", type="I") self.__log("Test completed!", type="I")
def hint_tester(self):
"""Run a command line interface to test hints
This methods provides a command line interface for the release team to
try hints and evaulate the results.
"""
self.__log("> Calculating current uninstallability counters", type="I")
self.nuninst_orig = self.get_nuninst()
while True:
# read the command from the command line
try:
input = raw_input('britney> ').lower().split()
except EOFError:
print ""
break
# quit the hint tester
if input[0] in ('quit', 'exit'):
break
# run a hint
elif input[0] in ('easy', 'hint', 'force-hint'):
self.do_hint(input[0], 'hint-tester',
[k.rsplit("/", 1) for k in input[1:] if "/" in k])
def do_hint(self, type, who, pkgvers): def do_hint(self, type, who, pkgvers):
"""Process hints """Process hints
@ -2634,6 +2662,9 @@ class Britney:
def output_write(self, msg): def output_write(self, msg):
"""Simple wrapper for output writing""" """Simple wrapper for output writing"""
if self.options.hint_tester:
print msg,
else:
self.__output.write(msg) self.__output.write(msg)
def main(self): def main(self):
@ -2648,9 +2679,14 @@ class Britney:
if not self.options.compatible: if not self.options.compatible:
self.sort_actions() self.sort_actions()
# otherwise, use the actions provided by the command line # otherwise, use the actions provided by the command line
else: self.upgrade_me = self.options.actions.split() else:
self.upgrade_me = self.options.actions.split()
# run the hint tester
if self.options.hint_tester:
self.hint_tester()
# run the upgrade test # run the upgrade test
else:
self.upgrade_testing() self.upgrade_testing()
if __name__ == '__main__': if __name__ == '__main__':