diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2018-08-29 10:56:31 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-30 16:16:06 +0100 |
commit | 595e9922cdbacf84cf35cc83f0d03cace042e302 (patch) | |
tree | 7a1e9c2789b291259577be1ec35d83c066325ea0 /meta/lib/oeqa/sdk/context.py | |
parent | ce82ee46f4a7beb5663238b276e779e5c9657777 (diff) | |
download | openembedded-core-contrib-595e9922cdbacf84cf35cc83f0d03cace042e302.tar.gz |
oeqa/sdk: fixes related to hasPackage semantics
The current _hasPackage does a regex match when checking for the
existence of packages. This will sometimes result in unexpected
result. For example, the condition hasTargetPackage('gcc') is likely
to be always true as it matches libgcc1.
For most of the time, we should do exact match instead of regex match.
So change _hasPackage function to do that. For the current sdk test
cases, the only place that needs regex match is '^gcc-'. This is because
there's no easy way to get multilib tune arch (e.g. i686) from testdata.json
file.
Besides, packagegroup-cross-canadian-xxx and gcc-xxx should be check in
host manifest instead of the target one. So fix to use hasHostPackage.
Also, as we are doing exact match, there's no need to use r'gtk\+3',
just 'gtk+3' is enough.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/sdk/context.py')
-rw-r--r-- | meta/lib/oeqa/sdk/context.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/meta/lib/oeqa/sdk/context.py b/meta/lib/oeqa/sdk/context.py index ec8972d05a..adc4166fd2 100644 --- a/meta/lib/oeqa/sdk/context.py +++ b/meta/lib/oeqa/sdk/context.py @@ -20,23 +20,30 @@ class OESDKTestContext(OETestContext): self.target_pkg_manifest = target_pkg_manifest self.host_pkg_manifest = host_pkg_manifest - def _hasPackage(self, manifest, pkg): - for host_pkg in manifest.keys(): - if re.search(pkg, host_pkg): + def _hasPackage(self, manifest, pkg, regex=False): + if regex: + # do regex match + pat = re.compile(pkg) + for p in manifest.keys(): + if pat.search(p): + return True + else: + # do exact match + if pkg in manifest.keys(): return True return False - def hasHostPackage(self, pkg): - return self._hasPackage(self.host_pkg_manifest, pkg) + def hasHostPackage(self, pkg, regex=False): + return self._hasPackage(self.host_pkg_manifest, pkg, regex=regex) - def hasTargetPackage(self, pkg, multilib=False): + def hasTargetPackage(self, pkg, multilib=False, regex=False): if multilib: # match multilib according to sdk_env mls = self.td.get('MULTILIB_VARIANTS', '').split() for ml in mls: if ('ml'+ml) in self.sdk_env: pkg = ml + '-' + pkg - return self._hasPackage(self.target_pkg_manifest, pkg) + return self._hasPackage(self.target_pkg_manifest, pkg, regex=regex) class OESDKTestContextExecutor(OETestContextExecutor): _context_class = OESDKTestContext |