diff options
| author | Ross Burton <ross.burton@intel.com> | 2018-03-01 18:26:30 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-03-01 22:18:47 +0000 |
| commit | 8994767745683cf4746c5cfe83100cbe5a0e2eff (patch) | |
| tree | a58f94bba766ec5542b3e0f5df609382cf2d75d0 /meta/lib/oe | |
| parent | b194e2f15fff3466d6dead90786c09aa749db04a (diff) | |
| download | poky-8994767745683cf4746c5cfe83100cbe5a0e2eff.tar.gz | |
package-manager: add install_glob()
(From OE-Core rev: 8d1b530c82de386d4183f5673c060b9d416a3835)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
| -rw-r--r-- | meta/lib/oe/package_manager.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index d1336d33ac..287ca9a008 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
| @@ -371,6 +371,29 @@ class PackageManager(object, metaclass=ABCMeta): | |||
| 371 | pass | 371 | pass |
| 372 | 372 | ||
| 373 | """ | 373 | """ |
| 374 | Install all packages that match a glob. | ||
| 375 | """ | ||
| 376 | def install_glob(self, globs, sdk=False): | ||
| 377 | # TODO don't have sdk here but have a property on the superclass | ||
| 378 | # (and respect in install_complementary) | ||
| 379 | if sdk: | ||
| 380 | pkgdatadir = self.d.expand("${TMPDIR}/pkgdata/${SDK_SYS}") | ||
| 381 | else: | ||
| 382 | pkgdatadir = self.d.getVar("PKGDATA_DIR") | ||
| 383 | |||
| 384 | try: | ||
| 385 | bb.note("Installing globbed packages...") | ||
| 386 | cmd = ["oe-pkgdata-util", "-p", pkgdatadir, "list-pkgs", globs] | ||
| 387 | pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") | ||
| 388 | self.install(pkgs.split(), attempt_only=True) | ||
| 389 | except subprocess.CalledProcessError as e: | ||
| 390 | # Return code 1 means no packages matched | ||
| 391 | if e.returncode != 1: | ||
| 392 | bb.fatal("Could not compute globbed packages list. Command " | ||
| 393 | "'%s' returned %d:\n%s" % | ||
| 394 | (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | ||
| 395 | |||
| 396 | """ | ||
| 374 | Install complementary packages based upon the list of currently installed | 397 | Install complementary packages based upon the list of currently installed |
| 375 | packages e.g. locales, *-dev, *-dbg, etc. This will only attempt to install | 398 | packages e.g. locales, *-dev, *-dbg, etc. This will only attempt to install |
| 376 | these packages, if they don't exist then no error will occur. Note: every | 399 | these packages, if they don't exist then no error will occur. Note: every |
