diff mbox series

[2/5] vex.bbclass: Cease forced symlink creation

Message ID 20250114153748.2358116-2-niko.mauno@vaisala.com
State New
Headers show
Series [1/5] vex.bbclass: Drop redundant import update_symlinks | expand

Commit Message

Niko Mauno Jan. 14, 2025, 3:37 p.m. UTC
Allow the method to work also when the user has overridden
IMAGE_LINK_NAME value as empty string.

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
---
 meta/classes/vex.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Marta Rybczynska Jan. 14, 2025, 3:57 p.m. UTC | #1
On Tue, Jan 14, 2025 at 4:38 PM Niko Mauno via lists.openembedded.org
<niko.mauno=vaisala.com@lists.openembedded.org> wrote:

> Allow the method to work also when the user has overridden
> IMAGE_LINK_NAME value as empty string.
>
> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> ---
>  meta/classes/vex.bbclass | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/vex.bbclass b/meta/classes/vex.bbclass
> index c9749d4ceb..3719e5c222 100644
> --- a/meta/classes/vex.bbclass
> +++ b/meta/classes/vex.bbclass
> @@ -211,13 +211,15 @@ python vex_write_rootfs_manifest () {
>
>      d.setVar("PN", save_pn)
>
> -    link_path = os.path.join(deploy_dir, "%s.json" % link_name)
>      manifest_name = d.getVar("CVE_CHECK_MANIFEST_JSON")
>
>      with open(manifest_name, "w") as f:
>          json.dump(json_data, f, indent=2)
>
> -    update_symlinks(manifest_name, link_path)
> +    if link_name:
> +        link_path = os.path.join(deploy_dir, "%s.json" % link_name)
> +        update_symlinks(manifest_name, link_path)
> +
>      bb.plain("Image VEX JSON report stored in: %s" % manifest_name)
>  }
>
>
What about a common function to use in both cve-check.bbclass and
vex.bbclass?

Also, it would be helpful to document what happens when the variable is
empty.

Kind regards,
Marta
Niko Mauno Jan. 15, 2025, 9:16 a.m. UTC | #2
On 14.1.2025 17.57, Marta Rybczynska wrote:
>
> On Tue, Jan 14, 2025 at 4:38 PM Niko Mauno via lists.openembedded.org <http://lists.openembedded.org/
> 
> What about a common function to use in both cve-check.bbclass and vex.bbclass?

I have so far been exposed to using cve-check.bbclass only, and I thought it would make sense to fix the symlink-less use case in both bbclasses where they seem to appear similarly. Making an architectural change was not in my original scope, particularly when I am not familiar with vex.bbclass context.

> Also, it would be helpful to document what happens when the variable is empty.

My intent in this series was to mitigate the behavior with respect to what is described in https://docs.yoctoproject.org/ref-manual/variables.html#term-IMAGE_LINK_NAME namely 'It is possible to set this to “” to disable symlink creation'. So my assumption was I could just update the document regarding the 'you also need to set IMAGE_NAME' part in case the topmost commit in this series is integrated.

> Kind regards,
> Marta

BR, Niko
Niko Mauno Jan. 16, 2025, 5:01 p.m. UTC | #3
On 15.1.2025 11.16, Niko Mauno via lists.openembedded.org wrote:
> On 14.1.2025 17.57, Marta Rybczynska wrote:
>>
>> On Tue, Jan 14, 2025 at 4:38 PM Niko Mauno via lists.openembedded.org <http://lists.openembedded.org/
>>
>> What about a common function to use in both cve-check.bbclass and vex.bbclass?
> 
> I have so far been exposed to using cve-check.bbclass only, and I thought it would make sense to fix the symlink-less use case in both bbclasses where they seem to appear similarly. Making an architectural change was not in my original scope, particularly when I am not familiar with vex.bbclass context.
> 
>> Also, it would be helpful to document what happens when the variable is empty.
> 
> My intent in this series was to mitigate the behavior with respect to what is described in https://docs.yoctoproject.org/ref-manual/variables.html#term-IMAGE_LINK_NAME namely 'It is possible to set this to “” to disable symlink creation'. So my assumption was I could just update the document regarding the 'you also need to set IMAGE_NAME' part in case the topmost commit in this series is integrated.
> 
>> Kind regards,
>> Marta
> 
> BR, Niko

Just to elaborate a bit further why I feel it makes sense to avoid the forced symlink creation, currently if my local.conf has following overrides

   INHERIT = "cve-check"
   IMAGE_NAME = "${IMAGE_BASENAME}"
   IMAGE_LINK_NAME = ""

and I issue 'bitbake core-image-minimal core-image-base' what follows is

   Image CVE JSON report stored in: .../build/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/deploy-core-image-minimal-image-complete/core-image-minimal.json
   Image CVE JSON report stored in: .../build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/deploy-core-image-base-image-complete/core-image-base.json
   ERROR: core-image-base-1.0-r0 do_image_complete: Recipe core-image-base is trying to install files into a shared area when those files already exist. The files and the manifests listing them are:
   .../build/tmp/deploy/images/qemux86-64/.json
     (matched in manifest-qemux86_64-core-image-minimal.image_complete)
   Please adjust the recipes so only one recipe provides a given file.
   ERROR: Logfile of failure stored in: .../build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/temp/log.do_image_complete.2654424
   ERROR: Task (.../meta/recipes-core/images/core-image-base.bb:do_image_complete) failed with exit code '1'

-Niko
diff mbox series

Patch

diff --git a/meta/classes/vex.bbclass b/meta/classes/vex.bbclass
index c9749d4ceb..3719e5c222 100644
--- a/meta/classes/vex.bbclass
+++ b/meta/classes/vex.bbclass
@@ -211,13 +211,15 @@  python vex_write_rootfs_manifest () {
 
     d.setVar("PN", save_pn)
 
-    link_path = os.path.join(deploy_dir, "%s.json" % link_name)
     manifest_name = d.getVar("CVE_CHECK_MANIFEST_JSON")
 
     with open(manifest_name, "w") as f:
         json.dump(json_data, f, indent=2)
 
-    update_symlinks(manifest_name, link_path)
+    if link_name:
+        link_path = os.path.join(deploy_dir, "%s.json" % link_name)
+        update_symlinks(manifest_name, link_path)
+
     bb.plain("Image VEX JSON report stored in: %s" % manifest_name)
 }