diff options
| author | Chen Qi <Qi.Chen@windriver.com> | 2025-09-11 20:33:24 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-15 17:57:24 +0100 |
| commit | 83a7f0353554ab302920826c10a8b34b0ca4b595 (patch) | |
| tree | a4288ac47bcde63a8ba47fa24450c15546e71d7b /meta | |
| parent | 0ffa8173194403e934220ced5bfdd328d508f575 (diff) | |
| download | poky-83a7f0353554ab302920826c10a8b34b0ca4b595.tar.gz | |
package_manager/deb: give out useful reason about an unmatched package
Give out useful information when a package could not be matched.
Before the change:
E: Package 'catch2' has no installation candidate
With this patch:
E: Package 'catch2' has no installation candidate
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: ca6c1dd0148c4776bd556fccfd71153fc72d2e3d)
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')
| -rw-r--r-- | meta/lib/oe/package_manager/deb/__init__.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/meta/lib/oe/package_manager/deb/__init__.py b/meta/lib/oe/package_manager/deb/__init__.py index e09e81e490..eb48f3f982 100644 --- a/meta/lib/oe/package_manager/deb/__init__.py +++ b/meta/lib/oe/package_manager/deb/__init__.py | |||
| @@ -244,9 +244,19 @@ class DpkgPM(OpkgDpkgPM): | |||
| 244 | output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) | 244 | output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) |
| 245 | bb.note(output.decode("utf-8")) | 245 | bb.note(output.decode("utf-8")) |
| 246 | except subprocess.CalledProcessError as e: | 246 | except subprocess.CalledProcessError as e: |
| 247 | e_output = e.output.decode("utf-8") | ||
| 248 | extra_info = "" | ||
| 249 | for e_line in e_output.split('\n'): | ||
| 250 | if 'has no installation candidate' in e_line or 'Unable to locate package' in e_line: | ||
| 251 | match = re.search(r"E: Package '([a-z0-9+\-\._]+)' has no installation candidate", e_line) | ||
| 252 | if match: | ||
| 253 | pkg = match.group(1) | ||
| 254 | else: | ||
| 255 | pkg = re.search(r"E: Unable to locate package ([a-z0-9+\-\._]+)", e_line).group(1) | ||
| 256 | extra_info += self.get_missing_pkg_reason(pkg) | ||
| 247 | (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. " | 257 | (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. " |
| 248 | "Command '%s' returned %d:\n%s" % | 258 | "Command '%s' returned %d:\n%s%s" % |
| 249 | (cmd, e.returncode, e.output.decode("utf-8"))) | 259 | (cmd, e.returncode, e_output, extra_info)) |
| 250 | 260 | ||
| 251 | # rename *.dpkg-new files/dirs | 261 | # rename *.dpkg-new files/dirs |
| 252 | for root, dirs, files in os.walk(self.target_rootfs): | 262 | for root, dirs, files in os.walk(self.target_rootfs): |
