openembedded-core.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier-oss@weidmueller.com>
To: Saul.Wold@windriver.com,
	openembedded-core@lists.openembedded.org, ticotimo@gmail.com
Subject: Re: [OE-core] [PATCH] recipetool/create: Scan for SDPX-License-Identifier
Date: Fri, 4 Feb 2022 09:11:23 +0100	[thread overview]
Message-ID: <0c0f2fda-5069-b4f9-beee-0fc084ab02ca@weidmueller.com> (raw)
In-Reply-To: <20220203170724.1319808-1-saul.wold@windriver.com>

Hi Saul,

Am 03.02.2022 um 18:07 schrieb Saul Wold via lists.openembedded.org:
> When a file can not be identified by checksum and they contain an SPDX
> License-Identifier tag, use it as the found license.
> 
> [YOCTO #14529]
> 
> Tested with LICENSE files that contain 1 or more SPDX-License-Identifier tags

Can you please give an example for an project with use a 
SPDX-License-Identifier inside a license file.


> Signed-off-by: Saul Wold <saul.wold@windriver.com>
> ---
>   scripts/lib/recipetool/create.py | 16 +++++++++++-----
>   1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
> index 507a230511..9149c2d94f 100644
> --- a/scripts/lib/recipetool/create.py
> +++ b/scripts/lib/recipetool/create.py
> @@ -1221,14 +1221,20 @@ def guess_license(srctree, d):
>       for licfile in sorted(licfiles):
>           md5value = bb.utils.md5_file(licfile)
>           license = md5sums.get(md5value, None)
> +        license_list = []

Could you please use an other name. We already have licenses and it is 
hard to distinguish the difference between licenses and license_list.

>           if not license:
>               license, crunched_md5, lictext = crunch_license(licfile)
>               if lictext and not license:
> -                license = 'Unknown'
> -                logger.info("Please add the following line for '%s' to a 'lib/recipetool/licenses.csv' " \
> -                    "and replace `Unknown` with the license:\n" \
> -                    "%s,Unknown" % (os.path.relpath(licfile, srctree), md5value))
> -        if license:
> +                spdx_re = re.compile('SPDX-License-Identifier:\s+([-A-Za-z\d. ]+)[ |\n|\r\n]*?')
> +                license_list = re.findall(spdx_re, "\n".join(lictext))
> +                if not license_list:
> +                    license_list.append('Unknown')
> +                    logger.info("Please add the following line for '%s' to a 'lib/recipetool/licenses.csv' " \
> +                        "and replace `Unknown` with the license:\n" \
> +                        "%s,Unknown" % (os.path.relpath(licfile, srctree), md5value))
> +        else:
> +            license_list.append(license)
> +        for license in license_list:
>               licenses.append((license, os.path.relpath(licfile, srctree), md5value))
>   
>       # FIXME should we grab at least one source file with a license header and add that too?

Regards
   Stefan


      parent reply	other threads:[~2022-02-04  8:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 17:07 [PATCH] recipetool/create: Scan for SDPX-License-Identifier Saul Wold
2022-02-03 21:24 ` [OE-core] " Richard Purdie
2022-02-03 21:58   ` Saul Wold
2022-02-03 22:01     ` Richard Purdie
2022-02-04  9:05   ` Stefan Herbrechtsmeier
2022-02-04 13:41     ` Richard Purdie
2022-02-04 14:40       ` Stefan Herbrechtsmeier
2022-02-04  8:11 ` Stefan Herbrechtsmeier [this message]

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=0c0f2fda-5069-b4f9-beee-0fc084ab02ca@weidmueller.com \
    --to=stefan.herbrechtsmeier-oss@weidmueller.com \
    --cc=Saul.Wold@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=ticotimo@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).