[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#639319: [britney] Improved auto-hinter



On Fri, 2011-08-26 at 06:22 +0100, Adam D. Barratt wrote:
> On Thu, 2011-08-25 at 23:59 +0100, Adam D. Barratt wrote:
> That data set looks like it manages to dtrt with just the first (i.e.
> direct dependencies) code; the larger package set I was expecting to
> need the extra processing code fails to migrate, but it looks like
> that's just because the files I used were from a point a little before
> it was ready.

Having now found the right set of files, I've confirmed that the simpler
version of the patch is able to migrate the larger package set.

If only for my own amusement, the result of that autohint was:

$ egrep "^final: .*,ghc," b2.log | wc
      1       2   63315

> Unless I - or someone else - can find a situation where the simple code
> isn't sufficient soon, I'll probably just commit the simple version.  At
> least now the rest of the code is in the BTS if we did discover we
> needed it later on.

Attached is an updated patch, for completeness.

Regards,

Adam
--- britney.py.orig	2011-08-25 21:27:55.000000000 +0000
+++ britney.py	2011-08-26 18:11:38.000000000 +0000
@@ -2848,20 +2848,37 @@
             return hint
 
         # loop on them
-        cache = []
+        candidates = []
         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, {})
-            if isinstance(hint, dict) and len(hint) and hint not in cache:
-                self.do_hint("easy", "autohinter", hint.items())
-                cache.append(hint)
-            hint = find_related(e, {}, True)
-            if isinstance(hint, dict) and e in hint and hint not in cache:
-                self.do_hint("easy", "autohinter", hint.items())
-                cache.append(hint)
+            if e in self.sources['testing'] and self.sources['testing'][e][VERSION] == excuse.ver[1]:
+               continue
+            if len(excuse.deps) > 0:
+                hint = find_related(e, {}, True)
+                if isinstance(hint, dict) and e in hint and hint not in candidates:
+                    candidates.append(hint.items())
+            else:
+                items = [ (e, excuse.ver[1]) ]
+                for item, ver in items:
+                    # excuses which depend on "item" or are depended on by it
+                    items.extend( [ (x, excuses[x].ver[1]) for x in excuses if \
+                       (item in excuses[x].deps or x in excuses[item].deps) \
+                       and (x, excuses[x].ver[1]) not in items ] )
+                if len(items) > 1:
+                    candidates.append(items)
+
+        to_skip = []
+        for i in range(len(candidates)):
+            for j in range(i+1, len(candidates)):
+                if i in to_skip or j in to_skip:
+                    continue
+                elif frozenset(candidates[i]) >= frozenset(candidates[j]):
+                    to_skip.append(j)
+                elif frozenset(candidates[i]) <= frozenset(candidates[j]):
+                    to_skip.append(i)
+        for i in range(len(candidates)):
+            if i not in to_skip:
+                self.do_hint("easy", "autohinter", candidates[i])
 
     def old_libraries(self):
         """Detect old libraries left in testing for smooth transitions


Reply to: