diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-07-23 15:59:17 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-07-23 15:59:17 +0100 |
commit | d02379d2df13801cde08a32fde5deec8201538d2 (patch) | |
tree | ee50d987a2cbb6da05ac0940ba33dfba56acd076 /bitbake | |
parent | a6ca63d77aafe088c90340d65d912666da2d7545 (diff) | |
download | openembedded-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')
-rw-r--r-- | bitbake/lib/bb/providers.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py index 3e842ee0ca..5785b704ed 100644 --- a/bitbake/lib/bb/providers.py +++ b/bitbake/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] |