diff options
| author | Chen Qi <Qi.Chen@windriver.com> | 2025-09-11 20:33:22 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-15 17:57:23 +0100 |
| commit | 16e7ffa2e23cd7eccc65784ca1c49056b98a269b (patch) | |
| tree | 908d3da4bb1e08ae7bcf9f09b61bf5c16e7a8a61 /meta/lib | |
| parent | f5adf527f2e3279432800218986505f894167d3d (diff) | |
| download | poky-16e7ffa2e23cd7eccc65784ca1c49056b98a269b.tar.gz | |
package_manager/__init__.py: add function to give user reason about a missing package
When users specify some package in IMAGE_INSTALL, but get some error
at rootfs time, the user might be confusing. This usually happens
when the user puts a recipe name in IMAGE_INSTALL.
To helper user understand more about what's going on, add a common
function here which makes use of pkgdata data to give the possible
reason about a missing package. This function is expected to be used
by package backends such as rpm.
(From OE-Core rev: 4c1f63a7618c5eef1684ecc52af50821a49e2e91)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oe/package_manager/__init__.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py index 5c98a104be..88bc5ab195 100644 --- a/meta/lib/oe/package_manager/__init__.py +++ b/meta/lib/oe/package_manager/__init__.py | |||
| @@ -17,6 +17,7 @@ import oe.utils | |||
| 17 | import oe.path | 17 | import oe.path |
| 18 | import string | 18 | import string |
| 19 | from oe.gpg_sign import get_signer | 19 | from oe.gpg_sign import get_signer |
| 20 | import oe.packagedata | ||
| 20 | import hashlib | 21 | import hashlib |
| 21 | import fnmatch | 22 | import fnmatch |
| 22 | 23 | ||
| @@ -447,6 +448,27 @@ class PackageManager(object, metaclass=ABCMeta): | |||
| 447 | return res | 448 | return res |
| 448 | return _append(uris, base_paths) | 449 | return _append(uris, base_paths) |
| 449 | 450 | ||
| 451 | def get_missing_pkg_reason(self, pkg): | ||
| 452 | """ | ||
| 453 | Return a string describing the possible reason of a missing package. | ||
| 454 | """ | ||
| 455 | reason = "" | ||
| 456 | if not oe.packagedata.packaged(pkg, self.d): | ||
| 457 | if oe.packagedata.has_pkgdata(pkg, self.d): | ||
| 458 | packaged_pkgs = [] | ||
| 459 | recipe_data = oe.packagedata.read_pkgdata(pkg, self.d) | ||
| 460 | for subpkg in recipe_data.get("PACKAGES", "").split(): | ||
| 461 | if oe.packagedata.packaged(subpkg, self.d): | ||
| 462 | packaged_pkgs.append(subpkg) | ||
| 463 | reason = "%s is a recipe. Its generated packages are: %s\n" % (pkg, packaged_pkgs) | ||
| 464 | reason += "Either specify a generated package or set ALLOW_EMPTY:${PN} = \"1\" in %s recipe\n" % pkg | ||
| 465 | else: | ||
| 466 | reason = "%s is neither a recipe nor a generated package.\n" % pkg | ||
| 467 | else: | ||
| 468 | reason = "%s is a generated package.\n" % pkg | ||
| 469 | reason += "The reason it's not found might be that it's not in %s\n" % oe.path.join(self.d.getVar('WORKDIR'), "oe-rootfs-repo") | ||
| 470 | return reason | ||
| 471 | |||
| 450 | def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencies, include_self=False): | 472 | def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencies, include_self=False): |
| 451 | """ | 473 | """ |
| 452 | Go through our do_package_write_X dependencies and hardlink the packages we depend | 474 | Go through our do_package_write_X dependencies and hardlink the packages we depend |
