diff options
Diffstat (limited to 'meta/lib/oe/package_manager')
-rw-r--r-- | meta/lib/oe/package_manager/__init__.py | 85 | ||||
-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 | 89 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/rpm/__init__.py | 6 |
5 files changed, 147 insertions, 215 deletions
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py index 6774cdb794..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') |
@@ -449,7 +447,7 @@ class PackageManager(object, metaclass=ABCMeta): | |||
449 | return res | 447 | return res |
450 | return _append(uris, base_paths) | 448 | return _append(uris, base_paths) |
451 | 449 | ||
452 | def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencies): | 450 | def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencies, include_self=False): |
453 | """ | 451 | """ |
454 | Go through our do_package_write_X dependencies and hardlink the packages we depend | 452 | Go through our do_package_write_X dependencies and hardlink the packages we depend |
455 | upon into the repo directory. This prevents us seeing other packages that may | 453 | upon into the repo directory. This prevents us seeing other packages that may |
@@ -486,14 +484,17 @@ def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencie | |||
486 | bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?") | 484 | bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?") |
487 | pkgdeps = set() | 485 | pkgdeps = set() |
488 | start = [start] | 486 | start = [start] |
489 | seen = set(start) | 487 | if include_self: |
488 | seen = set() | ||
489 | else: | ||
490 | seen = set(start) | ||
490 | # Support direct dependencies (do_rootfs -> do_package_write_X) | 491 | # Support direct dependencies (do_rootfs -> do_package_write_X) |
491 | # or indirect dependencies within PN (do_populate_sdk_ext -> do_rootfs -> do_package_write_X) | 492 | # or indirect dependencies within PN (do_populate_sdk_ext -> do_rootfs -> do_package_write_X) |
492 | while start: | 493 | while start: |
493 | next = [] | 494 | next = [] |
494 | for dep2 in start: | 495 | for dep2 in start: |
495 | for dep in taskdepdata[dep2][3]: | 496 | for dep in taskdepdata[dep2][3]: |
496 | if taskdepdata[dep][0] != pn: | 497 | if include_self or taskdepdata[dep][0] != pn: |
497 | if "do_" + taskname in dep: | 498 | if "do_" + taskname in dep: |
498 | pkgdeps.add(dep) | 499 | pkgdeps.add(dep) |
499 | elif dep not in seen: | 500 | elif dep not in seen: |
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 8cc9953a02..3d998e52ff 100644 --- a/meta/lib/oe/package_manager/ipk/__init__.py +++ b/meta/lib/oe/package_manager/ipk/__init__.py | |||
@@ -8,6 +8,7 @@ import re | |||
8 | import shutil | 8 | import shutil |
9 | import subprocess | 9 | import subprocess |
10 | from oe.package_manager import * | 10 | from oe.package_manager import * |
11 | from oe.package_manager.common_deb_ipk import OpkgDpkgPM | ||
11 | 12 | ||
12 | class OpkgIndexer(Indexer): | 13 | class OpkgIndexer(Indexer): |
13 | def write_index(self): | 14 | def write_index(self): |
@@ -90,76 +91,6 @@ class PMPkgsList(PkgsList): | |||
90 | return opkg_query(cmd_output) | 91 | return opkg_query(cmd_output) |
91 | 92 | ||
92 | 93 | ||
93 | |||
94 | class OpkgDpkgPM(PackageManager): | ||
95 | def __init__(self, d, target_rootfs): | ||
96 | """ | ||
97 | This is an abstract class. Do not instantiate this directly. | ||
98 | """ | ||
99 | super(OpkgDpkgPM, self).__init__(d, target_rootfs) | ||
100 | |||
101 | def package_info(self, pkg, cmd): | ||
102 | """ | ||
103 | Returns a dictionary with the package info. | ||
104 | |||
105 | This method extracts the common parts for Opkg and Dpkg | ||
106 | """ | ||
107 | |||
108 | proc = subprocess.run(cmd, capture_output=True, encoding="utf-8", shell=True) | ||
109 | if proc.returncode: | ||
110 | bb.fatal("Unable to list available packages. Command '%s' " | ||
111 | "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr)) | ||
112 | elif proc.stderr: | ||
113 | bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr)) | ||
114 | |||
115 | return opkg_query(proc.stdout) | ||
116 | |||
117 | def extract(self, pkg, pkg_info): | ||
118 | """ | ||
119 | Returns the path to a tmpdir where resides the contents of a package. | ||
120 | |||
121 | Deleting the tmpdir is responsability of the caller. | ||
122 | |||
123 | This method extracts the common parts for Opkg and Dpkg | ||
124 | """ | ||
125 | |||
126 | ar_cmd = bb.utils.which(os.getenv("PATH"), "ar") | ||
127 | tar_cmd = bb.utils.which(os.getenv("PATH"), "tar") | ||
128 | pkg_path = pkg_info[pkg]["filepath"] | ||
129 | |||
130 | if not os.path.isfile(pkg_path): | ||
131 | bb.fatal("Unable to extract package for '%s'." | ||
132 | "File %s doesn't exists" % (pkg, pkg_path)) | ||
133 | |||
134 | tmp_dir = tempfile.mkdtemp() | ||
135 | current_dir = os.getcwd() | ||
136 | os.chdir(tmp_dir) | ||
137 | data_tar = 'data.tar.zst' | ||
138 | |||
139 | try: | ||
140 | cmd = [ar_cmd, 'x', pkg_path] | ||
141 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | ||
142 | cmd = [tar_cmd, 'xf', data_tar] | ||
143 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | ||
144 | except subprocess.CalledProcessError as e: | ||
145 | bb.utils.remove(tmp_dir, recurse=True) | ||
146 | bb.fatal("Unable to extract %s package. Command '%s' " | ||
147 | "returned %d:\n%s" % (pkg_path, ' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | ||
148 | except OSError as e: | ||
149 | bb.utils.remove(tmp_dir, recurse=True) | ||
150 | bb.fatal("Unable to extract %s package. Command '%s' " | ||
151 | "returned %d:\n%s at %s" % (pkg_path, ' '.join(cmd), e.errno, e.strerror, e.filename)) | ||
152 | |||
153 | bb.note("Extracted %s to %s" % (pkg_path, tmp_dir)) | ||
154 | bb.utils.remove(os.path.join(tmp_dir, "debian-binary")) | ||
155 | bb.utils.remove(os.path.join(tmp_dir, "control.tar.gz")) | ||
156 | os.chdir(current_dir) | ||
157 | |||
158 | return tmp_dir | ||
159 | |||
160 | def _handle_intercept_failure(self, registered_pkgs): | ||
161 | self.mark_packages("unpacked", registered_pkgs.split()) | ||
162 | |||
163 | class OpkgPM(OpkgDpkgPM): | 94 | class OpkgPM(OpkgDpkgPM): |
164 | 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): |
165 | super(OpkgPM, self).__init__(d, target_rootfs) | 96 | super(OpkgPM, self).__init__(d, target_rootfs) |
@@ -485,7 +416,7 @@ class OpkgPM(OpkgDpkgPM): | |||
485 | Returns a dictionary with the package info. | 416 | Returns a dictionary with the package info. |
486 | """ | 417 | """ |
487 | 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) |
488 | pkg_info = super(OpkgPM, self).package_info(pkg, cmd) | 419 | pkg_info = self._common_package_info(cmd) |
489 | 420 | ||
490 | pkg_arch = pkg_info[pkg]["arch"] | 421 | pkg_arch = pkg_info[pkg]["arch"] |
491 | pkg_filename = pkg_info[pkg]["filename"] | 422 | pkg_filename = pkg_info[pkg]["filename"] |
@@ -493,19 +424,3 @@ class OpkgPM(OpkgDpkgPM): | |||
493 | os.path.join(self.deploy_dir, pkg_arch, pkg_filename) | 424 | os.path.join(self.deploy_dir, pkg_arch, pkg_filename) |
494 | 425 | ||
495 | return pkg_info | 426 | return pkg_info |
496 | |||
497 | def extract(self, pkg): | ||
498 | """ | ||
499 | Returns the path to a tmpdir where resides the contents of a package. | ||
500 | |||
501 | Deleting the tmpdir is responsability of the caller. | ||
502 | """ | ||
503 | pkg_info = self.package_info(pkg) | ||
504 | if not pkg_info: | ||
505 | bb.fatal("Unable to get information for package '%s' while " | ||
506 | "trying to extract the package." % pkg) | ||
507 | |||
508 | tmp_dir = super(OpkgPM, self).extract(pkg, pkg_info) | ||
509 | bb.utils.remove(os.path.join(tmp_dir, "data.tar.zst")) | ||
510 | |||
511 | 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) |