OCaml library and CLI for OCI and Docker image manipulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

irmin-atproto: proper lexicon for tree nodes, no hacks in tree.ml

+19 -20
+3 -3
src/spec/arch.ml
··· 2 2 3 3 type t = 4 4 | X386 5 - | Xamd64 5 + | Amd64 6 6 | Arm 7 7 | Arm64 8 8 | Wasm ··· 19 19 20 20 let to_string = function 21 21 | X386 -> "386" 22 - | Xamd64 -> "amd64" 22 + | Amd64 -> "amd64" 23 23 | Arm -> "arm" 24 24 | Arm64 -> "arm64" 25 25 | Wasm -> "wasm" ··· 36 36 37 37 let of_string = function 38 38 | "386" -> Ok X386 39 - | "amd64" -> Ok Xamd64 39 + | "amd64" -> Ok Amd64 40 40 | "arm" -> Ok Arm 41 41 | "arm64" -> Ok Arm64 42 42 | "wasm" -> Ok Wasm
+1 -1
src/spec/arch.mli
··· 3 3 for GOARCH. *) 4 4 type t = 5 5 | X386 6 - | Xamd64 6 + | Amd64 7 7 | Arm 8 8 | Arm64 9 9 | Wasm
+15 -16
test/interop/registry/test.ml
··· 14 14 close_in ic; 15 15 s 16 16 17 - (* Simple JSON string field extraction for meta.json *) 18 - let meta_field key = 17 + let meta_jsont = 18 + Jsont.Object.map (fun index_digest manifest_digest config_digest -> 19 + (index_digest, manifest_digest, config_digest)) 20 + |> Jsont.Object.mem "index_digest" Jsont.string ~enc:(fun (x, _, _) -> x) 21 + |> Jsont.Object.mem "manifest_digest" Jsont.string ~enc:(fun (_, x, _) -> x) 22 + |> Jsont.Object.mem "config_digest" Jsont.string ~enc:(fun (_, _, x) -> x) 23 + |> Jsont.Object.skip_unknown |> Jsont.Object.finish 24 + 25 + let meta () = 19 26 let raw = read_file "meta.json" in 20 - let pat = Fmt.str {|"%s": "|} key in 21 - match Astring.String.find_sub ~sub:pat raw with 22 - | None -> Fmt.failwith "meta.json: missing field %s" key 23 - | Some i -> 24 - let start = i + String.length pat in 25 - let stop = 26 - match String.index_from_opt raw start '"' with 27 - | Some j -> j 28 - | None -> Fmt.failwith "meta.json: unterminated string for %s" key 29 - in 30 - String.sub raw start (stop - start) 27 + match Jsont_bytesrw.decode_string meta_jsont raw with 28 + | Ok m -> m 29 + | Error e -> Fmt.failwith "meta.json: %s" e 31 30 32 31 (* {1 Index parsing} *) 33 32 ··· 68 67 | Ok _ -> fail "expected OCI index" 69 68 70 69 let test_index_digest () = 71 - let expected = meta_field "index_digest" in 70 + let expected, _, _ = meta () in 72 71 match Digest.of_string expected with 73 72 | Ok d -> 74 73 check string "algorithm" "sha256" ··· 102 101 | Ok _ -> fail "expected single-platform manifest" 103 102 104 103 let test_manifest_config_digest () = 105 - let expected = meta_field "config_digest" in 104 + let _, _, expected = meta () in 106 105 let raw = read_file "manifest.json" in 107 106 match Manifest.of_string raw with 108 107 | Error (`Msg e) -> fail e ··· 160 159 let test_index_v () = 161 160 let desc = 162 161 Descriptor.v 163 - ~platform:(Platform.v Arch.Xamd64 OS.Linux) 162 + ~platform:(Platform.v Arch.Amd64 OS.Linux) 164 163 ~annotations: 165 164 [ 166 165 (Annotation.Other "dev.spaceos.partition.name", "p0");