]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
base: add ability to provide further details when using LICENSE_FLAGS
authorRoss Burton <ross.burton@arm.com>
Wed, 24 May 2023 14:57:21 +0000 (15:57 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 31 May 2023 15:52:42 +0000 (16:52 +0100)
Recipes with proprietary licenses often need to use LICENSE_FLAGS so
that the user can opt-in with consent. However, if you don't consent
then the error simply tells you the license identifier but not further
context.

Add a new variable LICENSE_FLAGS_DETAILS, which will be looked in for a
flag with the name of the licence.  If found then the contents are
printed as a source of further details.

For example, a recipe with an EULA may set:

  LICENSE_FLAGS = "FooBar-EULA"
  LICENSE_FLAGS_DETAILS[FooBar-EULA] = "https://example.com/eula"

If Foobar-EULA isn't in LICENSE_FLAGS_ACCEPTED then the error message is
more useful:

  Has a restricted license 'FooBar-EULA' which is not listed in your
  LICENSE_FLAGS_ACCEPTED. For further details, see
  https://example.com/eula.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-global/base.bbclass

index b6e339ed9c53b13ab7536dfcd1693c8c370a7059..976a2ddee4b6c7a0efaadd41113408f818e4e121 100644 (file)
@@ -516,12 +516,12 @@ python () {
         check_license_format(d)
         unmatched_license_flags = check_license_flags(d)
         if unmatched_license_flags:
-            if len(unmatched_license_flags) == 1:
-                message = "because it has a restricted license '{0}'. Which is not listed in LICENSE_FLAGS_ACCEPTED".format(unmatched_license_flags[0])
-            else:
-                message = "because it has restricted licenses {0}. Which are not listed in LICENSE_FLAGS_ACCEPTED".format(
-                    ", ".join("'{0}'".format(f) for f in unmatched_license_flags))
-            bb.debug(1, "Skipping %s %s" % (pn, message))
+            for unmatched in unmatched_license_flags:
+                message = "Has a restricted license '%s' which is not listed in your LICENSE_FLAGS_ACCEPTED." % unmatched
+                details = d.getVarFlag("LICENSE_FLAGS_DETAILS", unmatched)
+                if details:
+                    message += " For further details, see %s." % details
+            bb.debug(1, "Skipping %s: %s" % (pn, message))
             raise bb.parse.SkipRecipe(message)
 
     # If we're building a target package we need to use fakeroot (pseudo)