summaryrefslogtreecommitdiff
path: root/bitbake-dev/lib/bb/providers.py
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-07-23 15:59:17 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2009-07-23 15:59:17 +0100
commitd02379d2df13801cde08a32fde5deec8201538d2 (patch)
treeee50d987a2cbb6da05ac0940ba33dfba56acd076 /bitbake-dev/lib/bb/providers.py
parenta6ca63d77aafe088c90340d65d912666da2d7545 (diff)
downloadopenembedded-core-d02379d2df13801cde08a32fde5deec8201538d2.tar.gz
openembedded-core-d02379d2df13801cde08a32fde5deec8201538d2.tar.bz2
openembedded-core-d02379d2df13801cde08a32fde5deec8201538d2.zip
bitbake: Add a cache around PACKAGES_DYNAMIC regexps to help performance a bit
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake-dev/lib/bb/providers.py')
-rw-r--r--bitbake-dev/lib/bb/providers.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/bitbake-dev/lib/bb/providers.py b/bitbake-dev/lib/bb/providers.py
index d0e71173df..879f1a00b2 100644
--- a/bitbake-dev/lib/bb/providers.py
+++ b/bitbake-dev/lib/bb/providers.py
@@ -280,6 +280,8 @@ def filterProvidersRunTime(providers, item, cfgData, dataCache):
return eligible, numberPreferred
+regexp_cache = {}
+
def getRuntimeProviders(dataCache, rdepend):
"""
Return any providers of runtime dependency
@@ -297,12 +299,17 @@ def getRuntimeProviders(dataCache, rdepend):
# Only search dynamic packages if we can't find anything in other variables
for pattern in dataCache.packages_dynamic:
- pattern = pattern.replace('+', "\+")
- try:
- regexp = re.compile(pattern)
- except:
- bb.msg.error(bb.msg.domain.Provider, "Error parsing re expression: %s" % pattern)
- raise
+
+ if pattern in regexp_cache:
+ regexp = regexp_cache[pattern]
+ else:
+ pattern = pattern.replace('+', "\+")
+ try:
+ regexp = re.compile(pattern)
+ except:
+ bb.msg.error(bb.msg.domain.Provider, "Error parsing re expression: %s" % pattern)
+ raise
+ regexp_cache[pattern] = regexp
if regexp.match(rdepend):
rproviders += dataCache.packages_dynamic[pattern]