From patchwork Wed May 24 14:57:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 24397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0555C7EE23 for ; Wed, 24 May 2023 14:57:35 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.11204.1684940245388708323 for ; Wed, 24 May 2023 07:57:25 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 708A0113E; Wed, 24 May 2023 07:58:09 -0700 (PDT) Received: from oss-tx204.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E63F33F762; Wed, 24 May 2023 07:57:23 -0700 (PDT) From: ross.burton@arm.com To: openembedded-core@lists.openembedded.org Cc: nd@arm.com Subject: [PATCH] base: add ability to provide further details when using LICENSE_FLAGS Date: Wed, 24 May 2023 15:57:21 +0100 Message-Id: <20230524145721.3628187-1-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 24 May 2023 14:57:35 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/181677 From: Ross Burton 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 --- meta/classes-global/base.bbclass | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index b6e339ed9c5..976a2ddee4b 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass @@ -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)