Skip to contentSkip to conversation

classes/image-oci-umoci: Allow labels to have spaces

PATCH In review Joshua Watt 2 participants 2 messages Oct 16, 2023 – Oct 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 classes/image-oci-umoci: Allow labels to have spaces

Quote the label argument passed to umoci to allow it to correctly handle spaces. Note that this requires that OCI_IMAGE_LABELS have the argument quoted with single quotes, as in:

    OCI_IMAGE_LABELS = "org.opencontainers.image.description='${SUMMARY}'"
---
 classes/image-oci-umoci.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
classes/image-oci-umoci.inc +2 -2
index 58e4668..333c816 100644
@@ -58,8 +58,8 @@ IMAGE_CMD:oci() {
     bbdebug 1 "OCI: configuring image"
     if [ -n "${OCI_IMAGE_LABELS}" ]; then
 	for l in ${OCI_IMAGE_LABELS}; do
-	    bbdebug 1 "OCI: umoci config --image $image_name:${OCI_IMAGE_TAG} --config.label $l"
-	    umoci config --image $image_name:${OCI_IMAGE_TAG} --config.label $l
+	    bbdebug 1 "OCI: umoci config --image $image_name:${OCI_IMAGE_TAG} --config.label \"$l\""
+	    umoci config --image $image_name:${OCI_IMAGE_TAG} --config.label "$l"
 	done
     fi
     if [ -n "${OCI_IMAGE_ENV_VARS}" ]; then
Signature · 1 line
2.34.1
#1 lore raw

Ack'd.

This makes sense regardless of the other patches I'm doing more tests with.

This will be staged shortly.

Bruce

Quoted 39 lines · Joshua Watt

Quote the label argument passed to umoci to allow it to correctly handle spaces. Note that this requires that OCI_IMAGE_LABELS have the argument quoted with single quotes, as in:

    OCI_IMAGE_LABELS = "org.opencontainers.image.description='${SUMMARY}'"
---
 classes/image-oci-umoci.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
classes/image-oci-umoci.inc +2 -3
index 58e4668..333c816 100644
@@ -58,8 +58,8 @@ IMAGE_CMD:oci() {
     bbdebug 1 "OCI: configuring image"
     if [ -n "${OCI_IMAGE_LABELS}" ]; then
        for l in ${OCI_IMAGE_LABELS}; do
-           bbdebug 1 "OCI: umoci config --image $image_name:${OCI_IMAGE_TAG} --config.label $l"
-           umoci config --image $image_name:${OCI_IMAGE_TAG} --config.label $l
+           bbdebug 1 "OCI: umoci config --image $image_name:${OCI_IMAGE_TAG} --config.label \"$l\""
+           umoci config --image $image_name:${OCI_IMAGE_TAG} --config.label "$l"
        done
     fi
     if [ -n "${OCI_IMAGE_ENV_VARS}" ]; then
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8375): https://lists.yoctoproject.org/g/meta-virtualization/message/8375
Mute This Topic: https://lists.yoctoproject.org/mt/102005707/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II