public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Zk47T" <zizuzacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: zizuzacker@gmail.com
Subject: [PATCH] oe-pkgdata-util: improve lookup-pkg error for RPROVIDES packages
Date: Thu,  9 Apr 2026 00:12:07 +0700	[thread overview]
Message-ID: <20260408171207.987097-1-zizuzacker@gmail.com> (raw)

When a package is not found by 'oe-pkgdata-util lookup-pkg', the error
message provides no guidance on what went wrong or where to look.

Improve the error message by checking the runtime-rprovides directory
for the missing package. If the package exists in RPROVIDES:

 - If the provider package was generated, suggest looking up the actual
   package name instead.
 - If the provider package was not generated (e.g. empty package or
   disabled by PACKAGECONFIG), inform the user which recipe provides it
   and that it was not generated.

This helps users quickly identify the correct package name or
understand why a package is missing from their build.

Before:
  ERROR: The following packages could not be found: eglibc

After:
  ERROR: eglibc is in the RPROVIDES of glibc (recipe: glibc), try
  looking up 'glibc' instead

[YOCTO #16083]

Signed-off-by: Zk47T <zizuzacker@gmail.com>
---
 scripts/oe-pkgdata-util | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index 44ae40549a..bbfc6a2ddd 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -237,7 +237,27 @@ def lookup_pkg(args):
 
     if len(mappings) < len(pkgs):
         missing = list(set(pkgs) - set(mappings.keys()))
-        logger.error("The following packages could not be found: %s" % ', '.join(missing))
+        for pkg in missing:
+            providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg)
+            if os.path.exists(providepkgpath):
+                providers = os.listdir(providepkgpath)
+                for provider in providers:
+                    if provider == pkg:
+                        continue
+                    pn = ""
+                    pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", provider)
+                    if os.path.exists(pkgdatafile):
+                        with open(pkgdatafile, 'r') as f:
+                            for line in f:
+                                if line.startswith('PN:'):
+                                    pn = line.split(':', 1)[1].strip()
+                                    break
+                    if os.path.exists(os.path.join(args.pkgdata_dir, "runtime", "%s.packaged" % provider)):
+                        logger.error("%s is in the RPROVIDES of %s (recipe: %s), try looking up '%s' instead" % (pkg, provider, pn or "unknown", provider))
+                    else:
+                        logger.error("%s is in the RPROVIDES of %s (recipe: %s), but the package was not generated (e.g. empty package or disabled PACKAGECONFIG)" % (pkg, provider, pn or "unknown"))
+            else:
+                logger.error("The following packages could not be found: %s" % pkg)
         sys.exit(1)
 
     if args.reverse:
-- 
2.34.1



                 reply	other threads:[~2026-04-08 17:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260408171207.987097-1-zizuzacker@gmail.com \
    --to=zizuzacker@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox