]> code.ossystems Code Review - openembedded-core.git/commitdiff
package-manager: add install_glob()
authorRoss Burton <ross.burton@intel.com>
Thu, 1 Mar 2018 18:26:30 +0000 (18:26 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 30 Mar 2018 09:11:19 +0000 (10:11 +0100)
(From OE-Core rev: 8d1b530c82de386d4183f5673c060b9d416a3835)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/package_manager.py

index 7f9468728acd2840c1118b3c5b4a3180639f7665..a907d6c7b9c4cca8e0acc2616654505afb462b04 100644 (file)
@@ -369,6 +369,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