On Tue, 2021-10-26 at 09:32 +0200, Tomasz Dziendzielski wrote:
> If image recipe depends on another image recipe it will try to use
> license recipeinfo that is not deployed. It will result in:
> > Exception: FileNotFoundError: [Errno 2] No such file or directory:
> > 'TMPDIR/deploy/licenses/foo-image/recipeinfo'
> 
> In such case check for image_license.manifest file (which means dep is
> an image recipe) and skip if true.
> 
> Signed-off-by: Tomasz Dziendzielski <[email protected]>
> Signed-off-by: Jan Brzezanski <[email protected]>
> Signed-off-by: Ricardo Rodrigues <[email protected]>
> Signed-off-by: Szymon Czarnuch <[email protected]>
> Signed-off-by: Kamil Kwiek <[email protected]>
> ---
>  meta/classes/license_image.bbclass | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/classes/license_image.bbclass 
> b/meta/classes/license_image.bbclass
> index bf70bee99b..cc1d9ea651 100644
> --- a/meta/classes/license_image.bbclass
> +++ b/meta/classes/license_image.bbclass
> @@ -201,10 +201,17 @@ def license_deployed_manifest(d):
>          man_dic[dep]["PN"] = dep
>          man_dic[dep]["FILES"] = \
>              " ".join(get_deployed_files(dep_dic[dep]))
> -        with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f:
> -            for line in f.readlines():
> -                key,val = line.split(": ", 1)
> -                man_dic[dep][key] = val[:-1]
> +        try:
> +            with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f:
> +                for line in f.readlines():
> +                    key,val = line.split(": ", 1)
> +                    man_dic[dep][key] = val[:-1]
> +        except FileNotFoundError:
> +            if os.path.exists(os.path.join(
> +                    lic_dir, "%s-%s" % (dep, d.getVar("MACHINE")), 
> "image_license.manifest")):
> +                del man_dic[dep]
> +            else:
> +                raise
>  
>      lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
>                                      d.getVar('IMAGE_NAME'))

We've seen this issue before. I don't like the fixes I've seen for two reasons:

a) we can't tell the difference between a broken recipe which failed to generate
recipeinfo for some reason and an image target

b) The license info is effectively lost/ignored for the second image

I think we need to do something better than this.

Cheers,

Richard



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#157392): 
https://lists.openembedded.org/g/openembedded-core/message/157392
Mute This Topic: https://lists.openembedded.org/mt/86597669/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to