diff options
Diffstat (limited to 'meta/lib/oe/package_manager/ipk/__init__.py')
-rw-r--r-- | meta/lib/oe/package_manager/ipk/__init__.py | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py index da488c1c7f..8cc9953a02 100644 --- a/meta/lib/oe/package_manager/ipk/__init__.py +++ b/meta/lib/oe/package_manager/ipk/__init__.py | |||
@@ -1,4 +1,6 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: GPL-2.0-only | 4 | # SPDX-License-Identifier: GPL-2.0-only |
3 | # | 5 | # |
4 | 6 | ||
@@ -14,6 +16,7 @@ class OpkgIndexer(Indexer): | |||
14 | ] | 16 | ] |
15 | 17 | ||
16 | opkg_index_cmd = bb.utils.which(os.getenv('PATH'), "opkg-make-index") | 18 | opkg_index_cmd = bb.utils.which(os.getenv('PATH'), "opkg-make-index") |
19 | opkg_index_cmd_extra_params = self.d.getVar('OPKG_MAKE_INDEX_EXTRA_PARAMS') or "" | ||
17 | if self.d.getVar('PACKAGE_FEED_SIGN') == '1': | 20 | if self.d.getVar('PACKAGE_FEED_SIGN') == '1': |
18 | signer = get_signer(self.d, self.d.getVar('PACKAGE_FEED_GPG_BACKEND')) | 21 | signer = get_signer(self.d, self.d.getVar('PACKAGE_FEED_GPG_BACKEND')) |
19 | else: | 22 | else: |
@@ -39,8 +42,8 @@ class OpkgIndexer(Indexer): | |||
39 | if not os.path.exists(pkgs_file): | 42 | if not os.path.exists(pkgs_file): |
40 | open(pkgs_file, "w").close() | 43 | open(pkgs_file, "w").close() |
41 | 44 | ||
42 | index_cmds.add('%s --checksum md5 --checksum sha256 -r %s -p %s -m %s' % | 45 | index_cmds.add('%s --checksum md5 --checksum sha256 -r %s -p %s -m %s %s' % |
43 | (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir)) | 46 | (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir, opkg_index_cmd_extra_params)) |
44 | 47 | ||
45 | index_sign_files.add(pkgs_file) | 48 | index_sign_files.add(pkgs_file) |
46 | 49 | ||
@@ -102,12 +105,14 @@ class OpkgDpkgPM(PackageManager): | |||
102 | This method extracts the common parts for Opkg and Dpkg | 105 | This method extracts the common parts for Opkg and Dpkg |
103 | """ | 106 | """ |
104 | 107 | ||
105 | try: | 108 | proc = subprocess.run(cmd, capture_output=True, encoding="utf-8", shell=True) |
106 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8") | 109 | if proc.returncode: |
107 | except subprocess.CalledProcessError as e: | ||
108 | bb.fatal("Unable to list available packages. Command '%s' " | 110 | bb.fatal("Unable to list available packages. Command '%s' " |
109 | "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) | 111 | "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr)) |
110 | return opkg_query(output) | 112 | elif proc.stderr: |
113 | bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr)) | ||
114 | |||
115 | return opkg_query(proc.stdout) | ||
111 | 116 | ||
112 | def extract(self, pkg, pkg_info): | 117 | def extract(self, pkg, pkg_info): |
113 | """ | 118 | """ |
@@ -129,7 +134,7 @@ class OpkgDpkgPM(PackageManager): | |||
129 | tmp_dir = tempfile.mkdtemp() | 134 | tmp_dir = tempfile.mkdtemp() |
130 | current_dir = os.getcwd() | 135 | current_dir = os.getcwd() |
131 | os.chdir(tmp_dir) | 136 | os.chdir(tmp_dir) |
132 | data_tar = 'data.tar.xz' | 137 | data_tar = 'data.tar.zst' |
133 | 138 | ||
134 | try: | 139 | try: |
135 | cmd = [ar_cmd, 'x', pkg_path] | 140 | cmd = [ar_cmd, 'x', pkg_path] |
@@ -213,7 +218,7 @@ class OpkgPM(OpkgDpkgPM): | |||
213 | 218 | ||
214 | tmp_sf.write(status) | 219 | tmp_sf.write(status) |
215 | 220 | ||
216 | os.rename(status_file + ".tmp", status_file) | 221 | bb.utils.rename(status_file + ".tmp", status_file) |
217 | 222 | ||
218 | def _create_custom_config(self): | 223 | def _create_custom_config(self): |
219 | bb.note("Building from feeds activated!") | 224 | bb.note("Building from feeds activated!") |
@@ -243,7 +248,7 @@ class OpkgPM(OpkgDpkgPM): | |||
243 | """ | 248 | """ |
244 | if (self.d.getVar('FEED_DEPLOYDIR_BASE_URI') or "") != "": | 249 | if (self.d.getVar('FEED_DEPLOYDIR_BASE_URI') or "") != "": |
245 | for arch in self.pkg_archs.split(): | 250 | for arch in self.pkg_archs.split(): |
246 | cfg_file_name = os.path.join(self.target_rootfs, | 251 | cfg_file_name = oe.path.join(self.target_rootfs, |
247 | self.d.getVar("sysconfdir"), | 252 | self.d.getVar("sysconfdir"), |
248 | "opkg", | 253 | "opkg", |
249 | "local-%s-feed.conf" % arch) | 254 | "local-%s-feed.conf" % arch) |
@@ -337,7 +342,7 @@ class OpkgPM(OpkgDpkgPM): | |||
337 | 342 | ||
338 | self.deploy_dir_unlock() | 343 | self.deploy_dir_unlock() |
339 | 344 | ||
340 | def install(self, pkgs, attempt_only=False): | 345 | def install(self, pkgs, attempt_only=False, hard_depends_only=False): |
341 | if not pkgs: | 346 | if not pkgs: |
342 | return | 347 | return |
343 | 348 | ||
@@ -346,6 +351,8 @@ class OpkgPM(OpkgDpkgPM): | |||
346 | cmd += " --add-exclude %s" % exclude | 351 | cmd += " --add-exclude %s" % exclude |
347 | for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split(): | 352 | for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split(): |
348 | cmd += " --add-ignore-recommends %s" % bad_recommendation | 353 | cmd += " --add-ignore-recommends %s" % bad_recommendation |
354 | if hard_depends_only: | ||
355 | cmd += " --no-install-recommends" | ||
349 | cmd += " install " | 356 | cmd += " install " |
350 | cmd += " ".join(pkgs) | 357 | cmd += " ".join(pkgs) |
351 | 358 | ||
@@ -443,15 +450,16 @@ class OpkgPM(OpkgDpkgPM): | |||
443 | cmd = "%s %s --noaction install %s " % (self.opkg_cmd, | 450 | cmd = "%s %s --noaction install %s " % (self.opkg_cmd, |
444 | opkg_args, | 451 | opkg_args, |
445 | ' '.join(pkgs)) | 452 | ' '.join(pkgs)) |
446 | try: | 453 | proc = subprocess.run(cmd, capture_output=True, encoding="utf-8", shell=True) |
447 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | 454 | if proc.returncode: |
448 | except subprocess.CalledProcessError as e: | ||
449 | bb.fatal("Unable to dummy install packages. Command '%s' " | 455 | bb.fatal("Unable to dummy install packages. Command '%s' " |
450 | "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) | 456 | "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr)) |
457 | elif proc.stderr: | ||
458 | bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr)) | ||
451 | 459 | ||
452 | bb.utils.remove(temp_rootfs, True) | 460 | bb.utils.remove(temp_rootfs, True) |
453 | 461 | ||
454 | return output | 462 | return proc.stdout |
455 | 463 | ||
456 | def backup_packaging_data(self): | 464 | def backup_packaging_data(self): |
457 | # Save the opkglib for increment ipk image generation | 465 | # Save the opkglib for increment ipk image generation |
@@ -498,6 +506,6 @@ class OpkgPM(OpkgDpkgPM): | |||
498 | "trying to extract the package." % pkg) | 506 | "trying to extract the package." % pkg) |
499 | 507 | ||
500 | tmp_dir = super(OpkgPM, self).extract(pkg, pkg_info) | 508 | tmp_dir = super(OpkgPM, self).extract(pkg, pkg_info) |
501 | bb.utils.remove(os.path.join(tmp_dir, "data.tar.xz")) | 509 | bb.utils.remove(os.path.join(tmp_dir, "data.tar.zst")) |
502 | 510 | ||
503 | return tmp_dir | 511 | return tmp_dir |