From 4babb75f8fdd5a8e699d4371869b7d56b1496e19 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Tue, 22 Jul 2014 20:39:48 +0200 Subject: [PATCH] inst-tester: Exploit eqv. table in compute_testing_installability Use the equvilence table to skip some calls to _check_inst. Signed-off-by: Niels Thykier --- installability/tester.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/installability/tester.py b/installability/tester.py index d409c4a..e64ee4b 100644 --- a/installability/tester.py +++ b/installability/tester.py @@ -81,11 +81,22 @@ class InstallabilityTester(object): check_inst = self._check_inst cbroken = self._cache_broken cache_inst = self._cache_inst - tcopy = [x for x in self._testing] + eqv_table = self._eqv_table + testing = self._testing + tcopy = [x for x in testing] for t in ifilterfalse(cache_inst.__contains__, tcopy): if t in cbroken: continue - check_inst(t) + res = check_inst(t) + if t in eqv_table: + eqv = (x for x in eqv_table[t] if x in testing) + if res: + cache_inst.update(eqv) + else: + eqv_set = frozenset(eqv) + testing -= eqv_set + cbroken |= eqv_set + def add_testing_binary(self, pkg_name, pkg_version, pkg_arch): """Add a binary package to "testing" @@ -422,7 +433,7 @@ class InstallabilityTester(object): else: possible_eqv = set(x for x in candidates if x in eqv_table) if len(possible_eqv) > 1: - # Exploit equvialency to reduce the number of + # Exploit equivalency to reduce the number of # candidates if possible. Basically, this # code maps "similar" candidates into a single # candidate that will give a identical result