summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager
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:07 +0000
commite51345b50784572602a09a233b9d6f4847fe1f16 (patch)
treed65d4d5d4e06f3d0a014a634c03ced594d6c1dc7 /meta/lib/oe/package_manager
parent8c28435258ea28dadbbbe9506beae700c226c379 (diff)
downloadpoky-e51345b50784572602a09a233b9d6f4847fe1f16.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. (From OE-Core rev: 02670501dea192879ddf9f8048eea57a94719fc1) Signed-off-by: Fredrik Gustafsson <fredrigu@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package_manager')
-rw-r--r--meta/lib/oe/package_manager/deb/__init__.py4
-rw-r--r--meta/lib/oe/package_manager/deb/manifest.py2
-rw-r--r--meta/lib/oe/package_manager/deb/rootfs.py8
-rw-r--r--meta/lib/oe/package_manager/deb/sdk.py10
-rw-r--r--meta/lib/oe/package_manager/ipk/__init__.py9
-rw-r--r--meta/lib/oe/package_manager/ipk/manifest.py2
-rw-r--r--meta/lib/oe/package_manager/ipk/rootfs.py8
-rw-r--r--meta/lib/oe/package_manager/ipk/sdk.py10
-rw-r--r--meta/lib/oe/package_manager/rpm/__init__.py2
-rw-r--r--meta/lib/oe/package_manager/rpm/manifest.py2
-rw-r--r--meta/lib/oe/package_manager/rpm/rootfs.py8
-rw-r--r--meta/lib/oe/package_manager/rpm/sdk.py10
12 files changed, 38 insertions, 37 deletions
diff --git a/meta/lib/oe/package_manager/deb/__init__.py b/meta/lib/oe/package_manager/deb/__init__.py
index 5120920e70..10ad707c23 100644
--- a/meta/lib/oe/package_manager/deb/__init__.py
+++ b/meta/lib/oe/package_manager/deb/__init__.py
@@ -79,7 +79,7 @@ class DpkgIndexer(Indexer):
79 if self.d.getVar('PACKAGE_FEED_SIGN') == '1': 79 if self.d.getVar('PACKAGE_FEED_SIGN') == '1':
80 raise NotImplementedError('Package feed signing not implementd for dpkg') 80 raise NotImplementedError('Package feed signing not implementd for dpkg')
81 81
82class DpkgPkgsList(PkgsList): 82class PMPkgsList(PkgsList):
83 83
84 def list_pkgs(self): 84 def list_pkgs(self):
85 cmd = [bb.utils.which(os.getenv('PATH'), "dpkg-query"), 85 cmd = [bb.utils.which(os.getenv('PATH'), "dpkg-query"),
@@ -461,7 +461,7 @@ class DpkgPM(OpkgDpkgPM):
461 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) 461 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
462 462
463 def list_installed(self): 463 def list_installed(self):
464 return DpkgPkgsList(self.d, self.target_rootfs).list_pkgs() 464 return PMPkgsList(self.d, self.target_rootfs).list_pkgs()
465 465
466 def package_info(self, pkg): 466 def package_info(self, pkg):
467 """ 467 """
diff --git a/meta/lib/oe/package_manager/deb/manifest.py b/meta/lib/oe/package_manager/deb/manifest.py
index 0b12036644..d8eab24a06 100644
--- a/meta/lib/oe/package_manager/deb/manifest.py
+++ b/meta/lib/oe/package_manager/deb/manifest.py
@@ -4,7 +4,7 @@
4 4
5from oe.manifest import Manifest 5from oe.manifest import Manifest
6 6
7class DpkgManifest(Manifest): 7class PkgManifest(Manifest):
8 def create_initial(self): 8 def create_initial(self):
9 with open(self.initial_manifest, "w+") as manifest: 9 with open(self.initial_manifest, "w+") as manifest:
10 manifest.write(self.initial_manifest_file_header) 10 manifest.write(self.initial_manifest_file_header)
diff --git a/meta/lib/oe/package_manager/deb/rootfs.py b/meta/lib/oe/package_manager/deb/rootfs.py
index 819f67eda5..8fbaca11d6 100644
--- a/meta/lib/oe/package_manager/deb/rootfs.py
+++ b/meta/lib/oe/package_manager/deb/rootfs.py
@@ -7,7 +7,7 @@ import shutil
7from oe.rootfs import Rootfs 7from oe.rootfs import Rootfs
8from oe.manifest import Manifest 8from oe.manifest import Manifest
9from oe.utils import execute_pre_post_process 9from oe.utils import execute_pre_post_process
10from oe.package_manager.deb.manifest import DpkgManifest 10from oe.package_manager.deb.manifest import PkgManifest
11from oe.package_manager.deb import DpkgPM 11from oe.package_manager.deb import DpkgPM
12 12
13class DpkgOpkgRootfs(Rootfs): 13class DpkgOpkgRootfs(Rootfs):
@@ -120,9 +120,9 @@ class DpkgOpkgRootfs(Rootfs):
120 120
121 num += 1 121 num += 1
122 122
123class DpkgRootfs(DpkgOpkgRootfs): 123class PkgRootfs(DpkgOpkgRootfs):
124 def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None): 124 def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None):
125 super(DpkgRootfs, self).__init__(d, progress_reporter, logcatcher) 125 super(PkgRootfs, self).__init__(d, progress_reporter, logcatcher)
126 self.log_check_regex = '^E:' 126 self.log_check_regex = '^E:'
127 self.log_check_expected_regexes = \ 127 self.log_check_expected_regexes = \
128 [ 128 [
@@ -131,7 +131,7 @@ class DpkgRootfs(DpkgOpkgRootfs):
131 131
132 bb.utils.remove(self.image_rootfs, True) 132 bb.utils.remove(self.image_rootfs, True)
133 bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS'), True) 133 bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS'), True)
134 self.manifest = DpkgManifest(d, manifest_dir) 134 self.manifest = PkgManifest(d, manifest_dir)
135 self.pm = DpkgPM(d, d.getVar('IMAGE_ROOTFS'), 135 self.pm = DpkgPM(d, d.getVar('IMAGE_ROOTFS'),
136 d.getVar('PACKAGE_ARCHS'), 136 d.getVar('PACKAGE_ARCHS'),
137 d.getVar('DPKG_ARCH')) 137 d.getVar('DPKG_ARCH'))
diff --git a/meta/lib/oe/package_manager/deb/sdk.py b/meta/lib/oe/package_manager/deb/sdk.py
index b25eb70b00..9859d8f32d 100644
--- a/meta/lib/oe/package_manager/deb/sdk.py
+++ b/meta/lib/oe/package_manager/deb/sdk.py
@@ -8,19 +8,19 @@ from oe.utils import execute_pre_post_process
8from oe.sdk import Sdk 8from oe.sdk import Sdk
9from oe.manifest import Manifest 9from oe.manifest import Manifest
10from oe.package_manager.deb import DpkgPM 10from oe.package_manager.deb import DpkgPM
11from oe.package_manager.deb.manifest import PkgManifest
11 12
12class DpkgSdk(Sdk): 13class PkgSdk(Sdk):
13 def __init__(self, d, manifest_dir=None): 14 def __init__(self, d, manifest_dir=None):
14 super(DpkgSdk, self).__init__(d, manifest_dir) 15 super(PkgSdk, self).__init__(d, manifest_dir)
15 16
16 self.target_conf_dir = os.path.join(self.d.getVar("APTCONF_TARGET"), "apt") 17 self.target_conf_dir = os.path.join(self.d.getVar("APTCONF_TARGET"), "apt")
17 self.host_conf_dir = os.path.join(self.d.getVar("APTCONF_TARGET"), "apt-sdk") 18 self.host_conf_dir = os.path.join(self.d.getVar("APTCONF_TARGET"), "apt-sdk")
18 19
19 from oe.package_manager.deb.manifest import DpkgManifest
20 20
21 self.target_manifest = DpkgManifest(d, self.manifest_dir, 21 self.target_manifest = PkgManifest(d, self.manifest_dir,
22 Manifest.MANIFEST_TYPE_SDK_TARGET) 22 Manifest.MANIFEST_TYPE_SDK_TARGET)
23 self.host_manifest = DpkgManifest(d, self.manifest_dir, 23 self.host_manifest = PkgManifest(d, self.manifest_dir,
24 Manifest.MANIFEST_TYPE_SDK_HOST) 24 Manifest.MANIFEST_TYPE_SDK_HOST)
25 25
26 deb_repo_workdir = "oe-sdk-repo" 26 deb_repo_workdir = "oe-sdk-repo"
diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py
index 9603993a59..416ed23d47 100644
--- a/meta/lib/oe/package_manager/ipk/__init__.py
+++ b/meta/lib/oe/package_manager/ipk/__init__.py
@@ -59,9 +59,10 @@ class OpkgIndexer(Indexer):
59 self.d.getVar('PACKAGE_FEED_GPG_PASSPHRASE_FILE'), 59 self.d.getVar('PACKAGE_FEED_GPG_PASSPHRASE_FILE'),
60 armor=is_ascii_sig) 60 armor=is_ascii_sig)
61 61
62class OpkgPkgsList(PkgsList): 62class PMPkgsList(PkgsList):
63 def __init__(self, d, rootfs_dir, config_file): 63 def __init__(self, d, rootfs_dir):
64 super(OpkgPkgsList, self).__init__(d, rootfs_dir) 64 super(PMPkgsList, self).__init__(d, rootfs_dir)
65 config_file = d.getVar("IPKGCONF_TARGET")
65 66
66 self.opkg_cmd = bb.utils.which(os.getenv('PATH'), "opkg") 67 self.opkg_cmd = bb.utils.which(os.getenv('PATH'), "opkg")
67 self.opkg_args = "-f %s -o %s " % (config_file, rootfs_dir) 68 self.opkg_args = "-f %s -o %s " % (config_file, rootfs_dir)
@@ -416,7 +417,7 @@ class OpkgPM(OpkgDpkgPM):
416 bb.utils.remove(os.path.join(self.opkg_dir, "lists"), True) 417 bb.utils.remove(os.path.join(self.opkg_dir, "lists"), True)
417 418
418 def list_installed(self): 419 def list_installed(self):
419 return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs() 420 return PMPkgsList(self.d, self.target_rootfs).list_pkgs()
420 421
421 def dummy_install(self, pkgs): 422 def dummy_install(self, pkgs):
422 """ 423 """
diff --git a/meta/lib/oe/package_manager/ipk/manifest.py b/meta/lib/oe/package_manager/ipk/manifest.py
index 69676903ab..ee4b57bcb0 100644
--- a/meta/lib/oe/package_manager/ipk/manifest.py
+++ b/meta/lib/oe/package_manager/ipk/manifest.py
@@ -4,7 +4,7 @@
4 4
5from oe.manifest import Manifest 5from oe.manifest import Manifest
6 6
7class OpkgManifest(Manifest): 7class PkgManifest(Manifest):
8 """ 8 """
9 Returns a dictionary object with mip and mlp packages. 9 Returns a dictionary object with mip and mlp packages.
10 """ 10 """
diff --git a/meta/lib/oe/package_manager/ipk/rootfs.py b/meta/lib/oe/package_manager/ipk/rootfs.py
index 63b4a59c40..26dbee6f6a 100644
--- a/meta/lib/oe/package_manager/ipk/rootfs.py
+++ b/meta/lib/oe/package_manager/ipk/rootfs.py
@@ -8,7 +8,7 @@ import shutil
8from oe.rootfs import Rootfs 8from oe.rootfs import Rootfs
9from oe.manifest import Manifest 9from oe.manifest import Manifest
10from oe.utils import execute_pre_post_process 10from oe.utils import execute_pre_post_process
11from oe.package_manager.ipk.manifest import OpkgManifest 11from oe.package_manager.ipk.manifest import PkgManifest
12from oe.package_manager.ipk import OpkgPM 12from oe.package_manager.ipk import OpkgPM
13 13
14class DpkgOpkgRootfs(Rootfs): 14class DpkgOpkgRootfs(Rootfs):
@@ -121,12 +121,12 @@ class DpkgOpkgRootfs(Rootfs):
121 121
122 num += 1 122 num += 1
123 123
124class OpkgRootfs(DpkgOpkgRootfs): 124class PkgRootfs(DpkgOpkgRootfs):
125 def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None): 125 def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None):
126 super(OpkgRootfs, self).__init__(d, progress_reporter, logcatcher) 126 super(PkgRootfs, self).__init__(d, progress_reporter, logcatcher)
127 self.log_check_regex = '(exit 1|Collected errors)' 127 self.log_check_regex = '(exit 1|Collected errors)'
128 128
129 self.manifest = OpkgManifest(d, manifest_dir) 129 self.manifest = PkgManifest(d, manifest_dir)
130 self.opkg_conf = self.d.getVar("IPKGCONF_TARGET") 130 self.opkg_conf = self.d.getVar("IPKGCONF_TARGET")
131 self.pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS") 131 self.pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS")
132 132
diff --git a/meta/lib/oe/package_manager/ipk/sdk.py b/meta/lib/oe/package_manager/ipk/sdk.py
index 47c0a92c1b..37af0344eb 100644
--- a/meta/lib/oe/package_manager/ipk/sdk.py
+++ b/meta/lib/oe/package_manager/ipk/sdk.py
@@ -6,20 +6,20 @@ import glob
6import shutil 6import shutil
7from oe.utils import execute_pre_post_process 7from oe.utils import execute_pre_post_process
8from oe.sdk import Sdk 8from oe.sdk import Sdk
9from oe.package_manager.ipk.manifest import PkgManifest
9from oe.manifest import Manifest 10from oe.manifest import Manifest
10from oe.package_manager.ipk import OpkgPM 11from oe.package_manager.ipk import OpkgPM
11 12
12class OpkgSdk(Sdk): 13class PkgSdk(Sdk):
13 def __init__(self, d, manifest_dir=None): 14 def __init__(self, d, manifest_dir=None):
14 super(OpkgSdk, self).__init__(d, manifest_dir) 15 super(PkgSdk, self).__init__(d, manifest_dir)
15 16
16 self.target_conf = self.d.getVar("IPKGCONF_TARGET") 17 self.target_conf = self.d.getVar("IPKGCONF_TARGET")
17 self.host_conf = self.d.getVar("IPKGCONF_SDK") 18 self.host_conf = self.d.getVar("IPKGCONF_SDK")
18 19
19 from oe.package_manager.ipk.manifest import OpkgManifest 20 self.target_manifest = PkgManifest(d, self.manifest_dir,
20 self.target_manifest = OpkgManifest(d, self.manifest_dir,
21 Manifest.MANIFEST_TYPE_SDK_TARGET) 21 Manifest.MANIFEST_TYPE_SDK_TARGET)
22 self.host_manifest = OpkgManifest(d, self.manifest_dir, 22 self.host_manifest = PkgManifest(d, self.manifest_dir,
23 Manifest.MANIFEST_TYPE_SDK_HOST) 23 Manifest.MANIFEST_TYPE_SDK_HOST)
24 24
25 ipk_repo_workdir = "oe-sdk-repo" 25 ipk_repo_workdir = "oe-sdk-repo"
diff --git a/meta/lib/oe/package_manager/rpm/__init__.py b/meta/lib/oe/package_manager/rpm/__init__.py
index c91f61ae5c..898184442f 100644
--- a/meta/lib/oe/package_manager/rpm/__init__.py
+++ b/meta/lib/oe/package_manager/rpm/__init__.py
@@ -43,7 +43,7 @@ class RpmSubdirIndexer(RpmIndexer):
43 self.do_write_index(dir_path) 43 self.do_write_index(dir_path)
44 44
45 45
46class RpmPkgsList(PkgsList): 46class PMPkgsList(PkgsList):
47 def list_pkgs(self): 47 def list_pkgs(self):
48 return RpmPM(self.d, self.rootfs_dir, self.d.getVar('TARGET_VENDOR'), needfeed=False).list_installed() 48 return RpmPM(self.d, self.rootfs_dir, self.d.getVar('TARGET_VENDOR'), needfeed=False).list_installed()
49 49
diff --git a/meta/lib/oe/package_manager/rpm/manifest.py b/meta/lib/oe/package_manager/rpm/manifest.py
index a75f6bdabf..e6604b301f 100644
--- a/meta/lib/oe/package_manager/rpm/manifest.py
+++ b/meta/lib/oe/package_manager/rpm/manifest.py
@@ -4,7 +4,7 @@
4 4
5from oe.manifest import Manifest 5from oe.manifest import Manifest
6 6
7class RpmManifest(Manifest): 7class PkgManifest(Manifest):
8 """ 8 """
9 Returns a dictionary object with mip and mlp packages. 9 Returns a dictionary object with mip and mlp packages.
10 """ 10 """
diff --git a/meta/lib/oe/package_manager/rpm/rootfs.py b/meta/lib/oe/package_manager/rpm/rootfs.py
index 2de5752b91..00d07cd9cc 100644
--- a/meta/lib/oe/package_manager/rpm/rootfs.py
+++ b/meta/lib/oe/package_manager/rpm/rootfs.py
@@ -5,17 +5,17 @@
5from oe.rootfs import Rootfs 5from oe.rootfs import Rootfs
6from oe.manifest import Manifest 6from oe.manifest import Manifest
7from oe.utils import execute_pre_post_process 7from oe.utils import execute_pre_post_process
8from oe.package_manager.rpm.manifest import RpmManifest 8from oe.package_manager.rpm.manifest import PkgManifest
9from oe.package_manager.rpm import RpmPM 9from oe.package_manager.rpm import RpmPM
10 10
11class RpmRootfs(Rootfs): 11class PkgRootfs(Rootfs):
12 def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None): 12 def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None):
13 super(RpmRootfs, self).__init__(d, progress_reporter, logcatcher) 13 super(PkgRootfs, self).__init__(d, progress_reporter, logcatcher)
14 self.log_check_regex = r'(unpacking of archive failed|Cannot find package'\ 14 self.log_check_regex = r'(unpacking of archive failed|Cannot find package'\
15 r'|exit 1|ERROR: |Error: |Error |ERROR '\ 15 r'|exit 1|ERROR: |Error: |Error |ERROR '\
16 r'|Failed |Failed: |Failed$|Failed\(\d+\):)' 16 r'|Failed |Failed: |Failed$|Failed\(\d+\):)'
17 17
18 self.manifest = RpmManifest(d, manifest_dir) 18 self.manifest = PkgManifest(d, manifest_dir)
19 19
20 self.pm = RpmPM(d, 20 self.pm = RpmPM(d,
21 d.getVar('IMAGE_ROOTFS'), 21 d.getVar('IMAGE_ROOTFS'),
diff --git a/meta/lib/oe/package_manager/rpm/sdk.py b/meta/lib/oe/package_manager/rpm/sdk.py
index b14b155a85..c5f232431f 100644
--- a/meta/lib/oe/package_manager/rpm/sdk.py
+++ b/meta/lib/oe/package_manager/rpm/sdk.py
@@ -6,16 +6,16 @@ import glob
6from oe.utils import execute_pre_post_process 6from oe.utils import execute_pre_post_process
7from oe.sdk import Sdk 7from oe.sdk import Sdk
8from oe.manifest import Manifest 8from oe.manifest import Manifest
9from oe.package_manager.rpm.manifest import PkgManifest
9from oe.package_manager.rpm import RpmPM 10from oe.package_manager.rpm import RpmPM
10 11
11class RpmSdk(Sdk): 12class PkgSdk(Sdk):
12 def __init__(self, d, manifest_dir=None, rpm_workdir="oe-sdk-repo"): 13 def __init__(self, d, manifest_dir=None, rpm_workdir="oe-sdk-repo"):
13 super(RpmSdk, self).__init__(d, manifest_dir) 14 super(PkgSdk, self).__init__(d, manifest_dir)
14 15
15 from oe.package_manager.rpm.manifest import RpmManifest 16 self.target_manifest = PkgManifest(d, self.manifest_dir,
16 self.target_manifest = RpmManifest(d, self.manifest_dir,
17 Manifest.MANIFEST_TYPE_SDK_TARGET) 17 Manifest.MANIFEST_TYPE_SDK_TARGET)
18 self.host_manifest = RpmManifest(d, self.manifest_dir, 18 self.host_manifest = PkgManifest(d, self.manifest_dir,
19 Manifest.MANIFEST_TYPE_SDK_HOST) 19 Manifest.MANIFEST_TYPE_SDK_HOST)
20 20
21 rpm_repo_workdir = "oe-sdk-repo" 21 rpm_repo_workdir = "oe-sdk-repo"