buildhistory.bbclass: fix regression from FILES_INFO changes

Message ID 20211117010634.GI13720@codepurple
State New
Headers show
Series buildhistory.bbclass: fix regression from FILES_INFO changes | expand

Commit Message

S. Lockwood-Childs Nov. 17, 2021, 1:06 a.m. UTC
Started getting a stack trace during packagedata task for a
recipe that built fine in hardknott

 *** 0002:buildhistory_emit_pkghistory(d)
     0003:
File: 'meta/classes/buildhistory.bbclass', lineno: 313, function: buildhistory_emit_pkghistory
     0309:            pkginfo.filevars[filevar] = localdata.getVar(filevar) or ""
     0310:
     0311:        # Gather information about packaged files
     0312:        val = localdata.getVar('FILES_INFO') or ''
 *** 0313:        dictval = json.loads(val)
     0314:        filelist = list(dictval.keys())
     0315:        filelist.sort()
     0316:        pkginfo.filelist = " ".join([shlex.quote(x) for x in filelist])
 ...
 Exception: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

which turns out to mean FILES_INFO is undefined for the main package built by
this recipe (FILES_INFO lookup for other packages such as -dev seemed to work fine).

Tracked the regression down to this commit:
    package/scripts: Fix FILES_INFO handling
    OE-Core rev: a1190903e0a61a12c9854c96af918ae8d12c6327

If buildhistory.bbclass uses the same per-package syntax to read
FILES_INFO as package.bbclass uses now when setting it, then
this regression goes away.

Signed-off-by: S. Lockwood-Childs <sjl@vctlabs.com>
---
 meta/classes/buildhistory.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie Nov. 19, 2021, 10:36 a.m. UTC | #1
On Tue, 2021-11-16 at 17:06 -0800, S. Lockwood-Childs wrote:
> Started getting a stack trace during packagedata task for a
> recipe that built fine in hardknott
> 
>  *** 0002:buildhistory_emit_pkghistory(d)
>      0003:
> File: 'meta/classes/buildhistory.bbclass', lineno: 313, function: buildhistory_emit_pkghistory
>      0309:            pkginfo.filevars[filevar] = localdata.getVar(filevar) or ""
>      0310:
>      0311:        # Gather information about packaged files
>      0312:        val = localdata.getVar('FILES_INFO') or ''
>  *** 0313:        dictval = json.loads(val)
>      0314:        filelist = list(dictval.keys())
>      0315:        filelist.sort()
>      0316:        pkginfo.filelist = " ".join([shlex.quote(x) for x in filelist])
>  ...
>  Exception: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
> 
> which turns out to mean FILES_INFO is undefined for the main package built by
> this recipe (FILES_INFO lookup for other packages such as -dev seemed to work fine).
> 
> Tracked the regression down to this commit:
>     package/scripts: Fix FILES_INFO handling
>     OE-Core rev: a1190903e0a61a12c9854c96af918ae8d12c6327
> 
> If buildhistory.bbclass uses the same per-package syntax to read
> FILES_INFO as package.bbclass uses now when setting it, then
> this regression goes away.
> 
> Signed-off-by: S. Lockwood-Childs <sjl@vctlabs.com>
> ---
>  meta/classes/buildhistory.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> index 7c44fec2d1..99300ab431 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -309,7 +309,7 @@ python buildhistory_emit_pkghistory() {
>              pkginfo.filevars[filevar] = localdata.getVar(filevar) or ""
>  
>          # Gather information about packaged files
> -        val = localdata.getVar('FILES_INFO') or ''
> +        val = localdata.getVar('FILES_INFO:%s' % pkg) or ''
>          dictval = json.loads(val)
>          filelist = list(dictval.keys())
>          filelist.sort()

Which revision of the project are you seeing that on? This shouldn't be needed
since a number of lines above there it says:

        localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)

i.e. pkg is in OVERRIDES and therefore FILES_INFO should be FILES_INFO:pkg if
that is set.

I think this is masking some other issue and isn't the correct fix.

Cheers,

Richard

Patch

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 7c44fec2d1..99300ab431 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -309,7 +309,7 @@  python buildhistory_emit_pkghistory() {
             pkginfo.filevars[filevar] = localdata.getVar(filevar) or ""
 
         # Gather information about packaged files
-        val = localdata.getVar('FILES_INFO') or ''
+        val = localdata.getVar('FILES_INFO:%s' % pkg) or ''
         dictval = json.loads(val)
         filelist = list(dictval.keys())
         filelist.sort()