diff options
author | Philip Lorenz <philip.lorenz@bmw.de> | 2024-05-16 09:24:39 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-28 09:38:23 +0100 |
commit | e51697ef90c850c7c07feb9f6040a19a41d77c2b (patch) | |
tree | dc44f9fbf71bf9c0a2ceefceb4dca172c520fc13 /meta/lib/oe/package_manager/common_deb_ipk.py | |
parent | f7e9eb03d2d9b69514a902692e5539a1b7661c1f (diff) | |
download | poky-e51697ef90c850c7c07feb9f6040a19a41d77c2b.tar.gz |
package_manager: Share more common DEB / IPK code
Avoid code duplication by making `extract` a shared method (and
retrieving the package manager specific input via an abstract method).
Additionally, follow Python conventions and prefix class internal
methods with "_" to indicate that they shouldn't be called externally.
(From OE-Core rev: c4b126e216dfe8251ec55074be78188fcc3fcea8)
Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package_manager/common_deb_ipk.py')
-rw-r--r-- | meta/lib/oe/package_manager/common_deb_ipk.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/meta/lib/oe/package_manager/common_deb_ipk.py b/meta/lib/oe/package_manager/common_deb_ipk.py index c91a4b4565..6a1e28ee6f 100644 --- a/meta/lib/oe/package_manager/common_deb_ipk.py +++ b/meta/lib/oe/package_manager/common_deb_ipk.py | |||
@@ -20,9 +20,15 @@ class OpkgDpkgPM(PackageManager): | |||
20 | """ | 20 | """ |
21 | super(OpkgDpkgPM, self).__init__(d, target_rootfs) | 21 | super(OpkgDpkgPM, self).__init__(d, target_rootfs) |
22 | 22 | ||
23 | def package_info(self, pkg, cmd): | 23 | def package_info(self, pkg): |
24 | """ | 24 | """ |
25 | Returns a dictionary with the package info. | 25 | Returns a dictionary with the package info. |
26 | """ | ||
27 | raise NotImplementedError | ||
28 | |||
29 | def _common_package_info(self, cmd): | ||
30 | """ | ||
31 | "Returns a dictionary with the package info. | ||
26 | 32 | ||
27 | This method extracts the common parts for Opkg and Dpkg | 33 | This method extracts the common parts for Opkg and Dpkg |
28 | """ | 34 | """ |
@@ -36,14 +42,16 @@ class OpkgDpkgPM(PackageManager): | |||
36 | 42 | ||
37 | return opkg_query(proc.stdout) | 43 | return opkg_query(proc.stdout) |
38 | 44 | ||
39 | def extract(self, pkg, pkg_info): | 45 | def extract(self, pkg): |
40 | """ | 46 | """ |
41 | Returns the path to a tmpdir where resides the contents of a package. | 47 | Returns the path to a tmpdir where resides the contents of a package. |
42 | 48 | ||
43 | Deleting the tmpdir is responsability of the caller. | 49 | Deleting the tmpdir is responsability of the caller. |
44 | |||
45 | This method extracts the common parts for Opkg and Dpkg | ||
46 | """ | 50 | """ |
51 | pkg_info = self.package_info(pkg) | ||
52 | if not pkg_info: | ||
53 | bb.fatal("Unable to get information for package '%s' while " | ||
54 | "trying to extract the package." % pkg) | ||
47 | 55 | ||
48 | ar_cmd = bb.utils.which(os.getenv("PATH"), "ar") | 56 | ar_cmd = bb.utils.which(os.getenv("PATH"), "ar") |
49 | tar_cmd = bb.utils.which(os.getenv("PATH"), "tar") | 57 | tar_cmd = bb.utils.which(os.getenv("PATH"), "tar") |