diff options
author | Florian Klink <flokli@flokli.de> | 2024-08-21T08·06+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-08-21T09·40+0000 |
commit | e03ea11badbf40971d6bf87eede33fe3b046c98b (patch) | |
tree | d520dedadeb8193b2da323adb2623a269217951c /tvix/tools | |
parent | 2357079891819c679821ea58a7715de7be431aaa (diff) |
feat(nix-compat/nix_http): init parse_nar[info]_str r/8547
This moves the URL component parsing code we had in nar-bridge to nix-compat. We change the function signature to return an Option, not a Result<_, StatusCode>. This allows returning more appropriate error codes, as we can ok_or(…) at the callsite, which we now do: on an upload to an invalid path, we now return "unauthorized", while on a GET/HEAD, we return "not found". This also adds support to parse compression suffixes. While not supported in nar-bridge, other users of nix-compat might very well want to parse these paths. Also fix the error message when parsing NAR urls, it mentioned 32, not 52, which is a copypasta error from the narinfo URL parsing code. Change-Id: Id1be9a8044814b54ce68b125c52dfe933c9c4f74 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12260 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/tools')
-rw-r--r-- | tvix/tools/crunch-v2/Cargo.lock | 13 | ||||
-rw-r--r-- | tvix/tools/crunch-v2/Cargo.nix | 41 | ||||
-rw-r--r-- | tvix/tools/narinfo2parquet/Cargo.lock | 32 | ||||
-rw-r--r-- | tvix/tools/narinfo2parquet/Cargo.nix | 94 | ||||
-rw-r--r-- | tvix/tools/weave/Cargo.lock | 32 | ||||
-rw-r--r-- | tvix/tools/weave/Cargo.nix | 94 |
6 files changed, 305 insertions, 1 deletions
diff --git a/tvix/tools/crunch-v2/Cargo.lock b/tvix/tools/crunch-v2/Cargo.lock index 1b1f5f38c1f5..500e8519e7a5 100644 --- a/tvix/tools/crunch-v2/Cargo.lock +++ b/tvix/tools/crunch-v2/Cargo.lock @@ -1434,6 +1434,7 @@ dependencies = [ "sha2 0.10.8", "thiserror", "tokio", + "tracing", ] [[package]] @@ -2776,10 +2777,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] [[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] name = "tracing-core" version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/tvix/tools/crunch-v2/Cargo.nix b/tvix/tools/crunch-v2/Cargo.nix index f3a3c6fa9a34..bc91e52f3fa0 100644 --- a/tvix/tools/crunch-v2/Cargo.nix +++ b/tvix/tools/crunch-v2/Cargo.nix @@ -4155,6 +4155,10 @@ rec { optional = true; features = [ "io-util" "macros" ]; } + { + name = "tracing"; + packageId = "tracing"; + } ]; devDependencies = [ { @@ -9063,6 +9067,11 @@ rec { packageId = "pin-project-lite"; } { + name = "tracing-attributes"; + packageId = "tracing-attributes"; + optional = true; + } + { name = "tracing-core"; packageId = "tracing-core"; usesDefaultFeatures = false; @@ -9077,7 +9086,37 @@ rec { "tracing-attributes" = [ "dep:tracing-attributes" ]; "valuable" = [ "tracing-core/valuable" ]; }; - resolvedDefaultFeatures = [ "std" ]; + resolvedDefaultFeatures = [ "attributes" "default" "std" "tracing-attributes" ]; + }; + "tracing-attributes" = rec { + crateName = "tracing-attributes"; + version = "0.1.27"; + edition = "2018"; + sha256 = "1rvb5dn9z6d0xdj14r403z0af0bbaqhg02hq4jc97g5wds6lqw1l"; + procMacro = true; + libName = "tracing_attributes"; + authors = [ + "Tokio Contributors <team@tokio.rs>" + "Eliza Weisman <eliza@buoyant.io>" + "David Barsky <dbarsky@amazon.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn 2.0.39"; + usesDefaultFeatures = false; + features = [ "full" "parsing" "printing" "visit-mut" "clone-impls" "extra-traits" "proc-macro" ]; + } + ]; + features = { }; }; "tracing-core" = rec { crateName = "tracing-core"; diff --git a/tvix/tools/narinfo2parquet/Cargo.lock b/tvix/tools/narinfo2parquet/Cargo.lock index 8583c5e6d12d..0321ed8c460d 100644 --- a/tvix/tools/narinfo2parquet/Cargo.lock +++ b/tvix/tools/narinfo2parquet/Cargo.lock @@ -970,6 +970,7 @@ dependencies = [ "sha2", "thiserror", "tokio", + "tracing", ] [[package]] @@ -1873,6 +1874,37 @@ dependencies = [ ] [[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/tvix/tools/narinfo2parquet/Cargo.nix b/tvix/tools/narinfo2parquet/Cargo.nix index 182a1b733773..bea46c57e57c 100644 --- a/tvix/tools/narinfo2parquet/Cargo.nix +++ b/tvix/tools/narinfo2parquet/Cargo.nix @@ -2852,6 +2852,10 @@ rec { optional = true; features = [ "io-util" "macros" ]; } + { + name = "tracing"; + packageId = "tracing"; + } ]; devDependencies = [ { @@ -6370,6 +6374,96 @@ rec { }; resolvedDefaultFeatures = [ "default" "io" "io-util" ]; }; + "tracing" = rec { + crateName = "tracing"; + version = "0.1.40"; + edition = "2018"; + sha256 = "1vv48dac9zgj9650pg2b4d0j3w6f3x9gbggf43scq5hrlysklln3"; + authors = [ + "Eliza Weisman <eliza@buoyant.io>" + "Tokio Contributors <team@tokio.rs>" + ]; + dependencies = [ + { + name = "pin-project-lite"; + packageId = "pin-project-lite"; + } + { + name = "tracing-attributes"; + packageId = "tracing-attributes"; + optional = true; + } + { + name = "tracing-core"; + packageId = "tracing-core"; + usesDefaultFeatures = false; + } + ]; + features = { + "attributes" = [ "tracing-attributes" ]; + "default" = [ "std" "attributes" ]; + "log" = [ "dep:log" ]; + "log-always" = [ "log" ]; + "std" = [ "tracing-core/std" ]; + "tracing-attributes" = [ "dep:tracing-attributes" ]; + "valuable" = [ "tracing-core/valuable" ]; + }; + resolvedDefaultFeatures = [ "attributes" "default" "std" "tracing-attributes" ]; + }; + "tracing-attributes" = rec { + crateName = "tracing-attributes"; + version = "0.1.27"; + edition = "2018"; + sha256 = "1rvb5dn9z6d0xdj14r403z0af0bbaqhg02hq4jc97g5wds6lqw1l"; + procMacro = true; + libName = "tracing_attributes"; + authors = [ + "Tokio Contributors <team@tokio.rs>" + "Eliza Weisman <eliza@buoyant.io>" + "David Barsky <dbarsky@amazon.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn 2.0.39"; + usesDefaultFeatures = false; + features = [ "full" "parsing" "printing" "visit-mut" "clone-impls" "extra-traits" "proc-macro" ]; + } + ]; + features = { }; + }; + "tracing-core" = rec { + crateName = "tracing-core"; + version = "0.1.32"; + edition = "2018"; + sha256 = "0m5aglin3cdwxpvbg6kz0r9r0k31j48n0kcfwsp6l49z26k3svf0"; + libName = "tracing_core"; + authors = [ + "Tokio Contributors <team@tokio.rs>" + ]; + dependencies = [ + { + name = "once_cell"; + packageId = "once_cell"; + optional = true; + } + ]; + features = { + "default" = [ "std" "valuable/std" ]; + "once_cell" = [ "dep:once_cell" ]; + "std" = [ "once_cell" ]; + "valuable" = [ "dep:valuable" ]; + }; + resolvedDefaultFeatures = [ "once_cell" "std" ]; + }; "typenum" = rec { crateName = "typenum"; version = "1.17.0"; diff --git a/tvix/tools/weave/Cargo.lock b/tvix/tools/weave/Cargo.lock index eb74f117c690..1a64a266dedc 100644 --- a/tvix/tools/weave/Cargo.lock +++ b/tvix/tools/weave/Cargo.lock @@ -941,6 +941,7 @@ dependencies = [ "sha2", "thiserror", "tokio", + "tracing", ] [[package]] @@ -1877,6 +1878,37 @@ dependencies = [ ] [[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/tvix/tools/weave/Cargo.nix b/tvix/tools/weave/Cargo.nix index 233aff839185..0cff178a5537 100644 --- a/tvix/tools/weave/Cargo.nix +++ b/tvix/tools/weave/Cargo.nix @@ -2758,6 +2758,10 @@ rec { optional = true; features = [ "io-util" "macros" ]; } + { + name = "tracing"; + packageId = "tracing"; + } ]; devDependencies = [ { @@ -6321,6 +6325,96 @@ rec { }; resolvedDefaultFeatures = [ "default" "io" "io-util" ]; }; + "tracing" = rec { + crateName = "tracing"; + version = "0.1.40"; + edition = "2018"; + sha256 = "1vv48dac9zgj9650pg2b4d0j3w6f3x9gbggf43scq5hrlysklln3"; + authors = [ + "Eliza Weisman <eliza@buoyant.io>" + "Tokio Contributors <team@tokio.rs>" + ]; + dependencies = [ + { + name = "pin-project-lite"; + packageId = "pin-project-lite"; + } + { + name = "tracing-attributes"; + packageId = "tracing-attributes"; + optional = true; + } + { + name = "tracing-core"; + packageId = "tracing-core"; + usesDefaultFeatures = false; + } + ]; + features = { + "attributes" = [ "tracing-attributes" ]; + "default" = [ "std" "attributes" ]; + "log" = [ "dep:log" ]; + "log-always" = [ "log" ]; + "std" = [ "tracing-core/std" ]; + "tracing-attributes" = [ "dep:tracing-attributes" ]; + "valuable" = [ "tracing-core/valuable" ]; + }; + resolvedDefaultFeatures = [ "attributes" "default" "std" "tracing-attributes" ]; + }; + "tracing-attributes" = rec { + crateName = "tracing-attributes"; + version = "0.1.27"; + edition = "2018"; + sha256 = "1rvb5dn9z6d0xdj14r403z0af0bbaqhg02hq4jc97g5wds6lqw1l"; + procMacro = true; + libName = "tracing_attributes"; + authors = [ + "Tokio Contributors <team@tokio.rs>" + "Eliza Weisman <eliza@buoyant.io>" + "David Barsky <dbarsky@amazon.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn 2.0.48"; + usesDefaultFeatures = false; + features = [ "full" "parsing" "printing" "visit-mut" "clone-impls" "extra-traits" "proc-macro" ]; + } + ]; + features = { }; + }; + "tracing-core" = rec { + crateName = "tracing-core"; + version = "0.1.32"; + edition = "2018"; + sha256 = "0m5aglin3cdwxpvbg6kz0r9r0k31j48n0kcfwsp6l49z26k3svf0"; + libName = "tracing_core"; + authors = [ + "Tokio Contributors <team@tokio.rs>" + ]; + dependencies = [ + { + name = "once_cell"; + packageId = "once_cell"; + optional = true; + } + ]; + features = { + "default" = [ "std" "valuable/std" ]; + "once_cell" = [ "dep:once_cell" ]; + "std" = [ "once_cell" ]; + "valuable" = [ "dep:valuable" ]; + }; + resolvedDefaultFeatures = [ "once_cell" "std" ]; + }; "typenum" = rec { crateName = "typenum"; version = "1.17.0"; |