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-dev | |
parent | a6ca63d77aafe088c90340d65d912666da2d7545 (diff) | |
download | poky-d02379d2df13801cde08a32fde5deec8201538d2.tar.gz |
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')
-rw-r--r-- | bitbake-dev/lib/bb/providers.py | 19 |
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): | |||
280 | 280 | ||
281 | return eligible, numberPreferred | 281 | return eligible, numberPreferred |
282 | 282 | ||
283 | regexp_cache = {} | ||
284 | |||
283 | def getRuntimeProviders(dataCache, rdepend): | 285 | def getRuntimeProviders(dataCache, rdepend): |
284 | """ | 286 | """ |
285 | Return any providers of runtime dependency | 287 | Return any providers of runtime dependency |
@@ -297,12 +299,17 @@ def getRuntimeProviders(dataCache, rdepend): | |||
297 | 299 | ||
298 | # Only search dynamic packages if we can't find anything in other variables | 300 | # Only search dynamic packages if we can't find anything in other variables |
299 | for pattern in dataCache.packages_dynamic: | 301 | for pattern in dataCache.packages_dynamic: |
300 | pattern = pattern.replace('+', "\+") | 302 | |
301 | try: | 303 | if pattern in regexp_cache: |
302 | regexp = re.compile(pattern) | 304 | regexp = regexp_cache[pattern] |
303 | except: | 305 | else: |
304 | bb.msg.error(bb.msg.domain.Provider, "Error parsing re expression: %s" % pattern) | 306 | pattern = pattern.replace('+', "\+") |
305 | raise | 307 | try: |
308 | regexp = re.compile(pattern) | ||
309 | except: | ||
310 | bb.msg.error(bb.msg.domain.Provider, "Error parsing re expression: %s" % pattern) | ||
311 | raise | ||
312 | regexp_cache[pattern] = regexp | ||
306 | if regexp.match(rdepend): | 313 | if regexp.match(rdepend): |
307 | rproviders += dataCache.packages_dynamic[pattern] | 314 | rproviders += dataCache.packages_dynamic[pattern] |
308 | 315 | ||