summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/sdk.py
diff options
context:
space:
mode:
authorFredrik Gustafsson <fredrik.gustafsson@axis.com>2020-09-08 12:53:07 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-11-24 15:53:03 +0000
commit02670501dea192879ddf9f8048eea57a94719fc1 (patch)
tree12d5c414d6ddf8a17fbf579fc32339e56921e5a0 /meta/lib/oe/sdk.py
parentc9b6974cfcac370c6848d28400e0546ac85512e9 (diff)
downloadopenembedded-core-contrib-02670501dea192879ddf9f8048eea57a94719fc1.tar.gz
package management: Allow dynamic loading of PM
Dynamic loading of package managers will allow other layers to simply add their package manager code in package_manager/ and have bitbake find it according to the package manager configuration. This is useful for adding new (faster) package managers to Open Embedded while not increasing the test scope or require Open Embedded to support more package managers. How this is tested: * Build core-image-minimal with all three package managers * Build the sdk with all three package managers. dpkg fails, but it fails on master as well. * Run the complete test suite, all tests passed except 16 * Run those 16 tests on master and verify that they fail there as well * Fix errors making tests works on master but not with this patch. Signed-off-by: Fredrik Gustafsson <fredrigu@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/sdk.py')
-rw-r--r--meta/lib/oe/sdk.py27
1 files changed, 6 insertions, 21 deletions
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py
index fdcadcb8de..37b59afd1a 100644
--- a/meta/lib/oe/sdk.py
+++ b/meta/lib/oe/sdk.py
@@ -115,33 +115,18 @@ def sdk_list_installed_packages(d, target, rootfs_dir=None):
rootfs_dir = [sdk_output, os.path.join(sdk_output, target_path)][target is True]
- from oe.package_manager.rpm import RpmPkgsList
- from oe.package_manager.ipk import OpkgPkgsList
- from oe.package_manager.deb import DpkgPkgsList
img_type = d.getVar('IMAGE_PKGTYPE')
- if img_type == "rpm":
- arch_var = ["SDK_PACKAGE_ARCHS", None][target is True]
- os_var = ["SDK_OS", None][target is True]
- return RpmPkgsList(d, rootfs_dir).list_pkgs()
- elif img_type == "ipk":
- conf_file_var = ["IPKGCONF_SDK", "IPKGCONF_TARGET"][target is True]
- return OpkgPkgsList(d, rootfs_dir, d.getVar(conf_file_var)).list_pkgs()
- elif img_type == "deb":
- return DpkgPkgsList(d, rootfs_dir).list_pkgs()
+ import importlib
+ cls = importlib.import_module('oe.package_manager.' + img_type)
+ return cls.PMPkgsList(d, rootfs_dir).list_pkgs()
def populate_sdk(d, manifest_dir=None):
env_bkp = os.environ.copy()
img_type = d.getVar('IMAGE_PKGTYPE')
- from oe.package_manager.rpm.sdk import RpmSdk
- from oe.package_manager.ipk.sdk import OpkgSdk
- from oe.package_manager.deb.sdk import DpkgSdk
- if img_type == "rpm":
- RpmSdk(d, manifest_dir).populate()
- elif img_type == "ipk":
- OpkgSdk(d, manifest_dir).populate()
- elif img_type == "deb":
- DpkgSdk(d, manifest_dir).populate()
+ import importlib
+ cls = importlib.import_module('oe.package_manager.' + img_type + '.sdk')
+ cls.PkgSdk(d, manifest_dir).populate()
os.environ.clear()
os.environ.update(env_bkp)