]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oe-pkgdata-util: improve lookup-pkg error for RPROVIDES packages
authorZk47T <zizuzacker@gmail.com>
Wed, 8 Apr 2026 17:12:07 +0000 (00:12 +0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 16 Apr 2026 10:09:38 +0000 (11:09 +0100)
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>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
scripts/oe-pkgdata-util

index 44ae40549ae0dfdf19d63328a59ade03ffd05d16..bbfc6a2dddde4c476ae32cf2789e4587e3f1b670 100755 (executable)
@@ -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: