From fe1ba7706b133e012e39afb8a84a745fd55d5092 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Thu, 8 Jun 2023 16:51:38 -0700 Subject: [PATCH] Add support for building Containerd OCI Artifacts Address #108 This adds an experimental tool for creating a WASM OCI Artifacts based on the proposal in https://docs.google.com/document/d/11shgC3l6gplBjWF1VJCWvN_9do51otscAm0hBDGSSAc. Containerd and runwasi don't currently support the OCI artifact format that is generated. Signed-off-by: James Sturtevant --- Cargo.lock | 505 ++++++++++++++++-------------- Makefile | 6 +- crates/oci-tar-builder/Cargo.toml | 10 +- crates/oci-tar-builder/README.md | 41 ++- crates/oci-tar-builder/src/bin.rs | 90 ++++++ crates/oci-tar-builder/src/lib.rs | 32 +- 6 files changed, 436 insertions(+), 248 deletions(-) create mode 100644 crates/oci-tar-builder/src/bin.rs diff --git a/Cargo.lock b/Cargo.lock index 42beb16b8..ca34243e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -58,6 +58,55 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" version = "1.0.71" @@ -78,7 +127,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -89,9 +138,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "bincode" @@ -130,9 +179,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813" +checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84" [[package]] name = "block-buffer" @@ -145,9 +194,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.1" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byteorder" @@ -163,9 +212,9 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cap-fs-ext" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1742f5106155d46a41eac5f730ee189bf92fde6ae109fbf2cdb67176726ca5d" +checksum = "58bc48200a1a0fa6fba138b1802ad7def18ec1cdd92f7b2a04e21f1bd887f7b9" dependencies = [ "cap-primitives", "cap-std", @@ -175,9 +224,9 @@ dependencies = [ [[package]] name = "cap-primitives" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42068f579028e856717d61423645c85d2d216dde8eff62c9b30140e725c79177" +checksum = "a4b6df5b295dca8d56f35560be8c391d59f0420f72e546997154e24e765e6451" dependencies = [ "ambient-authority", "fs-set-times", @@ -192,9 +241,9 @@ dependencies = [ [[package]] name = "cap-rand" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3be2ededc13f42a5921c08e565b854cb5ff9b88753e2c6ec12c58a24e7e8d4e" +checksum = "4d25555efacb0b5244cf1d35833d55d21abc916fff0eaad254b8e2453ea9b8ab" dependencies = [ "ambient-authority", "rand", @@ -202,9 +251,9 @@ dependencies = [ [[package]] name = "cap-std" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559ad6fab5fedcc9bd5877160e1433fcd481f8af615068d6ca49472b1201cc6c" +checksum = "3373a62accd150b4fcba056d4c5f3b552127f0ec86d3c8c102d60b978174a012" dependencies = [ "cap-primitives", "io-extras", @@ -214,9 +263,9 @@ dependencies = [ [[package]] name = "cap-time-ext" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a74e04cd32787bfa3a911af745b0fd5d99d4c3fc16c64449e1622c06fa27c8e" +checksum = "e95002993b7baee6b66c8950470e59e5226a23b3af39fc59c47fe416dd39821a" dependencies = [ "cap-primitives", "once_cell", @@ -291,6 +340,48 @@ dependencies = [ "libloading", ] +[[package]] +name = "clap" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "401a4694d2bf92537b6867d94de48c4842089645fdcdf6c71865b175d836e9c2" +dependencies = [ + "clap_builder", + "clap_derive", + "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980" +dependencies = [ + "anstream", + "anstyle", + "bitflags 1.3.2", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.18", +] + +[[package]] +name = "clap_lex" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" + [[package]] name = "clone3" version = "0.2.3" @@ -311,14 +402,10 @@ dependencies = [ ] [[package]] -name = "codespan-reporting" -version = "0.11.1" +name = "colorchoice" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "command-fds" @@ -350,7 +437,7 @@ dependencies = [ "serde_json", "signal-hook", "thiserror", - "time 0.3.21", + "time 0.3.22", "uuid 0.8.2", ] @@ -465,18 +552,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4468480f4c4656daeb370442a6c9949e80c3b5b2d67a1bf2b392eaa3701c165" +checksum = "9c064a534a914eb6709d198525321a386dad50627aecfaf64053f369993a3e5a" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc36143e6187d8cde72588998163521a7dbdb4590e20f610a5d434bdceb3dffb" +checksum = "619ed4d24acef0bd58b16a1be39077c0b36c65782e6c933892439af5e799110e" dependencies = [ "bumpalo", "cranelift-bforest", @@ -495,42 +582,42 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c98d56d92c5e986f4cfb554ba11b7e42a98d87e395f42a487c307ad6969f8f05" +checksum = "c777ce22678ae1869f990b2f31e0cd7ca109049213bfc0baf3e2205a18b21ebb" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd945e9461fdf293633627679d43ce6bfc8ab8f0c7b774af244651adb2b6c36" +checksum = "eb65884d17a1fa55990dd851c43c140afb4c06c3312cf42cfa1222c3b23f9561" [[package]] name = "cranelift-control" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b314acf470dc916c1ee255ad6e7d7377780d5c2a6f6502abe91aa8ef6da7b81" +checksum = "9a0cea8abc90934d0a7ee189a29fd35fecd5c40f59ae7e6aab1805e8ab1a535e" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd196a2c0a5c1551961b7d38c651dea82b30a97e1abc60163e2309f021c78fab" +checksum = "c2e50bebc05f2401a1320169314b62f91ad811ef20163cac00151d78e0684d4c" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2160d57eecc988df5d3dc75f8d9b0c4bc0546c24f06f2fbd6e06e9c89f3011a" +checksum = "7b82ccfe704d53f669791399d417928410785132d809ec46f5e2ce069e9d17c8" dependencies = [ "cranelift-codegen", "log", @@ -540,15 +627,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64943f43f5b476e7b07b2b34b772695d3cee05160812294ec358e3d73b4866b" +checksum = "a2515d8e7836f9198b160b2c80aaa1f586d7749d57d6065af86223fb65b7e2c3" [[package]] name = "cranelift-native" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e406f5c7483949dcdb268e07cad00076024d64bcfb8e934570b5f8128f5e398" +checksum = "bcb47ffdcdac7e9fed6e4a618939773a4dc4a412fa7da9e701ae667431a10af3" dependencies = [ "cranelift-codegen", "libc", @@ -557,9 +644,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.96.2" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c24a139d2fc43fb4a3a8a7c7851009c9282da0cfe893a38044d26f9a45e1da1e" +checksum = "852390f92c3eaa457e42be44d174ff5abbbcd10062d5963bda8ffb2505e73a71" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -643,50 +730,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.15", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - [[package]] name = "darling" version = "0.14.4" @@ -836,9 +879,9 @@ checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", @@ -1003,9 +1046,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1078,7 +1121,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -1126,7 +1169,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" dependencies = [ - "bitflags 2.2.1", + "bitflags 2.3.1", "debugid", "fxhash", "serde", @@ -1145,9 +1188,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if 1.0.0", "libc", @@ -1251,9 +1294,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1265,12 +1308,11 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] @@ -1281,9 +1323,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1321,9 +1363,9 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", @@ -1394,9 +1436,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" dependencies = [ "wasm-bindgen", ] @@ -1421,9 +1463,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.145" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc86cde3ff845662b8f4ef6cb50ea0e20c524eb3d29ae048287e06a1b3fa6a81" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libcgroups" @@ -1446,7 +1488,7 @@ version = "0.0.5" source = "git+https://github.com/containers/youki?rev=edd63c84f903aa09510ef758ea6f617e0cb8b7e1#edd63c84f903aa09510ef758ea6f617e0cb8b7e1" dependencies = [ "anyhow", - "bitflags 2.2.1", + "bitflags 2.3.1", "caps", "chrono", "clone3", @@ -1506,15 +1548,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a7cbbd4ad467251987c6e5b47d53b11a5a05add08f2447a9e2d70aef1e0d138" -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linux-raw-sys" version = "0.1.4" @@ -1523,15 +1556,15 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "linux-raw-sys" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -1617,14 +1650,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1715,9 +1748,9 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "crc32fast", "hashbrown 0.13.2", @@ -1756,6 +1789,7 @@ name = "oci-tar-builder" version = "0.1.0" dependencies = [ "anyhow", + "clap", "env_logger", "log", "oci-spec 0.6.0", @@ -1767,9 +1801,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "output_vt100" @@ -1792,15 +1826,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.0", ] [[package]] @@ -1832,9 +1866,9 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "petgraph" @@ -1918,9 +1952,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -1946,7 +1980,7 @@ dependencies = [ "flate2", "hex", "lazy_static", - "rustix 0.36.13", + "rustix 0.36.14", ] [[package]] @@ -2106,9 +2140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -2209,9 +2243,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", @@ -2220,9 +2254,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "rust-criu" @@ -2250,9 +2284,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.36.13" +version = "0.36.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a38f9520be93aba504e8ca974197f46158de5dcaa9fa04b57c57cd6a679d658" +checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62" dependencies = [ "bitflags 1.3.2", "errno", @@ -2273,7 +2307,7 @@ dependencies = [ "io-lifetimes", "itoa", "libc", - "linux-raw-sys 0.3.7", + "linux-raw-sys 0.3.8", "once_cell", "windows-sys 0.48.0", ] @@ -2290,30 +2324,24 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -2335,7 +2363,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -2360,7 +2388,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -2470,9 +2498,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -2481,9 +2509,9 @@ dependencies = [ [[package]] name = "syscalls" -version = "0.6.10" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85d5ea5026b593a3da051edb60edd50a6c5b5937c8444c22a125d3fb25517e1c" +checksum = "41a292bad4a4fdbab06bb5399d2d578e4afed89e6701b47a75cf952d510c1473" dependencies = [ "cc", "serde", @@ -2525,15 +2553,16 @@ checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if 1.0.0", "fastrand", "redox_syscall 0.3.5", "rustix 0.37.19", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2562,7 +2591,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -2578,9 +2607,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "serde", "time-core", @@ -2647,14 +2676,14 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", ] @@ -2741,9 +2770,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -2768,15 +2797,21 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" version = "0.8.2" @@ -2812,9 +2847,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-cap-std-sync" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c70c44647fbb5b4d07bae039fdff9947f1ca8edb22eb6153e5fdf2e963cbc04e" +checksum = "5bab403bc39baf0734b7acb8fca398e120e055db85be6e64a7e2d4d16caf4b97" dependencies = [ "anyhow", "async-trait", @@ -2836,9 +2871,9 @@ dependencies = [ [[package]] name = "wasi-common" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "409c8e2f621ec61ca449b9322034ecaa27474f191996f59b6ce1fba5f01ae1cc" +checksum = "63ed59cf7fb6a0c1fa2a8db4e57a3f5a675a3cf9db68fcc0e82f06528d331c6f" dependencies = [ "anyhow", "bitflags 1.3.2", @@ -2869,9 +2904,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -2879,24 +2914,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2904,28 +2939,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-encoder" -version = "0.26.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05d0b6fcd0aeb98adf16e7975331b3c17222aa815148f5b976370ce589d80ef" +checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" dependencies = [ "leb128", ] @@ -2998,9 +3033,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06b7247e925719e0abcf4ac006d8923ea0da7b098b10ee26315a8254228e0717" +checksum = "aa0f72886c3264eb639f50188d1eb98b975564130292fea8deb4facf91ca7258" dependencies = [ "anyhow", "bincode", @@ -3030,18 +3065,18 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d345eb2c21baeab0d82ca432e2763e34fcf0f4987ed2fb54e264db7bd9e7d4" +checksum = "a18391ed41ca957eecdbe64c51879b75419cbc52e2d8663fe82945b28b4f19da" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "wasmtime-cache" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aff2d708ac848cbb9019272224f87905c1bb59a57707fe65c264d2cc22fa1ab" +checksum = "dfd5ef82889a6a35b3790025b3fd33e6ee4902a5408c09f716c771a38c47cd10" dependencies = [ "anyhow", "base64", @@ -3059,9 +3094,9 @@ dependencies = [ [[package]] name = "wasmtime-cranelift" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711fed6ab01790b565362f0711bf2b0cb5eb00b7a2b7b4ebc5f47338cc77de03" +checksum = "a2495036d05eb1e79ecf22e092eeacd279dcf24b4fcab77fb4cf8ef9bd42c3ea" dependencies = [ "anyhow", "cranelift-codegen", @@ -3082,9 +3117,9 @@ dependencies = [ [[package]] name = "wasmtime-cranelift-shared" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c93e7280aa8da82d4f2a200696a046dfb4d8ad7209eaabffc7b5a6111bd722" +checksum = "ef677f7b0d3f3b73275675486d791f1e85e7c24afe8dd367c6b9950028906330" dependencies = [ "anyhow", "cranelift-codegen", @@ -3098,9 +3133,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a0991f22a8fbf0ac3acf3fe52aba274d1d09cf812ccdafbd2da1ee7a6f3a9d9" +checksum = "2d03356374ffafa881c5f972529d2bb11ce48fe2736285e2b0ad72c6d554257b" dependencies = [ "anyhow", "cranelift-entity", @@ -3117,9 +3152,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c669ed21f3848542b93294bdbb6ead455aa1ff40529911d91ba17c7aca463ec" +checksum = "e5374f0d2ee0069391dd9348f148802846b2b3e0af650385f9c56b3012d3c5d1" dependencies = [ "addr2line", "anyhow", @@ -3142,9 +3177,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a31132d113d3e4b479e1e3ae70eb2d4f4dd756a39c7a31fc0ad0f812888604" +checksum = "102653b177225bfdd2da41cc385965d4bf6bc10cf14ec7b306bc9b015fb01c22" dependencies = [ "object", "once_cell", @@ -3153,9 +3188,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc5fe8d31a446e3ee2d18c147dd25cc70b552833940f64bc5812ac0177760fe4" +checksum = "374ff63b3eb41db57c56682a9ef7737d2c9efa801f5dbf9da93941c9dd436a06" dependencies = [ "cfg-if 1.0.0", "libc", @@ -3164,9 +3199,9 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9954fa7fe041ffc14a2356bf7e8c9a0861db2b6b1091da5249f3c543ef28c2b8" +checksum = "9b1b832f19099066ebd26e683121d331f12cf98f158eac0f889972854413b46f" dependencies = [ "anyhow", "cc", @@ -3188,9 +3223,9 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2603d8783ef06a7c5bec5ca9b311796275adf199cfec9138e38c7b0154c003d3" +checksum = "9c574221440e05bbb04efa09786d049401be2eb10081ecf43eb72fbd637bd12f" dependencies = [ "cranelift-entity", "serde", @@ -3200,9 +3235,9 @@ dependencies = [ [[package]] name = "wasmtime-wasi" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44e7bbd17a43777db82d7fa83ce33b4e7b40d8223a1a5fa73e000d78941bc621" +checksum = "a24fe4eb17acd001897c0d9e393321353907b69946af3b0e2785a53ca5b29e3c" dependencies = [ "anyhow", "libc", @@ -3223,9 +3258,9 @@ dependencies = [ [[package]] name = "wast" -version = "57.0.0" +version = "60.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb0f5ed17ac4421193c7477da05892c2edafd67f9639e3c11a82086416662dc" +checksum = "bd06cc744b536e30387e72a48fdd492105b9c938bb4f415c39c616a7a0a697ad" dependencies = [ "leb128", "memchr", @@ -3235,11 +3270,11 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.63" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9ab0d87337c3be2bb6fc5cd331c4ba9fd6bcb4ee85048a0dd59ed9ecf92e53" +checksum = "5abe520f0ab205366e9ac7d3e6b2fc71de44e32a2b58f2ec871b6b575bdcea3b" dependencies = [ - "wast 57.0.0", + "wast 60.0.0", ] [[package]] @@ -3255,9 +3290,9 @@ dependencies = [ [[package]] name = "wiggle" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c765589d81810520d2d97569e20fa16b8e2c816bc006448b2e9a2a700f35a1b6" +checksum = "a7f53ea2e83665447bf1b96674176173bd95d2d15f2edfdbb9f570e8db0e96e3" dependencies = [ "anyhow", "async-trait", @@ -3270,9 +3305,9 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33585085eea1c815fad03276922a4512be3700788cc00a144c048f3a7d03561" +checksum = "3d3be80a1812089cac0a45152068cec890afd9d85a9c3fa744a199725db55af0" dependencies = [ "anyhow", "heck 0.4.1", @@ -3285,9 +3320,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "9.0.2" +version = "9.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520e005a17dbfb5eee561e439a29fdb20a7f99fbf350b39b7a1215369981015f" +checksum = "d449a448fd1cb0fdfaea3776992ae2088a5cebcd48916006f99d6e57e6dea711" dependencies = [ "proc-macro2", "quote", diff --git a/Makefile b/Makefile index 79d96defd..47de854ba 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,11 @@ install: .PHONY: test-image test-image: target/wasm32-wasi/$(TARGET)/img.tar - + +.PHONY: test-image +test-image/clean: + rm -rf target/wasm32-wasi/$(TARGET)/ + .PHONY: target/wasm32-wasi/$(TARGET)/wasi-demo-app.wasm target/wasm32-wasi/$(TARGET)/wasi-demo-app.wasm: rustup target add wasm32-wasi diff --git a/crates/oci-tar-builder/Cargo.toml b/crates/oci-tar-builder/Cargo.toml index 8b7a7a1d3..e75dc154b 100644 --- a/crates/oci-tar-builder/Cargo.toml +++ b/crates/oci-tar-builder/Cargo.toml @@ -11,4 +11,12 @@ env_logger = { workspace = true } oci-spec = { workspace = true } anyhow = { workspace = true } serde = { workspace = true } -serde_json = { workspace = true } \ No newline at end of file +serde_json = { workspace = true } +clap = { version = "4.3.2", features = ["derive"] } + +[lib] +path = "src/lib.rs" + +[[bin]] +name = "oci-tar-builder" +path = "src/bin.rs" diff --git a/crates/oci-tar-builder/README.md b/crates/oci-tar-builder/README.md index f40b835cf..b8d3882c6 100644 --- a/crates/oci-tar-builder/README.md +++ b/crates/oci-tar-builder/README.md @@ -1,13 +1,13 @@ ## OCI Tar Builder This is a library that can be used to build OCI tar archives. It is used by the `wasi-demo-app` crate to build the OCI tar archive that is used to run the demo app. -The currently implementation is to support encapsulating the `wasi-demo-app` wasm module into an OCI tar. It may be possible to use this for other purposes, but that not currently a goal of the project. +The currently implementation is to support encapsulating the `wasi-demo-app` wasm module as an OCI tar. ### Contributing We welcome contributions to this to make it more robust, useful, and generally better. -### Usage +### Library Usage The library is currently not published to crates.io, so you will need to add the following to your `Cargo.toml`: @@ -16,6 +16,43 @@ The library is currently not published to crates.io, so you will need to add the oci-tar-builder = { git = "https://github.com/containerd/runwasi.git" } ``` +See [wasi-demo-app build script](../wasi-demo-app/build.rs) for an example. + +### Executable usage + +There is an experimental executable that uses the library and can package a wasm module as an OCI artifact. This isn't currently usable with containerd/runwasi today. See the [OCI artifacts in containerd](https://docs.google.com/document/d/11shgC3l6gplBjWF1VJCWvN_9do51otscAm0hBDGSSAc) for more information. + +To generate the package and import to a registry using a tool such as [regctl](https://github.com/regclient/regclient/blob/main/docs/regctl.md#image-commands): + +``` +cargo run --bin oci-tar-builder -- --name wasi-demo-app --module ./target/wasm32-wasi/debug/wasi-demo-app.wasm -o ./bin +regctl image import localhost:5000/wasi-demo-oci:module ./bin/wasi-demo-app.tar +``` + +View the manifest created, notice that the media types are `application/vnd.w3c.wasm.module.v1+wasm` which are subject to change. + +``` +regctl manifest get localhost:5000/wasi-demo-oci:module +Name: localhost:5000/wasi-demo-oci:module +MediaType: application/vnd.oci.image.manifest.v1+json +Digest: sha256:869fb6029e26713160d7626dce140f1275f591a694203509cb1e047e746daac8 +Annotations: + io.containerd.image.name: localhost:5000/wasi-demo-app + org.opencontainers.image.ref.name: 5000/wasi-demo-app +Total Size: 2.565MB + +Config: + Digest: sha256:707ef07a1143cfdf20af52979d835d5cfc86acc9634edb79d28b89a1edbdc452 + MediaType: application/vnd.oci.image.config.v1+json + Size: 118B + +Layers: + + Digest: sha256:b434ff20f62697465e24a52e3573ee9c212e3a171e18e0821bbb464b14fdbbf9 + MediaType: application/vnd.w3c.wasm.module.v1+wasm + Size: 2.565MB +``` + ### Spec See the [OCI Image Spec](https://github.com/opencontainers/image-spec/blob/bc9c4bd/image-layout.md) for more information on the OCI tar format. diff --git a/crates/oci-tar-builder/src/bin.rs b/crates/oci-tar-builder/src/bin.rs new file mode 100644 index 000000000..160d3b682 --- /dev/null +++ b/crates/oci-tar-builder/src/bin.rs @@ -0,0 +1,90 @@ +use std::{fs, env}; + +use { + anyhow::Context, oci_spec::image as spec, oci_tar_builder::Builder, + std::fs::File, std::path::PathBuf, + clap::Parser, +}; + +pub fn main (){ + let args = Args::parse(); + + let out_dir; + if let Some(out_path) = args.out_path.as_deref() { + out_dir = PathBuf::from(out_path); + }else { + out_dir = env::current_dir().unwrap(); + } + + let mut builder = Builder::default(); + + if let Some(module_path) = args.module.as_deref() { + let module_path = PathBuf::from(module_path); + builder.add_layer_with_media_type(&module_path, "application/vnd.w3c.wasm.module.v1+wasm".to_string()); + } + + if let Some(components_path) = args.components.as_deref() { + let paths = fs::read_dir(components_path).unwrap(); + + for path in paths { + let path = path.unwrap().path(); + let ext = path.extension().unwrap().to_str().unwrap(); + match ext { + "wasm" => {builder.add_layer_with_media_type(&path, "application/vnd.wasm.component.v1+wasm".to_string());} , + "yml" => {builder.add_layer_with_media_type(&path, "application/vnd.wasm.component.config.v1+json".to_string());}, + _ => println!("Skipping Unknown file type: {:?} with extension {:?}", path, path.extension().unwrap()) + } + } + } + + let config = spec::ConfigBuilder::default() + .entrypoint(vec!["".to_owned()]) + .build() + .unwrap(); + + let img = spec::ImageConfigurationBuilder::default() + .config(config) + .os("wasi") + .architecture("wasm") + .rootfs( + spec::RootFsBuilder::default() + .diff_ids(vec![]) + .build() + .unwrap(), + ) + .build() + .context("failed to build image configuration") + .unwrap(); + + let full_image_name = args.repo.unwrap_or("localhost:5000".to_string()) + "/" + &args.name; + builder.add_config( + img, + full_image_name, + ); + + let p = out_dir.join(args.name + ".tar"); + let f = File::create(&p).unwrap(); + builder.build(f).unwrap(); +} + + + +/// Simple program to greet a person +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +struct Args { + #[arg(short, long)] + out_path: Option, + + #[arg(short, long)] + name: String, + + #[arg(short, long)] + repo: Option, + + #[arg(short, long)] + module: Option, + + #[arg(short, long)] + components: Option, +} diff --git a/crates/oci-tar-builder/src/lib.rs b/crates/oci-tar-builder/src/lib.rs index beb2a00dc..34a0cffdf 100644 --- a/crates/oci-tar-builder/src/lib.rs +++ b/crates/oci-tar-builder/src/lib.rs @@ -1,5 +1,5 @@ use anyhow::{Context, Error, Result}; -use log::debug; +use log::{debug, warn}; use oci_spec::image::{ DescriptorBuilder, ImageConfiguration, ImageIndexBuilder, ImageManifestBuilder, MediaType, PlatformBuilder, SCHEMA_VERSION, @@ -14,7 +14,7 @@ use std::path::PathBuf; #[derive(Debug, Default)] pub struct Builder { configs: Vec<(ImageConfiguration, String)>, - layers: Vec, + layers: Vec<(PathBuf, String)>, } #[derive(Serialize, Debug)] @@ -48,7 +48,12 @@ impl Builder { } pub fn add_layer(&mut self, layer: &PathBuf) -> &mut Self { - self.layers.push(layer.to_owned()); + self.layers.push((layer.to_owned(), "".to_string())); + self + } + + pub fn add_layer_with_media_type(&mut self, layer: &PathBuf, media_type: String) -> &mut Self { + self.layers.push((layer.to_owned(), media_type)); self } @@ -68,13 +73,17 @@ impl Builder { }; for layer in self.layers.iter() { - let dgst = try_digest(layer.as_path()).context("failed to digest layer")?; - let meta = metadata(layer).context("could not get layer metadata")?; + let dgst = try_digest(layer.0.as_path()).context("failed to digest layer")?; + let meta = metadata(layer.0.clone()).context("could not get layer metadata")?; let oci_digest = "sha256:".to_owned() + &dgst; + let mut media_type = MediaType::ImageLayer; + if !layer.1.is_empty() { + media_type = MediaType::Other(layer.1.clone()); + } let desc = DescriptorBuilder::default() // TODO: check file headers to determine mediatype? Could also just require it to be passed in on add_layer - .media_type(MediaType::ImageLayer) + .media_type(media_type) .digest(&oci_digest) .size(meta.len() as i64) .build() @@ -87,7 +96,7 @@ impl Builder { let p = "blobs/sha256/".to_owned() + &dgst; th.set_path(&p).context("could not set path for layer")?; th.set_cksum(); - let f = std::fs::File::open(layer).context("could not open layer")?; + let f = std::fs::File::open(layer.0.clone()).context("could not open layer")?; tb.append(&th, f)?; mfst.layers.push(p.to_string()); @@ -114,11 +123,16 @@ impl Builder { .build() .context("failed to build descriptor")?; + // add all layer_digests including any OCI artifacts types that are may not be in the rootfs let mut layers = Vec::new(); + for (_k, v) in layer_digests.iter() { + layers.push(v.clone()); + } + for id in config.0.rootfs().diff_ids().iter() { debug!("id: {}", id); - if let Some(d) = layer_digests.get(id) { - layers.push(d.clone()) + if None == layer_digests.get(id) { + warn!("rootfs diff with id {} not found in layers", id); } }