diff options
3 files changed, 81 insertions, 5 deletions
diff --git a/recipes-containers/crun/crun/0001-libocispec-correctly-parse-JSON-schema-references.patch b/recipes-containers/crun/crun/0001-libocispec-correctly-parse-JSON-schema-references.patch new file mode 100644 index 00000000..9613ac5e --- /dev/null +++ b/recipes-containers/crun/crun/0001-libocispec-correctly-parse-JSON-schema-references.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | From 30ff5f092bc9799b7037f94fe415ae98f447013a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
| 3 | Date: Fri, 17 Oct 2025 11:03:41 -0400 | ||
| 4 | Subject: [PATCH] libocispec: correctly parse JSON schema references | ||
| 5 | |||
| 6 | The `generate.py` script was failing to parse JSON schema references that | ||
| 7 | use a `#` to separate the file path from the fragment. The script was | ||
| 8 | incorrectly splitting the reference at `#/`, which caused `FileNotFoundError` | ||
| 9 | for local references (e.g. `#definitions/uint32`) and for references | ||
| 10 | to other files (e.g. `config-solaris.json#/solaris`). | ||
| 11 | |||
| 12 | This commit fixes the `splite_ref_name` function to correctly split the | ||
| 13 | reference at the `#` character, and handles both local and remote | ||
| 14 | references properly. | ||
| 15 | |||
| 16 | Upstream-Status: Inappropriate [configuration specific] | ||
| 17 | |||
| 18 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
| 19 | --- | ||
| 20 | src/ocispec/generate.py | 7 ++++++- | ||
| 21 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
| 22 | |||
| 23 | diff --git a/src/ocispec/generate.py b/src/ocispec/generate.py | ||
| 24 | index 530d69d..75bed78 100755 | ||
| 25 | --- a/src/ocispec/generate.py | ||
| 26 | +++ b/src/ocispec/generate.py | ||
| 27 | @@ -150,7 +150,12 @@ def splite_ref_name(ref): | ||
| 28 | Interface: None | ||
| 29 | History: 2019-06-17 | ||
| 30 | """ | ||
| 31 | - tmp_f, tmp_r = ref.split("#/") if '#/' in ref else (ref, "") | ||
| 32 | + if '#' in ref: | ||
| 33 | + parts = ref.split('#', 1) | ||
| 34 | + tmp_f = parts[0] | ||
| 35 | + tmp_r = parts[1].lstrip('/') | ||
| 36 | + else: | ||
| 37 | + tmp_f, tmp_r = ref, "" | ||
| 38 | return tmp_f, tmp_r | ||
| 39 | |||
| 40 | |||
| 41 | -- | ||
| 42 | 2.39.2 | ||
| 43 | |||
diff --git a/recipes-containers/crun/crun/0002-libocispec-fix-array-items-parsing.patch b/recipes-containers/crun/crun/0002-libocispec-fix-array-items-parsing.patch new file mode 100644 index 00000000..4de26379 --- /dev/null +++ b/recipes-containers/crun/crun/0002-libocispec-fix-array-items-parsing.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
| 2 | Date: Fri, 17 Oct 2025 12:00:00 -0400 | ||
| 3 | Subject: [PATCH] libocispec: fix array items parsing | ||
| 4 | |||
| 5 | The `generate.py` script fails when an array's `items` property is an | ||
| 6 | array of schemas, which is valid according to the JSON schema spec. | ||
| 7 | This commit adds a check to handle this case by using the first schema | ||
| 8 | in the array. | ||
| 9 | |||
| 10 | Upstream-Status: Inappropriate [configuration specific] | ||
| 11 | |||
| 12 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
| 13 | |||
| 14 | --- | ||
| 15 | src/ocispec/generate.py | 4 ++++ | ||
| 16 | 1 file changed, 4 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/src/ocispec/generate.py b/src/ocispec/generate.py | ||
| 19 | --- a/src/ocispec/generate.py | ||
| 20 | +++ b/src/ocispec/generate.py | ||
| 21 | @@ -423,6 +423,10 @@ | ||
| 22 | History: 2019-06-17 | ||
| 23 | """ | ||
| 24 | cur = node_info.cur | ||
| 25 | + | ||
| 26 | + if isinstance(cur["items"], list): | ||
| 27 | + # If items is a list, use the first element as the item schema. | ||
| 28 | + cur["items"] = cur["items"][0] | ||
| 29 | |||
| 30 | if 'allOf' in cur["items"]: | ||
| 31 | return gen_all_arr_typnode(node_info, src, typ, refname) | ||
diff --git a/recipes-containers/crun/crun_git.bb b/recipes-containers/crun/crun_git.bb index ccd14310..edaf15b8 100644 --- a/recipes-containers/crun/crun_git.bb +++ b/recipes-containers/crun/crun_git.bb | |||
| @@ -3,10 +3,10 @@ LICENSE = "GPL-2.0-only" | |||
| 3 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" | 3 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" |
| 4 | PRIORITY = "optional" | 4 | PRIORITY = "optional" |
| 5 | 5 | ||
| 6 | SRCREV_crun = "ca8e5c74c13dbd5b1125d0357a9081d283a50971" | 6 | SRCREV_crun = "64611d7ac938b8397e8a00a0e69987583fadec7d" |
| 7 | SRCREV_libocispec = "68397329bc51a66c56938fc4111fac751d6fd3b0" | 7 | SRCREV_libocispec = "552ccbbad3aaff8e07e8fbad210ec3b4c9c95a66" |
| 8 | SRCREV_ispec = "64294bd7a2bf2537e1a6a34d687caae70300b0c4" | 8 | SRCREV_ispec = "6519a62d628ec31b5da156de745b516d8850c8e3" |
| 9 | SRCREV_rspec = "82cca47c22f5e87880421381fe1f8e0ef541ab64" | 9 | SRCREV_rspec = "5610abdb9fac3b48b2c0ba6216d77320cbbbfb6f" |
| 10 | SRCREV_yajl = "f344d21280c3e4094919fd318bc5ce75da91fc06" | 10 | SRCREV_yajl = "f344d21280c3e4094919fd318bc5ce75da91fc06" |
| 11 | 11 | ||
| 12 | SRCREV_FORMAT = "crun_rspec" | 12 | SRCREV_FORMAT = "crun_rspec" |
| @@ -15,9 +15,11 @@ SRC_URI = "git://github.com/containers/crun.git;branch=main;name=crun;protocol=h | |||
| 15 | git://github.com/opencontainers/runtime-spec.git;branch=main;name=rspec;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/libocispec/runtime-spec;protocol=https \ | 15 | git://github.com/opencontainers/runtime-spec.git;branch=main;name=rspec;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/libocispec/runtime-spec;protocol=https \ |
| 16 | git://github.com/opencontainers/image-spec.git;branch=main;name=ispec;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/libocispec/image-spec;protocol=https \ | 16 | git://github.com/opencontainers/image-spec.git;branch=main;name=ispec;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/libocispec/image-spec;protocol=https \ |
| 17 | git://github.com/containers/yajl.git;branch=main;name=yajl;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/libocispec/yajl;protocol=https \ | 17 | git://github.com/containers/yajl.git;branch=main;name=yajl;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/libocispec/yajl;protocol=https \ |
| 18 | file://0001-libocispec-correctly-parse-JSON-schema-references.patch;patchdir=libocispec \ | ||
| 19 | file://0002-libocispec-fix-array-items-parsing.patch;patchdir=libocispec \ | ||
| 18 | " | 20 | " |
| 19 | 21 | ||
| 20 | PV = "v1.23.1+git${SRCREV_crun}" | 22 | PV = "v1.24.0+git" |
| 21 | 23 | ||
| 22 | inherit autotools-brokensep pkgconfig | 24 | inherit autotools-brokensep pkgconfig |
| 23 | 25 | ||
