diff options
Diffstat (limited to 'meta/lib/oe/package_manager/ipk')
-rw-r--r-- | meta/lib/oe/package_manager/ipk/__init__.py | 48 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/ipk/manifest.py | 3 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/ipk/rootfs.py | 41 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/ipk/sdk.py | 11 |
4 files changed, 48 insertions, 55 deletions
diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py index da488c1c7f..0f0038d00d 100644 --- a/meta/lib/oe/package_manager/ipk/__init__.py +++ b/meta/lib/oe/package_manager/ipk/__init__.py | |||
@@ -1,7 +1,10 @@ | |||
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 | ||
7 | import glob | ||
5 | import re | 8 | import re |
6 | import shutil | 9 | import shutil |
7 | import subprocess | 10 | import subprocess |
@@ -14,6 +17,7 @@ class OpkgIndexer(Indexer): | |||
14 | ] | 17 | ] |
15 | 18 | ||
16 | opkg_index_cmd = bb.utils.which(os.getenv('PATH'), "opkg-make-index") | 19 | opkg_index_cmd = bb.utils.which(os.getenv('PATH'), "opkg-make-index") |
20 | opkg_index_cmd_extra_params = self.d.getVar('OPKG_MAKE_INDEX_EXTRA_PARAMS') or "" | ||
17 | if self.d.getVar('PACKAGE_FEED_SIGN') == '1': | 21 | if self.d.getVar('PACKAGE_FEED_SIGN') == '1': |
18 | signer = get_signer(self.d, self.d.getVar('PACKAGE_FEED_GPG_BACKEND')) | 22 | signer = get_signer(self.d, self.d.getVar('PACKAGE_FEED_GPG_BACKEND')) |
19 | else: | 23 | else: |
@@ -39,8 +43,8 @@ class OpkgIndexer(Indexer): | |||
39 | if not os.path.exists(pkgs_file): | 43 | if not os.path.exists(pkgs_file): |
40 | open(pkgs_file, "w").close() | 44 | open(pkgs_file, "w").close() |
41 | 45 | ||
42 | index_cmds.add('%s --checksum md5 --checksum sha256 -r %s -p %s -m %s' % | 46 | 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)) | 47 | (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir, opkg_index_cmd_extra_params)) |
44 | 48 | ||
45 | index_sign_files.add(pkgs_file) | 49 | index_sign_files.add(pkgs_file) |
46 | 50 | ||
@@ -102,12 +106,14 @@ class OpkgDpkgPM(PackageManager): | |||
102 | This method extracts the common parts for Opkg and Dpkg | 106 | This method extracts the common parts for Opkg and Dpkg |
103 | """ | 107 | """ |
104 | 108 | ||
105 | try: | 109 | 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") | 110 | if proc.returncode: |
107 | except subprocess.CalledProcessError as e: | ||
108 | bb.fatal("Unable to list available packages. Command '%s' " | 111 | bb.fatal("Unable to list available packages. Command '%s' " |
109 | "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) | 112 | "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr)) |
110 | return opkg_query(output) | 113 | elif proc.stderr: |
114 | bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr)) | ||
115 | |||
116 | return opkg_query(proc.stdout) | ||
111 | 117 | ||
112 | def extract(self, pkg, pkg_info): | 118 | def extract(self, pkg, pkg_info): |
113 | """ | 119 | """ |
@@ -129,11 +135,16 @@ class OpkgDpkgPM(PackageManager): | |||
129 | tmp_dir = tempfile.mkdtemp() | 135 | tmp_dir = tempfile.mkdtemp() |
130 | current_dir = os.getcwd() | 136 | current_dir = os.getcwd() |
131 | os.chdir(tmp_dir) | 137 | os.chdir(tmp_dir) |
132 | data_tar = 'data.tar.xz' | ||
133 | 138 | ||
134 | try: | 139 | try: |
135 | cmd = [ar_cmd, 'x', pkg_path] | 140 | cmd = [ar_cmd, 'x', pkg_path] |
136 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | 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] | ||
137 | cmd = [tar_cmd, 'xf', data_tar] | 148 | cmd = [tar_cmd, 'xf', data_tar] |
138 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | 149 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) |
139 | except subprocess.CalledProcessError as e: | 150 | except subprocess.CalledProcessError as e: |
@@ -213,7 +224,7 @@ class OpkgPM(OpkgDpkgPM): | |||
213 | 224 | ||
214 | tmp_sf.write(status) | 225 | tmp_sf.write(status) |
215 | 226 | ||
216 | os.rename(status_file + ".tmp", status_file) | 227 | bb.utils.rename(status_file + ".tmp", status_file) |
217 | 228 | ||
218 | def _create_custom_config(self): | 229 | def _create_custom_config(self): |
219 | bb.note("Building from feeds activated!") | 230 | bb.note("Building from feeds activated!") |
@@ -243,7 +254,7 @@ class OpkgPM(OpkgDpkgPM): | |||
243 | """ | 254 | """ |
244 | if (self.d.getVar('FEED_DEPLOYDIR_BASE_URI') or "") != "": | 255 | if (self.d.getVar('FEED_DEPLOYDIR_BASE_URI') or "") != "": |
245 | for arch in self.pkg_archs.split(): | 256 | for arch in self.pkg_archs.split(): |
246 | cfg_file_name = os.path.join(self.target_rootfs, | 257 | cfg_file_name = oe.path.join(self.target_rootfs, |
247 | self.d.getVar("sysconfdir"), | 258 | self.d.getVar("sysconfdir"), |
248 | "opkg", | 259 | "opkg", |
249 | "local-%s-feed.conf" % arch) | 260 | "local-%s-feed.conf" % arch) |
@@ -337,7 +348,7 @@ class OpkgPM(OpkgDpkgPM): | |||
337 | 348 | ||
338 | self.deploy_dir_unlock() | 349 | self.deploy_dir_unlock() |
339 | 350 | ||
340 | def install(self, pkgs, attempt_only=False): | 351 | def install(self, pkgs, attempt_only=False, hard_depends_only=False): |
341 | if not pkgs: | 352 | if not pkgs: |
342 | return | 353 | return |
343 | 354 | ||
@@ -346,6 +357,8 @@ class OpkgPM(OpkgDpkgPM): | |||
346 | cmd += " --add-exclude %s" % exclude | 357 | cmd += " --add-exclude %s" % exclude |
347 | for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split(): | 358 | for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split(): |
348 | cmd += " --add-ignore-recommends %s" % bad_recommendation | 359 | cmd += " --add-ignore-recommends %s" % bad_recommendation |
360 | if hard_depends_only: | ||
361 | cmd += " --no-install-recommends" | ||
349 | cmd += " install " | 362 | cmd += " install " |
350 | cmd += " ".join(pkgs) | 363 | cmd += " ".join(pkgs) |
351 | 364 | ||
@@ -443,15 +456,16 @@ class OpkgPM(OpkgDpkgPM): | |||
443 | cmd = "%s %s --noaction install %s " % (self.opkg_cmd, | 456 | cmd = "%s %s --noaction install %s " % (self.opkg_cmd, |
444 | opkg_args, | 457 | opkg_args, |
445 | ' '.join(pkgs)) | 458 | ' '.join(pkgs)) |
446 | try: | 459 | proc = subprocess.run(cmd, capture_output=True, encoding="utf-8", shell=True) |
447 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | 460 | if proc.returncode: |
448 | except subprocess.CalledProcessError as e: | ||
449 | bb.fatal("Unable to dummy install packages. Command '%s' " | 461 | bb.fatal("Unable to dummy install packages. Command '%s' " |
450 | "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) | 462 | "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr)) |
463 | elif proc.stderr: | ||
464 | bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr)) | ||
451 | 465 | ||
452 | bb.utils.remove(temp_rootfs, True) | 466 | bb.utils.remove(temp_rootfs, True) |
453 | 467 | ||
454 | return output | 468 | return proc.stdout |
455 | 469 | ||
456 | def backup_packaging_data(self): | 470 | def backup_packaging_data(self): |
457 | # Save the opkglib for increment ipk image generation | 471 | # Save the opkglib for increment ipk image generation |
@@ -498,6 +512,6 @@ class OpkgPM(OpkgDpkgPM): | |||
498 | "trying to extract the package." % pkg) | 512 | "trying to extract the package." % pkg) |
499 | 513 | ||
500 | tmp_dir = super(OpkgPM, self).extract(pkg, pkg_info) | 514 | tmp_dir = super(OpkgPM, self).extract(pkg, pkg_info) |
501 | bb.utils.remove(os.path.join(tmp_dir, "data.tar.xz")) | 515 | bb.utils.remove(os.path.join(tmp_dir, "data.tar.zst")) |
502 | 516 | ||
503 | return tmp_dir | 517 | return tmp_dir |
diff --git a/meta/lib/oe/package_manager/ipk/manifest.py b/meta/lib/oe/package_manager/ipk/manifest.py index ee4b57bcb0..3549d7428d 100644 --- a/meta/lib/oe/package_manager/ipk/manifest.py +++ b/meta/lib/oe/package_manager/ipk/manifest.py | |||
@@ -1,8 +1,11 @@ | |||
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 | ||
5 | from oe.manifest import Manifest | 7 | from oe.manifest import Manifest |
8 | import re | ||
6 | 9 | ||
7 | class PkgManifest(Manifest): | 10 | class PkgManifest(Manifest): |
8 | """ | 11 | """ |
diff --git a/meta/lib/oe/package_manager/ipk/rootfs.py b/meta/lib/oe/package_manager/ipk/rootfs.py index 26dbee6f6a..ba93eb62ea 100644 --- a/meta/lib/oe/package_manager/ipk/rootfs.py +++ b/meta/lib/oe/package_manager/ipk/rootfs.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 | ||
@@ -145,51 +147,14 @@ class PkgRootfs(DpkgOpkgRootfs): | |||
145 | self.pm.recover_packaging_data() | 147 | self.pm.recover_packaging_data() |
146 | 148 | ||
147 | bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS'), True) | 149 | bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS'), True) |
148 | |||
149 | def _prelink_file(self, root_dir, filename): | ||
150 | bb.note('prelink %s in %s' % (filename, root_dir)) | ||
151 | prelink_cfg = oe.path.join(root_dir, | ||
152 | self.d.expand('${sysconfdir}/prelink.conf')) | ||
153 | if not os.path.exists(prelink_cfg): | ||
154 | shutil.copy(self.d.expand('${STAGING_DIR_NATIVE}${sysconfdir_native}/prelink.conf'), | ||
155 | prelink_cfg) | ||
156 | |||
157 | cmd_prelink = self.d.expand('${STAGING_DIR_NATIVE}${sbindir_native}/prelink') | ||
158 | self._exec_shell_cmd([cmd_prelink, | ||
159 | '--root', | ||
160 | root_dir, | ||
161 | '-amR', | ||
162 | '-N', | ||
163 | '-c', | ||
164 | self.d.expand('${sysconfdir}/prelink.conf')]) | ||
165 | |||
166 | ''' | 150 | ''' |
167 | Compare two files with the same key twice to see if they are equal. | 151 | Compare two files with the same key twice to see if they are equal. |
168 | If they are not equal, it means they are duplicated and come from | 152 | If they are not equal, it means they are duplicated and come from |
169 | different packages. | 153 | different packages. |
170 | 1st: Comapre them directly; | ||
171 | 2nd: While incremental image creation is enabled, one of the | ||
172 | files could be probaly prelinked in the previous image | ||
173 | creation and the file has been changed, so we need to | ||
174 | prelink the other one and compare them. | ||
175 | ''' | 154 | ''' |
176 | def _file_equal(self, key, f1, f2): | 155 | def _file_equal(self, key, f1, f2): |
177 | |||
178 | # Both of them are not prelinked | ||
179 | if filecmp.cmp(f1, f2): | 156 | if filecmp.cmp(f1, f2): |
180 | return True | 157 | return True |
181 | |||
182 | if bb.data.inherits_class('image-prelink', self.d): | ||
183 | if self.image_rootfs not in f1: | ||
184 | self._prelink_file(f1.replace(key, ''), f1) | ||
185 | |||
186 | if self.image_rootfs not in f2: | ||
187 | self._prelink_file(f2.replace(key, ''), f2) | ||
188 | |||
189 | # Both of them are prelinked | ||
190 | if filecmp.cmp(f1, f2): | ||
191 | return True | ||
192 | |||
193 | # Not equal | 158 | # Not equal |
194 | return False | 159 | return False |
195 | 160 | ||
@@ -200,7 +165,7 @@ class PkgRootfs(DpkgOpkgRootfs): | |||
200 | """ | 165 | """ |
201 | def _multilib_sanity_test(self, dirs): | 166 | def _multilib_sanity_test(self, dirs): |
202 | 167 | ||
203 | allow_replace = self.d.getVar("MULTILIBRE_ALLOW_REP") | 168 | allow_replace = "|".join((self.d.getVar("MULTILIBRE_ALLOW_REP") or "").split()) |
204 | if allow_replace is None: | 169 | if allow_replace is None: |
205 | allow_replace = "" | 170 | allow_replace = "" |
206 | 171 | ||
diff --git a/meta/lib/oe/package_manager/ipk/sdk.py b/meta/lib/oe/package_manager/ipk/sdk.py index e2ca415c8e..3acd55f548 100644 --- a/meta/lib/oe/package_manager/ipk/sdk.py +++ b/meta/lib/oe/package_manager/ipk/sdk.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 | ||
@@ -61,12 +63,19 @@ class PkgSdk(Sdk): | |||
61 | 63 | ||
62 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY')) | 64 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY')) |
63 | 65 | ||
66 | env_bkp = os.environ.copy() | ||
67 | os.environ['PATH'] = self.d.expand("${COREBASE}/scripts/nativesdk-intercept") + \ | ||
68 | os.pathsep + os.environ["PATH"] | ||
69 | |||
64 | self.target_pm.run_intercepts(populate_sdk='target') | 70 | self.target_pm.run_intercepts(populate_sdk='target') |
71 | os.environ.update(env_bkp) | ||
65 | 72 | ||
66 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND")) | 73 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND")) |
67 | 74 | ||
68 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): | 75 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): |
69 | self.target_pm.remove_packaging_data() | 76 | self.target_pm.remove_packaging_data() |
77 | else: | ||
78 | self.target_pm.remove_lists() | ||
70 | 79 | ||
71 | bb.note("Installing NATIVESDK packages") | 80 | bb.note("Installing NATIVESDK packages") |
72 | self._populate_sysroot(self.host_pm, self.host_manifest) | 81 | self._populate_sysroot(self.host_pm, self.host_manifest) |
@@ -78,6 +87,8 @@ class PkgSdk(Sdk): | |||
78 | 87 | ||
79 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): | 88 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): |
80 | self.host_pm.remove_packaging_data() | 89 | self.host_pm.remove_packaging_data() |
90 | else: | ||
91 | self.host_pm.remove_lists() | ||
81 | 92 | ||
82 | target_sysconfdir = os.path.join(self.sdk_target_sysroot, self.sysconfdir) | 93 | target_sysconfdir = os.path.join(self.sdk_target_sysroot, self.sysconfdir) |
83 | host_sysconfdir = os.path.join(self.sdk_host_sysroot, self.sysconfdir) | 94 | host_sysconfdir = os.path.join(self.sdk_host_sysroot, self.sysconfdir) |