Hi all, I tried to use the sloci-image as backend for the container-base.bb recipe. Everything works fine until I want to use spaces in the labels.
My setup is only using the poky(Tag: yocto-5.0.4), meta-virtualization(Branch: scarthgap) and my meta-custom with a single bbappend of container-base to reproduce this behaviour. meta-custom/recipes-extended/images/container-base.bbapend: OCI_IMAGE_BACKEND = "sloci-image" OCI_IMAGE_LABELS = "key=value key1=value1 key2='value 2'" I quoted the space in the variable like described by this patch for the umoci backend: https://lists.yoctoproject.org/g/meta-virtualization/topic/102005707#msg8391 The variable oci_image_label_options contains corretly 3 --label with the expected key-value pair. https://git.yoctoproject.org/meta-virtualization/tree/classes/image-oci-sloci-image.inc#n25 So I decided to add double quotes to the variable to keep the space inside the variable: diff --git a/classes/image-oci-sloci-image.inc b/classes/image-oci-sloci-image.inc index 9248489f..ec98e462 100644 --- a/classes/image-oci-sloci-image.inc +++ b/classes/image-oci-sloci-image.inc @@ -22,7 +22,7 @@ IMAGE_CMD:oci() { oci_image_label_options="" if [ -n "${OCI_IMAGE_LABELS}" ]; then for l in ${OCI_IMAGE_LABELS}; do - oci_image_label_options="${oci_image_label_options} --label ${l}" + oci_image_label_options="${oci_image_label_options} --label \"${l}\"" done fi oci_image_env_options="" For debugging purpose I printed the whole command from classes/image-oci-sloci-image.inc and printed the incoming parameters from the sloci-image script. First I run my changes with the bitbake command: build$ bitbake container-base -k ... sloci-image --tar --arch amd64 --arch-variant "" --entrypoint sh --cmd "" --author oe.patch@oe --label "key=value" --label "key1=value1" --label "key2=value 2" ${TOPDIR}/tmp/work/qemux86_64-poky-linux/container-base/1.0/rootfs container-base-qemux86-64.rootfs-20241104125622.rootfs-oci:latest Amount: 20 Value: --tar - --arch Value: --arch - amd64 Value: --arch-variant - Value: --entrypoint - sh Value: --cmd - Value: --author - oe.patch@oe Value: --label - "key=value" Value: --label - "key1=value1" Value: --label - "key2=value Value: 2" - ${TOPDIR}/build/tmp/work/qemux86_64-poky-linux/container-base/1.0/rootfs Usage: sloci-image [options] ROOTFS NAME[:TAG] sloci-image [-h -V] Create a single-layer OCI image with the given rootfs. ... The space by "key2=value 2" causes an line break after the space so the key-value pair is splitted and 2 will be misinterpreted as ROOTFS from the script sloci-image. For further investigation I used the devtool to call that script manually. build$ devtool modify sloci-image-native ... build/workspace/sources/sloci-image-native$ ./sloci-image --tar --arch amd64 --arch-variant "" --entrypoint sh --cmd "" --author oe.patch@oe --label "key=value" --label "key1=value1" --label "key2=value 2" ${TOPDIR}/build/tmp/work/qemux86_64-poky-linux/container-base/1.0/rootfs container-base-qemux86-64.rootfs-20241104125622.rootfs-oci:latest Amount: 19 Value: --tar - --arch Value: --arch - amd64 Value: --arch-variant - Value: --entrypoint - sh Value: --cmd - Value: --author - oe.patch@oe Value: --label - key=value Value: --label - key1=value1 Value: --label - key2=value 2 Value: ${TOPDIR}/build/tmp/work/qemux86_64-poky-linux/container-base/1.0/rootfs - container-base-qemux86-64.rootfs-20241104125622.rootfs-oci:latest The manual call of sloci-image works fine, so the issue must be in meta-virtualization/classes/image-oci-sloci-image.inc. Can anybody help me with this issue? Best regards Simon Kaiser PLCnext System Functions Business Area Industry Management and Automation Phone: +49 5281 946-1517 mailto: [email protected] PHOENIX CONTACT ELECTRONICS GmbH Dringenauer Straße 30 31812 Bad Pyrmont, Germany www.phoenixcontact.com .................................................................. PHOENIX CONTACT ELECTRONICS GmbH Sitz der Gesellschaft / registered office of the company: 31812 Bad Pyrmont USt-Id-Nr.: DE811742156 Amtsgericht Hannover HRB 100528 / district court Hannover HRB 100528 Geschäftsführer / Executive Board: Hans-Jürgen Koch, Dr. Martin Wetter __________________________________________________________________ Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren, jegliche anderweitige Verwendung sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. ---------------------------------------------------------------------------------------------------- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden. ___________________________________________________________________
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#8963): https://lists.yoctoproject.org/g/meta-virtualization/message/8963 Mute This Topic: https://lists.yoctoproject.org/mt/109535848/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
