Use plain sequential search for the SRC_URI.mirror check since the regex
authorZac Medico <zmedico@gentoo.org>
Tue, 8 Jul 2008 00:25:56 +0000 (00:25 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 8 Jul 2008 00:25:56 +0000 (00:25 -0000)
approach is actually much slower.

svn path=/main/trunk/; revision=10977

bin/repoman

index 508b91b2b976b4eb0ae086fae83ce469427f9017..2c34ac919af1366ea1e4913c69b7ae4351681aef 100755 (executable)
@@ -780,8 +780,6 @@ check_ebuild_notadded = not \
 
 # Build a regex from thirdpartymirrors for the SRC_URI.mirror check.
 thirdpartymirrors = portage.flatten(repoman_settings.thirdpartymirrors().values())
-thirdpartymirrors = re.compile(r'^(%s)' % \
-       "|".join(re.escape(x) for x in thirdpartymirrors))
 
 for x in scanlist:
        #ebuilds and digests added to cvs respectively.
@@ -1109,13 +1107,18 @@ for x in scanlist:
                        # Check that URIs don't reference a server from thirdpartymirrors.
                        for uri in portage.flatten(portage.dep.use_reduce(
                                portage.dep.paren_reduce(myaux["SRC_URI"]), matchall=True)):
-                               m = thirdpartymirrors.match(uri)
-                               if m is None:
+                               contains_mirror = False
+                               for mirror in thirdpartymirrors:
+                                       if uri.startswith(mirror):
+                                               contains_mirror = True
+                                               break
+                               if not contains_mirror:
                                        continue
+
                                stats["SRC_URI.mirror"] += 1
                                fails["SRC_URI.mirror"].append(
                                        "%s: '%s' found in thirdpartymirrors" % \
-                                       (relative_path, m.group(0)))
+                                       (relative_path, mirror))
 
                # Test for negative logic and bad words in the RESTRICT var.
                #for x in myaux[allvars.index("RESTRICT")].split():