package_manager.py: search provides when not found by pkgname

Fixed when:
PACKAGE_CLASSES = "package_rpm"
IMAGE_INSTALL_append = " perl-module-warnings-register"

$ bitbake core-image-minimal
[snip]
ERROR: perl-module-warnings-register not found in the base feeds
[snip]

And it works well when PACKAGE_CLASSES = "package_ipk" since perl
provides perl-module-warnings-register, the "smart install
perl-module-warnings-register" also works well, this was because
_search_pkg_name_in_feeds() only searched pkg name, but no provides,
this patch fixes the problem.

(From OE-Core rev: 476f9ab6e37bd516919862835e6e00c960a9e242)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang
2015-09-06 18:48:13 -07:00
committed by Richard Purdie
parent 4031de53f4
commit 525979f3f6

View File

@@ -760,6 +760,22 @@ class RpmPM(PackageManager):
# bb.note('%s -> %s' % (pkg, pkg + '@' + arch))
return pkg + '@' + arch
# Search provides if not found by pkgname.
bb.note('Not found %s by name, searching provides ...' % pkg)
cmd = "%s %s query --provides %s --show-format='$name-$version'" % \
(self.smart_cmd, self.smart_opt, pkg)
cmd += " | sed -ne 's/ *Provides://p'"
bb.note('cmd: %s' % cmd)
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
# Found a provider
if output:
bb.note('Found providers for %s: %s' % (pkg, output))
for p in output.split():
for arch in feed_archs:
arch = arch.replace('-', '_')
if p.rstrip().endswith('@' + arch):
return p
return ""
'''