summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2025-09-11 20:33:23 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-09-15 17:57:23 +0100
commit0ffa8173194403e934220ced5bfdd328d508f575 (patch)
tree43b7caed2ba3da667f10b1281e020c88903d52b0
parent16e7ffa2e23cd7eccc65784ca1c49056b98a269b (diff)
downloadpoky-0ffa8173194403e934220ced5bfdd328d508f575.tar.gz
package_manager/rpm: give out useful reason about unmatched packages
Unmatched package error is a common error at rootfs. We want to give out more useful information to user. Before this change, if some user specifiy IMAGE_INSTALL += "catch2", the error message will be like: No match for argument: catch2 Error: Unable to find a match: catch2 With this patch, the error message will be like: No match for argument: catch2 Error: Unable to find a match: catch2 catch2 is a recipe. Its generated packages are: ['catch2-src', 'catch2-dbg', 'catch2-staticdev', 'catch2-dev', 'catch2-doc'] Either specify a generated package or set ALLOW_EMPTY:${PN} = "1" in catch2 recipe (From OE-Core rev: 00f871cd07d7f44788124510a75b7160fdc60bb5) 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>
-rw-r--r--meta/lib/oe/package_manager/rpm/__init__.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/meta/lib/oe/package_manager/rpm/__init__.py b/meta/lib/oe/package_manager/rpm/__init__.py
index 323ec5008f..20e6cb8744 100644
--- a/meta/lib/oe/package_manager/rpm/__init__.py
+++ b/meta/lib/oe/package_manager/rpm/__init__.py
@@ -330,8 +330,15 @@ class RpmPM(PackageManager):
330 return output 330 return output
331 except subprocess.CalledProcessError as e: 331 except subprocess.CalledProcessError as e:
332 if print_output: 332 if print_output:
333 e_output = e.output.decode("utf-8")
334 extra_info = ""
335 if "install" in dnf_args:
336 if "Error: Unable to find a match:" in e_output:
337 no_match_pkgs = re.search(r'Error: Unable to find a match: ([a-z0-9+\-\._\s]+)', e_output).group(1).split()
338 for pkg in no_match_pkgs:
339 extra_info += self.get_missing_pkg_reason(pkg)
333 (bb.note, bb.fatal)[fatal]("Could not invoke dnf. Command " 340 (bb.note, bb.fatal)[fatal]("Could not invoke dnf. Command "
334 "'%s' returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) 341 "'%s' returned %d:\n%s%s" % (' '.join(cmd), e.returncode, e_output, extra_info))
335 else: 342 else:
336 (bb.note, bb.fatal)[fatal]("Could not invoke dnf. Command " 343 (bb.note, bb.fatal)[fatal]("Could not invoke dnf. Command "
337 "'%s' returned %d:" % (' '.join(cmd), e.returncode)) 344 "'%s' returned %d:" % (' '.join(cmd), e.returncode))