From 001113296d3300ffaf6b6d1578a4232dbf2695c8 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Sun, 1 Apr 2018 22:23:53 -0400 Subject: Rocko refresh poky: 0ec241873367e18f5371a3ad9aca1e2801dcd4ee meta-openembbeded: dacfa2b1920e285531bec55cd2f08743390aaf57 meta-virtualization: bd77388f31929f38e7d4cc9c711f0f83f563007e meta-raspberrypi: b58ccfc696e4fa6b680ae5ca79960312676d7af9 Tested: Built witherspoon, palmetto and qemu images Change-Id: I934ff48674042bb5ce6b7d75642e7adb9668a409 Signed-off-by: Brad Bishop --- .../yocto-poky/meta/lib/oe/package_manager.py | 31 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'import-layers/yocto-poky/meta/lib/oe/package_manager.py') diff --git a/import-layers/yocto-poky/meta/lib/oe/package_manager.py b/import-layers/yocto-poky/meta/lib/oe/package_manager.py index 0c5d907ff..ed8fec850 100644 --- a/import-layers/yocto-poky/meta/lib/oe/package_manager.py +++ b/import-layers/yocto-poky/meta/lib/oe/package_manager.py @@ -370,6 +370,29 @@ class PackageManager(object, metaclass=ABCMeta): def insert_feeds_uris(self, feed_uris, feed_base_paths, feed_archs): pass + """ + Install all packages that match a glob. + """ + def install_glob(self, globs, sdk=False): + # TODO don't have sdk here but have a property on the superclass + # (and respect in install_complementary) + if sdk: + pkgdatadir = self.d.expand("${TMPDIR}/pkgdata/${SDK_SYS}") + else: + pkgdatadir = self.d.getVar("PKGDATA_DIR") + + try: + bb.note("Installing globbed packages...") + cmd = ["oe-pkgdata-util", "-p", pkgdatadir, "list-pkgs", globs] + pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") + self.install(pkgs.split(), attempt_only=True) + except subprocess.CalledProcessError as e: + # Return code 1 means no packages matched + if e.returncode != 1: + bb.fatal("Could not compute globbed packages list. Command " + "'%s' returned %d:\n%s" % + (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) + """ Install complementary packages based upon the list of currently installed packages e.g. locales, *-dev, *-dbg, etc. This will only attempt to install @@ -402,7 +425,7 @@ class PackageManager(object, metaclass=ABCMeta): installed_pkgs.write(output) installed_pkgs.flush() - cmd = [bb.utils.which(os.getenv('PATH'), "oe-pkgdata-util"), + cmd = ["oe-pkgdata-util", "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name, globs] exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') @@ -412,11 +435,11 @@ class PackageManager(object, metaclass=ABCMeta): bb.note("Installing complementary packages ...") bb.note('Running %s' % cmd) complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") + self.install(complementary_pkgs.split(), attempt_only=True) except subprocess.CalledProcessError as e: bb.fatal("Could not compute complementary packages list. Command " "'%s' returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) - self.install(complementary_pkgs.split(), attempt_only=True) def deploy_dir_lock(self): if self.deploy_dir is None: @@ -1066,7 +1089,7 @@ class OpkgPM(OpkgDpkgPM): output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8") bb.note(output) except subprocess.CalledProcessError as e: - (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " + (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. " "Command '%s' returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) @@ -1365,7 +1388,7 @@ class DpkgPM(OpkgDpkgPM): bb.note("Installing the following packages: %s" % ' '.join(pkgs)) subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " + (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. " "Command '%s' returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) -- cgit v1.2.1