Implemented the --hints="urgent foo/1; force bar/2". The hints are used

as they were coming from the user "command-line", and influence both the
excuses and the upgrade runs. This option is very useful in combination
with the hint tester interactive interface.
master
Fabio Tranchitella 17 years ago
parent 0db947c498
commit 41bdd841cf

@ -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("", "--hints", action="store", dest="hints", default=None,
help="additional hints, separated by semicolons")
self.parser.add_option("", "--hint-tester", action="store_true", dest="hint_tester", default=None, self.parser.add_option("", "--hint-tester", action="store_true", dest="hint_tester", default=None,
help="provide a command line interface to test hints") 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,
@ -321,7 +323,7 @@ class Britney:
# minimum days for unstable-testing transition and the list of hints # minimum days for unstable-testing transition and the list of hints
# are handled as an ad-hoc case # are handled as an ad-hoc case
self.MINDAYS = {} self.MINDAYS = {}
self.HINTS = {} self.HINTS = {'command-line': self.HINTS_ALL}
for k, v in [map(string.strip,r.split('=', 1)) for r in file(self.options.config) if '=' in r and not r.strip().startswith('#')]: for k, v in [map(string.strip,r.split('=', 1)) for r in file(self.options.config) if '=' in r and not r.strip().startswith('#')]:
if k.startswith("MINDAYS_"): if k.startswith("MINDAYS_"):
self.MINDAYS[k.split("_")[1].lower()] = int(v) self.MINDAYS[k.split("_")[1].lower()] = int(v)
@ -732,12 +734,16 @@ class Britney:
hints = dict([(k,[]) for k in self.HINTS_ALL]) hints = dict([(k,[]) for k in self.HINTS_ALL])
for who in self.HINTS.keys(): for who in self.HINTS.keys():
filename = os.path.join(basedir, "Hints", who) if who == 'command-line':
if not os.path.isfile(filename): lines = self.options.hints and self.options.hints.split(';') or ()
self.__log("Cannot read hints list from %s, no such file!" % filename, type="E") else:
continue filename = os.path.join(basedir, "Hints", who)
self.__log("Loading hints list from %s" % filename) if not os.path.isfile(filename):
for line in open(filename): self.__log("Cannot read hints list from %s, no such file!" % filename, type="E")
continue
self.__log("Loading hints list from %s" % filename)
lines = open(filename)
for line in lines:
line = line.strip() line = line.strip()
if line == "": continue if line == "": continue
l = line.split() l = line.split()

Loading…
Cancel
Save