diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2020-07-17 15:02:37 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2020-07-19 22:26:14 -0400 |
commit | fd3d5ff37930ed94e63aa37dfb46a603d09ea848 (patch) | |
tree | 29bc99f5f02b1171f00aeb27711df23fcb1bf5e5 | |
parent | cc25d8efd8d5ab03e8d0db2bd456ff0060e781ad (diff) | |
download | meta-virtualization-fd3d5ff37930ed94e63aa37dfb46a603d09ea848.tar.gz |
sloci-image: fix variant quoting
Bash doesn't deal very well with the quoted "variant" in the
output of the oci-image-index. We can calculate the string at
the top of the function, and just use it as a whole to avoid
needing to figure out the quote escaping.
No changes in the output, except a properly quoted "variant"
when a variant is defined.
We also adjust the definition of "S", since it really wasn't
correct before, and now that we have patches, it is more
important.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r-- | recipes-containers/sloci-image/sloci-image-native_git.bb | 11 | ||||
-rw-r--r-- | recipes-containers/sloci-image/sloci-image/0001-sloci-image-fix-variant-quoting.patch | 42 |
2 files changed, 49 insertions, 4 deletions
diff --git a/recipes-containers/sloci-image/sloci-image-native_git.bb b/recipes-containers/sloci-image/sloci-image-native_git.bb index 56e8e0f1..b3b11bd9 100644 --- a/recipes-containers/sloci-image/sloci-image-native_git.bb +++ b/recipes-containers/sloci-image/sloci-image-native_git.bb | |||
@@ -1,7 +1,10 @@ | |||
1 | SUMMARY = "A simple CLI tool for packing rootfs into a single-layer OCI image" | 1 | SUMMARY = "A simple CLI tool for packing rootfs into a single-layer OCI image" |
2 | LICENSE = "MIT" | 2 | LICENSE = "MIT" |
3 | LIC_FILES_CHKSUM = "file://git/LICENSE;md5=948cd8e59069fad992b0469af9ad7966" | 3 | LIC_FILES_CHKSUM = "file://LICENSE;md5=948cd8e59069fad992b0469af9ad7966" |
4 | SRC_URI = "git://github.com/jirutka/sloci-image.git" | 4 | SRC_URI = "git://github.com/jirutka/sloci-image.git \ |
5 | file://0001-sloci-image-fix-variant-quoting.patch \ | ||
6 | " | ||
7 | |||
5 | 8 | ||
6 | DEPENDS = "" | 9 | DEPENDS = "" |
7 | 10 | ||
@@ -10,13 +13,13 @@ PV = "v0.1.0+git${SRCPV}" | |||
10 | 13 | ||
11 | inherit native | 14 | inherit native |
12 | 15 | ||
13 | S = "${WORKDIR}" | 16 | S = "${WORKDIR}/git" |
14 | 17 | ||
15 | do_compile() { | 18 | do_compile() { |
16 | : | 19 | : |
17 | } | 20 | } |
18 | 21 | ||
19 | do_install() { | 22 | do_install() { |
20 | cd ${S}/git | 23 | cd ${S} |
21 | make PREFIX="${exec_prefix}" DESTDIR=${D} install | 24 | make PREFIX="${exec_prefix}" DESTDIR=${D} install |
22 | } | 25 | } |
diff --git a/recipes-containers/sloci-image/sloci-image/0001-sloci-image-fix-variant-quoting.patch b/recipes-containers/sloci-image/sloci-image/0001-sloci-image-fix-variant-quoting.patch new file mode 100644 index 00000000..5cb35830 --- /dev/null +++ b/recipes-containers/sloci-image/sloci-image/0001-sloci-image-fix-variant-quoting.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | From 55aebd87ee81f851d088beea8688e3e599c2bced Mon Sep 17 00:00:00 2001 | ||
2 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
3 | Date: Fri, 17 Jul 2020 14:40:12 -0400 | ||
4 | Subject: [PATCH] sloci-image: fix variant quoting | ||
5 | |||
6 | Bash doesn't deal very well with the quoted "variant" in the | ||
7 | output of the oci-image-index. We can calculate the string at | ||
8 | the top of the function, and just use it as a whole to avoid | ||
9 | needing to figure out the quote escaping. | ||
10 | |||
11 | No changes in the output, except a properly quoted "variant" | ||
12 | when a variant is defined. | ||
13 | |||
14 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
15 | --- | ||
16 | sloci-image | 3 ++- | ||
17 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/sloci-image b/sloci-image | ||
20 | index be8e79a..e0dc469 100755 | ||
21 | --- a/sloci-image | ||
22 | +++ b/sloci-image | ||
23 | @@ -298,6 +298,7 @@ oci_image_config() { | ||
24 | # $1: digest of the image manifest json (must be in blobs directory) | ||
25 | oci_image_index() { | ||
26 | local manifest_digest="$1" | ||
27 | + local variant_string=" \"variant\": $(json_string "$CFG_ARCH_VARIANT")," | ||
28 | |||
29 | cat <<-EOF | ||
30 | { | ||
31 | @@ -309,7 +310,7 @@ oci_image_index() { | ||
32 | "digest": "$manifest_digest", | ||
33 | "platform": { | ||
34 | "architecture": "$(oci_arch $CFG_ARCH)", | ||
35 | - ${CFG_ARCH_VARIANT:+"\"variant\": $(json_string "$CFG_ARCH_VARIANT"),"} | ||
36 | + ${CFG_ARCH_VARIANT:+$variant_string} | ||
37 | "os": "$CFG_OS" | ||
38 | }, | ||
39 | "annotations": { | ||
40 | -- | ||
41 | 2.19.1 | ||
42 | |||