Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] devtool: default to empty string, if LIC_FILES_CHKSUM is not available
@ 2020-07-06 19:42 Bjarne Michelsen
  2020-07-06 19:50 ` [OE-core] " Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Bjarne Michelsen @ 2020-07-06 19:42 UTC (permalink / raw)
  To: openembedded-core; +Cc: Bjarne Michelsen

[Bug 13971] https://bugzilla.yoctoproject.org/show_bug.cgi?id=13971

A recipe using LICENSE=CLOSED would normally not have LIC_FILES_CHKSUM
set.
If LIC_FILES_CHKSUM was not set, it would cause `devtool upgrade` to fail.

This fixes the issue by defaulting to an empty string if
LIC_FILES_CHKSUM is not found.

Signed-off-by: Bjarne Michelsen <bjarne_michelsen@hotmail.com>
---
 scripts/lib/devtool/upgrade.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index ebe72282bb..0c1de8cdc7 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -550,12 +550,12 @@ def upgrade(args, config, basepath, workspace):
         try:
             logger.info('Extracting current version source...')
             rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides)
-            old_licenses = _extract_licenses(srctree, rd.getVar('LIC_FILES_CHKSUM'))
+            old_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or ""))
             logger.info('Extracting upgraded version source...')
             rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch,
                                                     args.srcrev, args.srcbranch, args.branch, args.keep_temp,
                                                     tinfoil, rd)
-            new_licenses = _extract_licenses(srctree, rd.getVar('LIC_FILES_CHKSUM'))
+            new_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or ""))
             license_diff = _generate_license_diff(old_licenses, new_licenses)
             rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, srcbranch, srcsubdir1, srcsubdir2, config.workspace_path, tinfoil, rd, license_diff, new_licenses, srctree, args.keep_failure)
         except bb.process.CmdError as e:
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] devtool: default to empty string, if LIC_FILES_CHKSUM is not available
  2020-07-06 19:42 [PATCH] devtool: default to empty string, if LIC_FILES_CHKSUM is not available Bjarne Michelsen
@ 2020-07-06 19:50 ` Khem Raj
  2020-07-06 21:47   ` Paul Eggleton
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2020-07-06 19:50 UTC (permalink / raw)
  To: Bjarne Michelsen, openembedded-core



On 7/6/20 12:42 PM, Bjarne Michelsen wrote:
> [Bug 13971] https://bugzilla.yoctoproject.org/show_bug.cgi?id=13971
> 
> A recipe using LICENSE=CLOSED would normally not have LIC_FILES_CHKSUM
> set.
> If LIC_FILES_CHKSUM was not set, it would cause `devtool upgrade` to fail.
> 
> This fixes the issue by defaulting to an empty string if
> LIC_FILES_CHKSUM is not found.
> 

would it do just for recipes which use CLOSED for license ?
since we are synthesizing the checksum, It would be good to remain 
prudent and not empty it out in general when non existent, perhaps
a warning for user to fix it in such cases would be appropriate

> Signed-off-by: Bjarne Michelsen <bjarne_michelsen@hotmail.com>
> ---
>   scripts/lib/devtool/upgrade.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
> index ebe72282bb..0c1de8cdc7 100644
> --- a/scripts/lib/devtool/upgrade.py
> +++ b/scripts/lib/devtool/upgrade.py
> @@ -550,12 +550,12 @@ def upgrade(args, config, basepath, workspace):
>           try:
>               logger.info('Extracting current version source...')
>               rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides)
> -            old_licenses = _extract_licenses(srctree, rd.getVar('LIC_FILES_CHKSUM'))
> +            old_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or ""))
>               logger.info('Extracting upgraded version source...')
>               rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch,
>                                                       args.srcrev, args.srcbranch, args.branch, args.keep_temp,
>                                                       tinfoil, rd)
> -            new_licenses = _extract_licenses(srctree, rd.getVar('LIC_FILES_CHKSUM'))
> +            new_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or ""))
>               license_diff = _generate_license_diff(old_licenses, new_licenses)
>               rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, srcbranch, srcsubdir1, srcsubdir2, config.workspace_path, tinfoil, rd, license_diff, new_licenses, srctree, args.keep_failure)
>           except bb.process.CmdError as e:
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] devtool: default to empty string, if LIC_FILES_CHKSUM is not available
  2020-07-06 19:50 ` [OE-core] " Khem Raj
@ 2020-07-06 21:47   ` Paul Eggleton
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2020-07-06 21:47 UTC (permalink / raw)
  To: Bjarne Michelsen, openembedded-core; +Cc: Khem Raj

Hi Khem / Bjarne

On Tuesday, 7 July 2020 07:50:47 NZST Khem Raj wrote:
> On 7/6/20 12:42 PM, Bjarne Michelsen wrote:
> > [Bug 13971] https://bugzilla.yoctoproject.org/show_bug.cgi?id=13971
> > 
> > A recipe using LICENSE=CLOSED would normally not have LIC_FILES_CHKSUM
> > set.
> > If LIC_FILES_CHKSUM was not set, it would cause `devtool upgrade` to fail.
> > 
> > This fixes the issue by defaulting to an empty string if
> > LIC_FILES_CHKSUM is not found.
> 
> would it do just for recipes which use CLOSED for license ?
> since we are synthesizing the checksum, It would be good to remain
> prudent and not empty it out in general when non existent, perhaps
> a warning for user to fix it in such cases would be appropriate

It would be nice to show an error if LIC_FILES_CHKSUM is empty and LICENSE != 
"CLOSED", although one would imagine this would be a fairly rare situation 
given that LIC_FILES_CHKSUM is mandated by the build system in that case and 
devtool upgrade requires a recipe to already exist (presumably one that has 
been built before). 

The fix itself is reasonable but the bug reference should be in the following 
form:

Fixes: [YOCTO #13971].

Thanks
Paul




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-06 21:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-06 19:42 [PATCH] devtool: default to empty string, if LIC_FILES_CHKSUM is not available Bjarne Michelsen
2020-07-06 19:50 ` [OE-core] " Khem Raj
2020-07-06 21:47   ` Paul Eggleton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox