diff options
Diffstat (limited to 'meta/lib/oe/package_manager')
-rw-r--r-- | meta/lib/oe/package_manager/__init__.py | 76 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/common_deb_ipk.py | 97 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/deb/__init__.py | 85 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/ipk/__init__.py | 95 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/rpm/__init__.py | 6 |
5 files changed, 141 insertions, 218 deletions
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py index d3b2317894..2100a97c12 100644 --- a/meta/lib/oe/package_manager/__init__.py +++ b/meta/lib/oe/package_manager/__init__.py | |||
@@ -365,45 +365,43 @@ class PackageManager(object, metaclass=ABCMeta): | |||
365 | for complementary_linguas in (self.d.getVar('IMAGE_LINGUAS_COMPLEMENTARY') or "").split(): | 365 | for complementary_linguas in (self.d.getVar('IMAGE_LINGUAS_COMPLEMENTARY') or "").split(): |
366 | globs += (" " + complementary_linguas) % lang | 366 | globs += (" " + complementary_linguas) % lang |
367 | 367 | ||
368 | if globs is None: | 368 | if globs: |
369 | return | 369 | # we need to write the list of installed packages to a file because the |
370 | 370 | # oe-pkgdata-util reads it from a file | |
371 | # we need to write the list of installed packages to a file because the | 371 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: |
372 | # oe-pkgdata-util reads it from a file | 372 | pkgs = self.list_installed() |
373 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: | 373 | |
374 | pkgs = self.list_installed() | 374 | provided_pkgs = set() |
375 | 375 | for pkg in pkgs.values(): | |
376 | provided_pkgs = set() | 376 | provided_pkgs |= set(pkg.get('provs', [])) |
377 | for pkg in pkgs.values(): | 377 | |
378 | provided_pkgs |= set(pkg.get('provs', [])) | 378 | output = oe.utils.format_pkg_list(pkgs, "arch") |
379 | 379 | installed_pkgs.write(output) | |
380 | output = oe.utils.format_pkg_list(pkgs, "arch") | 380 | installed_pkgs.flush() |
381 | installed_pkgs.write(output) | 381 | |
382 | installed_pkgs.flush() | 382 | cmd = ["oe-pkgdata-util", |
383 | 383 | "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name, | |
384 | cmd = ["oe-pkgdata-util", | 384 | globs] |
385 | "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name, | 385 | exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') |
386 | globs] | 386 | if exclude: |
387 | exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') | 387 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) |
388 | if exclude: | 388 | try: |
389 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) | 389 | bb.note('Running %s' % cmd) |
390 | try: | 390 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
391 | bb.note('Running %s' % cmd) | 391 | stdout, stderr = proc.communicate() |
392 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 392 | if stderr: bb.note(stderr.decode("utf-8")) |
393 | stdout, stderr = proc.communicate() | 393 | complementary_pkgs = stdout.decode("utf-8") |
394 | if stderr: bb.note(stderr.decode("utf-8")) | 394 | complementary_pkgs = set(complementary_pkgs.split()) |
395 | complementary_pkgs = stdout.decode("utf-8") | 395 | skip_pkgs = sorted(complementary_pkgs & provided_pkgs) |
396 | complementary_pkgs = set(complementary_pkgs.split()) | 396 | install_pkgs = sorted(complementary_pkgs - provided_pkgs) |
397 | skip_pkgs = sorted(complementary_pkgs & provided_pkgs) | 397 | bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % ( |
398 | install_pkgs = sorted(complementary_pkgs - provided_pkgs) | 398 | ' '.join(install_pkgs), |
399 | bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % ( | 399 | ' '.join(skip_pkgs))) |
400 | ' '.join(install_pkgs), | 400 | self.install(install_pkgs, hard_depends_only=True) |
401 | ' '.join(skip_pkgs))) | 401 | except subprocess.CalledProcessError as e: |
402 | self.install(install_pkgs, hard_depends_only=True) | 402 | bb.fatal("Could not compute complementary packages list. Command " |
403 | except subprocess.CalledProcessError as e: | 403 | "'%s' returned %d:\n%s" % |
404 | bb.fatal("Could not compute complementary packages list. Command " | 404 | (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) |
405 | "'%s' returned %d:\n%s" % | ||
406 | (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | ||
407 | 405 | ||
408 | if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1': | 406 | if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1': |
409 | target_arch = self.d.getVar('TARGET_ARCH') | 407 | target_arch = self.d.getVar('TARGET_ARCH') |
diff --git a/meta/lib/oe/package_manager/common_deb_ipk.py b/meta/lib/oe/package_manager/common_deb_ipk.py new file mode 100644 index 0000000000..6a1e28ee6f --- /dev/null +++ b/meta/lib/oe/package_manager/common_deb_ipk.py | |||
@@ -0,0 +1,97 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: GPL-2.0-only | ||
5 | # | ||
6 | |||
7 | import glob | ||
8 | import os | ||
9 | import subprocess | ||
10 | import tempfile | ||
11 | |||
12 | import bb | ||
13 | |||
14 | from oe.package_manager import opkg_query, PackageManager | ||
15 | |||
16 | class OpkgDpkgPM(PackageManager): | ||
17 | def __init__(self, d, target_rootfs): | ||
18 | """ | ||
19 | This is an abstract class. Do not instantiate this directly. | ||
20 | """ | ||
21 | super(OpkgDpkgPM, self).__init__(d, target_rootfs) | ||
22 | |||
23 | def package_info(self, pkg): | ||
24 | """ | ||
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. | ||
32 | |||
33 | This method extracts the common parts for Opkg and Dpkg | ||
34 | """ | ||
35 | |||
36 | proc = subprocess.run(cmd, capture_output=True, encoding="utf-8", shell=True) | ||
37 | if proc.returncode: | ||
38 | bb.fatal("Unable to list available packages. Command '%s' " | ||
39 | "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr)) | ||
40 | elif proc.stderr: | ||
41 | bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr)) | ||
42 | |||
43 | return opkg_query(proc.stdout) | ||
44 | |||
45 | def extract(self, pkg): | ||
46 | """ | ||
47 | Returns the path to a tmpdir where resides the contents of a package. | ||
48 | |||
49 | Deleting the tmpdir is responsability of the caller. | ||
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) | ||
55 | |||
56 | ar_cmd = bb.utils.which(os.getenv("PATH"), "ar") | ||
57 | tar_cmd = bb.utils.which(os.getenv("PATH"), "tar") | ||
58 | pkg_path = pkg_info[pkg]["filepath"] | ||
59 | |||
60 | if not os.path.isfile(pkg_path): | ||
61 | bb.fatal("Unable to extract package for '%s'." | ||
62 | "File %s doesn't exists" % (pkg, pkg_path)) | ||
63 | |||
64 | tmp_dir = tempfile.mkdtemp() | ||
65 | current_dir = os.getcwd() | ||
66 | os.chdir(tmp_dir) | ||
67 | |||
68 | try: | ||
69 | cmd = [ar_cmd, 'x', pkg_path] | ||
70 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | ||
71 | data_tar = glob.glob("data.tar.*") | ||
72 | if len(data_tar) != 1: | ||
73 | bb.fatal("Unable to extract %s package. Failed to identify " | ||
74 | "data tarball (found tarballs '%s').", | ||
75 | pkg_path, data_tar) | ||
76 | data_tar = data_tar[0] | ||
77 | cmd = [tar_cmd, 'xf', data_tar] | ||
78 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | ||
79 | except subprocess.CalledProcessError as e: | ||
80 | bb.utils.remove(tmp_dir, recurse=True) | ||
81 | bb.fatal("Unable to extract %s package. Command '%s' " | ||
82 | "returned %d:\n%s" % (pkg_path, ' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | ||
83 | except OSError as e: | ||
84 | bb.utils.remove(tmp_dir, recurse=True) | ||
85 | bb.fatal("Unable to extract %s package. Command '%s' " | ||
86 | "returned %d:\n%s at %s" % (pkg_path, ' '.join(cmd), e.errno, e.strerror, e.filename)) | ||
87 | |||
88 | bb.note("Extracted %s to %s" % (pkg_path, tmp_dir)) | ||
89 | bb.utils.remove(os.path.join(tmp_dir, "debian-binary")) | ||
90 | bb.utils.remove(os.path.join(tmp_dir, "control.tar.gz")) | ||
91 | bb.utils.remove(os.path.join(tmp_dir, data_tar)) | ||
92 | os.chdir(current_dir) | ||
93 | |||
94 | return tmp_dir | ||
95 | |||
96 | def _handle_intercept_failure(self, registered_pkgs): | ||
97 | self.mark_packages("unpacked", registered_pkgs.split()) | ||
diff --git a/meta/lib/oe/package_manager/deb/__init__.py b/meta/lib/oe/package_manager/deb/__init__.py index 0c23c884c1..e09e81e490 100644 --- a/meta/lib/oe/package_manager/deb/__init__.py +++ b/meta/lib/oe/package_manager/deb/__init__.py | |||
@@ -7,6 +7,7 @@ | |||
7 | import re | 7 | import re |
8 | import subprocess | 8 | import subprocess |
9 | from oe.package_manager import * | 9 | from oe.package_manager import * |
10 | from oe.package_manager.common_deb_ipk import OpkgDpkgPM | ||
10 | 11 | ||
11 | class DpkgIndexer(Indexer): | 12 | class DpkgIndexer(Indexer): |
12 | def _create_configs(self): | 13 | def _create_configs(self): |
@@ -111,72 +112,6 @@ class PMPkgsList(PkgsList): | |||
111 | 112 | ||
112 | return opkg_query(cmd_output) | 113 | return opkg_query(cmd_output) |
113 | 114 | ||
114 | class OpkgDpkgPM(PackageManager): | ||
115 | def __init__(self, d, target_rootfs): | ||
116 | """ | ||
117 | This is an abstract class. Do not instantiate this directly. | ||
118 | """ | ||
119 | super(OpkgDpkgPM, self).__init__(d, target_rootfs) | ||
120 | |||
121 | def package_info(self, pkg, cmd): | ||
122 | """ | ||
123 | Returns a dictionary with the package info. | ||
124 | |||
125 | This method extracts the common parts for Opkg and Dpkg | ||
126 | """ | ||
127 | |||
128 | try: | ||
129 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8") | ||
130 | except subprocess.CalledProcessError as e: | ||
131 | bb.fatal("Unable to list available packages. Command '%s' " | ||
132 | "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) | ||
133 | return opkg_query(output) | ||
134 | |||
135 | def extract(self, pkg, pkg_info): | ||
136 | """ | ||
137 | Returns the path to a tmpdir where resides the contents of a package. | ||
138 | |||
139 | Deleting the tmpdir is responsability of the caller. | ||
140 | |||
141 | This method extracts the common parts for Opkg and Dpkg | ||
142 | """ | ||
143 | |||
144 | ar_cmd = bb.utils.which(os.getenv("PATH"), "ar") | ||
145 | tar_cmd = bb.utils.which(os.getenv("PATH"), "tar") | ||
146 | pkg_path = pkg_info[pkg]["filepath"] | ||
147 | |||
148 | if not os.path.isfile(pkg_path): | ||
149 | bb.fatal("Unable to extract package for '%s'." | ||
150 | "File %s doesn't exists" % (pkg, pkg_path)) | ||
151 | |||
152 | tmp_dir = tempfile.mkdtemp() | ||
153 | current_dir = os.getcwd() | ||
154 | os.chdir(tmp_dir) | ||
155 | data_tar = 'data.tar.xz' | ||
156 | |||
157 | try: | ||
158 | cmd = [ar_cmd, 'x', pkg_path] | ||
159 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | ||
160 | cmd = [tar_cmd, 'xf', data_tar] | ||
161 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | ||
162 | except subprocess.CalledProcessError as e: | ||
163 | bb.utils.remove(tmp_dir, recurse=True) | ||
164 | bb.fatal("Unable to extract %s package. Command '%s' " | ||
165 | "returned %d:\n%s" % (pkg_path, ' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | ||
166 | except OSError as e: | ||
167 | bb.utils.remove(tmp_dir, recurse=True) | ||
168 | bb.fatal("Unable to extract %s package. Command '%s' " | ||
169 | "returned %d:\n%s at %s" % (pkg_path, ' '.join(cmd), e.errno, e.strerror, e.filename)) | ||
170 | |||
171 | bb.note("Extracted %s to %s" % (pkg_path, tmp_dir)) | ||
172 | bb.utils.remove(os.path.join(tmp_dir, "debian-binary")) | ||
173 | bb.utils.remove(os.path.join(tmp_dir, "control.tar.gz")) | ||
174 | os.chdir(current_dir) | ||
175 | |||
176 | return tmp_dir | ||
177 | |||
178 | def _handle_intercept_failure(self, registered_pkgs): | ||
179 | self.mark_packages("unpacked", registered_pkgs.split()) | ||
180 | 115 | ||
181 | class DpkgPM(OpkgDpkgPM): | 116 | class DpkgPM(OpkgDpkgPM): |
182 | def __init__(self, d, target_rootfs, archs, base_archs, apt_conf_dir=None, deb_repo_workdir="oe-rootfs-repo", filterbydependencies=True): | 117 | def __init__(self, d, target_rootfs, archs, base_archs, apt_conf_dir=None, deb_repo_workdir="oe-rootfs-repo", filterbydependencies=True): |
@@ -496,7 +431,7 @@ class DpkgPM(OpkgDpkgPM): | |||
496 | Returns a dictionary with the package info. | 431 | Returns a dictionary with the package info. |
497 | """ | 432 | """ |
498 | cmd = "%s show %s" % (self.apt_cache_cmd, pkg) | 433 | cmd = "%s show %s" % (self.apt_cache_cmd, pkg) |
499 | pkg_info = super(DpkgPM, self).package_info(pkg, cmd) | 434 | pkg_info = self._common_package_info(cmd) |
500 | 435 | ||
501 | pkg_arch = pkg_info[pkg]["pkgarch"] | 436 | pkg_arch = pkg_info[pkg]["pkgarch"] |
502 | pkg_filename = pkg_info[pkg]["filename"] | 437 | pkg_filename = pkg_info[pkg]["filename"] |
@@ -504,19 +439,3 @@ class DpkgPM(OpkgDpkgPM): | |||
504 | os.path.join(self.deploy_dir, pkg_arch, pkg_filename) | 439 | os.path.join(self.deploy_dir, pkg_arch, pkg_filename) |
505 | 440 | ||
506 | return pkg_info | 441 | return pkg_info |
507 | |||
508 | def extract(self, pkg): | ||
509 | """ | ||
510 | Returns the path to a tmpdir where resides the contents of a package. | ||
511 | |||
512 | Deleting the tmpdir is responsability of the caller. | ||
513 | """ | ||
514 | pkg_info = self.package_info(pkg) | ||
515 | if not pkg_info: | ||
516 | bb.fatal("Unable to get information for package '%s' while " | ||
517 | "trying to extract the package." % pkg) | ||
518 | |||
519 | tmp_dir = super(DpkgPM, self).extract(pkg, pkg_info) | ||
520 | bb.utils.remove(os.path.join(tmp_dir, "data.tar.xz")) | ||
521 | |||
522 | return tmp_dir | ||
diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py index 0f0038d00d..3d998e52ff 100644 --- a/meta/lib/oe/package_manager/ipk/__init__.py +++ b/meta/lib/oe/package_manager/ipk/__init__.py | |||
@@ -4,11 +4,11 @@ | |||
4 | # SPDX-License-Identifier: GPL-2.0-only | 4 | # SPDX-License-Identifier: GPL-2.0-only |
5 | # | 5 | # |
6 | 6 | ||
7 | import glob | ||
8 | import re | 7 | import re |
9 | import shutil | 8 | import shutil |
10 | import subprocess | 9 | import subprocess |
11 | from oe.package_manager import * | 10 | from oe.package_manager import * |
11 | from oe.package_manager.common_deb_ipk import OpkgDpkgPM | ||
12 | 12 | ||
13 | class OpkgIndexer(Indexer): | 13 | class OpkgIndexer(Indexer): |
14 | def write_index(self): | 14 | def write_index(self): |
@@ -91,81 +91,6 @@ class PMPkgsList(PkgsList): | |||
91 | return opkg_query(cmd_output) | 91 | return opkg_query(cmd_output) |
92 | 92 | ||
93 | 93 | ||
94 | |||
95 | class OpkgDpkgPM(PackageManager): | ||
96 | def __init__(self, d, target_rootfs): | ||
97 | """ | ||
98 | This is an abstract class. Do not instantiate this directly. | ||
99 | """ | ||
100 | super(OpkgDpkgPM, self).__init__(d, target_rootfs) | ||
101 | |||
102 | def package_info(self, pkg, cmd): | ||
103 | """ | ||
104 | Returns a dictionary with the package info. | ||
105 | |||
106 | This method extracts the common parts for Opkg and Dpkg | ||
107 | """ | ||
108 | |||
109 | proc = subprocess.run(cmd, capture_output=True, encoding="utf-8", shell=True) | ||
110 | if proc.returncode: | ||
111 | bb.fatal("Unable to list available packages. Command '%s' " | ||
112 | "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr)) | ||
113 | elif proc.stderr: | ||
114 | bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr)) | ||
115 | |||
116 | return opkg_query(proc.stdout) | ||
117 | |||
118 | def extract(self, pkg, pkg_info): | ||
119 | """ | ||
120 | Returns the path to a tmpdir where resides the contents of a package. | ||
121 | |||
122 | Deleting the tmpdir is responsability of the caller. | ||
123 | |||
124 | This method extracts the common parts for Opkg and Dpkg | ||
125 | """ | ||
126 | |||
127 | ar_cmd = bb.utils.which(os.getenv("PATH"), "ar") | ||
128 | tar_cmd = bb.utils.which(os.getenv("PATH"), "tar") | ||
129 | pkg_path = pkg_info[pkg]["filepath"] | ||
130 | |||
131 | if not os.path.isfile(pkg_path): | ||
132 | bb.fatal("Unable to extract package for '%s'." | ||
133 | "File %s doesn't exists" % (pkg, pkg_path)) | ||
134 | |||
135 | tmp_dir = tempfile.mkdtemp() | ||
136 | current_dir = os.getcwd() | ||
137 | os.chdir(tmp_dir) | ||
138 | |||
139 | try: | ||
140 | cmd = [ar_cmd, 'x', pkg_path] | ||
141 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | ||
142 | data_tar = glob.glob("data.tar.*") | ||
143 | if len(data_tar) != 1: | ||
144 | bb.fatal("Unable to extract %s package. Failed to identify " | ||
145 | "data tarball (found tarballs '%s').", | ||
146 | pkg_path, data_tar) | ||
147 | data_tar = data_tar[0] | ||
148 | cmd = [tar_cmd, 'xf', data_tar] | ||
149 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | ||
150 | except subprocess.CalledProcessError as e: | ||
151 | bb.utils.remove(tmp_dir, recurse=True) | ||
152 | bb.fatal("Unable to extract %s package. Command '%s' " | ||
153 | "returned %d:\n%s" % (pkg_path, ' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | ||
154 | except OSError as e: | ||
155 | bb.utils.remove(tmp_dir, recurse=True) | ||
156 | bb.fatal("Unable to extract %s package. Command '%s' " | ||
157 | "returned %d:\n%s at %s" % (pkg_path, ' '.join(cmd), e.errno, e.strerror, e.filename)) | ||
158 | |||
159 | bb.note("Extracted %s to %s" % (pkg_path, tmp_dir)) | ||
160 | bb.utils.remove(os.path.join(tmp_dir, "debian-binary")) | ||
161 | bb.utils.remove(os.path.join(tmp_dir, "control.tar.gz")) | ||
162 | os.chdir(current_dir) | ||
163 | |||
164 | return tmp_dir | ||
165 | |||
166 | def _handle_intercept_failure(self, registered_pkgs): | ||
167 | self.mark_packages("unpacked", registered_pkgs.split()) | ||
168 | |||
169 | class OpkgPM(OpkgDpkgPM): | 94 | class OpkgPM(OpkgDpkgPM): |
170 | def __init__(self, d, target_rootfs, config_file, archs, task_name='target', ipk_repo_workdir="oe-rootfs-repo", filterbydependencies=True, prepare_index=True): | 95 | def __init__(self, d, target_rootfs, config_file, archs, task_name='target', ipk_repo_workdir="oe-rootfs-repo", filterbydependencies=True, prepare_index=True): |
171 | super(OpkgPM, self).__init__(d, target_rootfs) | 96 | super(OpkgPM, self).__init__(d, target_rootfs) |
@@ -491,7 +416,7 @@ class OpkgPM(OpkgDpkgPM): | |||
491 | Returns a dictionary with the package info. | 416 | Returns a dictionary with the package info. |
492 | """ | 417 | """ |
493 | cmd = "%s %s info %s" % (self.opkg_cmd, self.opkg_args, pkg) | 418 | cmd = "%s %s info %s" % (self.opkg_cmd, self.opkg_args, pkg) |
494 | pkg_info = super(OpkgPM, self).package_info(pkg, cmd) | 419 | pkg_info = self._common_package_info(cmd) |
495 | 420 | ||
496 | pkg_arch = pkg_info[pkg]["arch"] | 421 | pkg_arch = pkg_info[pkg]["arch"] |
497 | pkg_filename = pkg_info[pkg]["filename"] | 422 | pkg_filename = pkg_info[pkg]["filename"] |
@@ -499,19 +424,3 @@ class OpkgPM(OpkgDpkgPM): | |||
499 | os.path.join(self.deploy_dir, pkg_arch, pkg_filename) | 424 | os.path.join(self.deploy_dir, pkg_arch, pkg_filename) |
500 | 425 | ||
501 | return pkg_info | 426 | return pkg_info |
502 | |||
503 | def extract(self, pkg): | ||
504 | """ | ||
505 | Returns the path to a tmpdir where resides the contents of a package. | ||
506 | |||
507 | Deleting the tmpdir is responsability of the caller. | ||
508 | """ | ||
509 | pkg_info = self.package_info(pkg) | ||
510 | if not pkg_info: | ||
511 | bb.fatal("Unable to get information for package '%s' while " | ||
512 | "trying to extract the package." % pkg) | ||
513 | |||
514 | tmp_dir = super(OpkgPM, self).extract(pkg, pkg_info) | ||
515 | bb.utils.remove(os.path.join(tmp_dir, "data.tar.zst")) | ||
516 | |||
517 | return tmp_dir | ||
diff --git a/meta/lib/oe/package_manager/rpm/__init__.py b/meta/lib/oe/package_manager/rpm/__init__.py index f40c880af4..323ec5008f 100644 --- a/meta/lib/oe/package_manager/rpm/__init__.py +++ b/meta/lib/oe/package_manager/rpm/__init__.py | |||
@@ -393,8 +393,8 @@ class RpmPM(PackageManager): | |||
393 | # Strip file: prefix | 393 | # Strip file: prefix |
394 | pkg_path = pkg_name[5:] | 394 | pkg_path = pkg_name[5:] |
395 | 395 | ||
396 | cpio_cmd = bb.utils.which(os.getenv("PATH"), "cpio") | 396 | tar_cmd = bb.utils.which(os.getenv("PATH"), "tar") |
397 | rpm2cpio_cmd = bb.utils.which(os.getenv("PATH"), "rpm2cpio") | 397 | rpm2archive_cmd = bb.utils.which(os.getenv("PATH"), "rpm2archive") |
398 | 398 | ||
399 | if not os.path.isfile(pkg_path): | 399 | if not os.path.isfile(pkg_path): |
400 | bb.fatal("Unable to extract package for '%s'." | 400 | bb.fatal("Unable to extract package for '%s'." |
@@ -405,7 +405,7 @@ class RpmPM(PackageManager): | |||
405 | os.chdir(tmp_dir) | 405 | os.chdir(tmp_dir) |
406 | 406 | ||
407 | try: | 407 | try: |
408 | cmd = "%s %s | %s -idmv" % (rpm2cpio_cmd, pkg_path, cpio_cmd) | 408 | cmd = "%s -n %s | %s xv" % (rpm2archive_cmd, pkg_path, tar_cmd) |
409 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | 409 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) |
410 | except subprocess.CalledProcessError as e: | 410 | except subprocess.CalledProcessError as e: |
411 | bb.utils.remove(tmp_dir, recurse=True) | 411 | bb.utils.remove(tmp_dir, recurse=True) |