mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-21 07:21:30 +00:00
Implemented auto-hinter.
This commit is contained in:
parent
c41ea19690
commit
d461205430
43
britney.py
43
britney.py
@ -2242,6 +2242,10 @@ class Britney:
|
|||||||
# run the first round of the upgrade
|
# run the first round of the upgrade
|
||||||
self.do_all()
|
self.do_all()
|
||||||
|
|
||||||
|
# run the auto hinter
|
||||||
|
if not self.options.compatible:
|
||||||
|
self.auto_hinter()
|
||||||
|
|
||||||
# re-write control files
|
# re-write control files
|
||||||
if self.options.control_files:
|
if self.options.control_files:
|
||||||
self.write_controlfiles(self.options.testing, 'testing')
|
self.write_controlfiles(self.options.testing, 'testing')
|
||||||
@ -2333,6 +2337,45 @@ class Britney:
|
|||||||
# replace the list of actions with the new one
|
# replace the list of actions with the new one
|
||||||
self.upgrade_me = upgrade_me
|
self.upgrade_me = upgrade_me
|
||||||
|
|
||||||
|
def auto_hinter(self):
|
||||||
|
"""Auto hint circular dependencies
|
||||||
|
|
||||||
|
This method tries to auto hint circular dependencies analyzing the update
|
||||||
|
excuses.
|
||||||
|
"""
|
||||||
|
self.__log("> Processing hints from the auto hinter", type="I")
|
||||||
|
|
||||||
|
# consider only excuses which are valid candidates
|
||||||
|
excuses = dict([(x.name, x) for x in self.excuses if x.name in self.upgrade_me])
|
||||||
|
|
||||||
|
def find_related(e, hint, first=False):
|
||||||
|
if e not in excuses:
|
||||||
|
return False
|
||||||
|
excuse = excuses[e]
|
||||||
|
if e in self.sources['testing'] and self.sources['testing'][e]['version'] == excuse.ver[1]:
|
||||||
|
return True
|
||||||
|
if not first:
|
||||||
|
hint[e] = excuse.ver[1]
|
||||||
|
if len(excuse.deps) == 0:
|
||||||
|
return hint
|
||||||
|
for p in excuse.deps:
|
||||||
|
if p in hint: continue
|
||||||
|
if not find_related(p, hint):
|
||||||
|
return False
|
||||||
|
return hint
|
||||||
|
|
||||||
|
# loop on them
|
||||||
|
cache = []
|
||||||
|
for e in excuses:
|
||||||
|
excuse = excuses[e]
|
||||||
|
if e in self.sources['testing'] and self.sources['testing'][e]['version'] == excuse.ver[1] or \
|
||||||
|
len(excuse.deps) == 0:
|
||||||
|
continue
|
||||||
|
hint = find_related(e, {}, True)
|
||||||
|
if hint and e in hint and hint not in cache:
|
||||||
|
self.do_hint("easy", "autohinter", hint.items())
|
||||||
|
cache.append(hint)
|
||||||
|
|
||||||
def output_write(self, msg):
|
def output_write(self, msg):
|
||||||
"""Simple wrapper for output writing"""
|
"""Simple wrapper for output writing"""
|
||||||
self.__output.write(msg)
|
self.__output.write(msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user