mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-02-23 19:31:55 +00:00
BlockPolicy: Compile regex once rather than once per migration item
Regex compilation is often rather expensive and in this case, we can do it once instad of once per migration item. Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
c4371b9f58
commit
6c3f8354e5
@ -929,6 +929,8 @@ class BuildDependsPolicy(BasePolicy):
|
||||
|
||||
class BlockPolicy(BasePolicy):
|
||||
|
||||
BLOCK_HINT_REGEX = re.compile('^(un)?(block-?.*)$')
|
||||
|
||||
def __init__(self, options, suite_info):
|
||||
super().__init__('block', options, suite_info,
|
||||
{SuiteClass.PRIMARY_SOURCE_SUITE, SuiteClass.ADDITIONAL_SOURCE_SUITE})
|
||||
@ -966,7 +968,7 @@ class BlockPolicy(BasePolicy):
|
||||
|
||||
shints = self.hints.search(package=src)
|
||||
mismatches = False
|
||||
r = re.compile('^(un)?(block-?.*)$')
|
||||
r = self.BLOCK_HINT_REGEX
|
||||
for hint in shints:
|
||||
m = r.match(hint.type)
|
||||
if m:
|
||||
|
Loading…
x
Reference in New Issue
Block a user