From 4e040e8bc491bcee930ee7e59d6e68ef87c35bb6 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 7 Feb 2024 09:21:26 +0100 Subject: chore(tvix/tools/turbofetch): bump magic-buffer to 0.1.1 This contains https://github.com/sklose/magic-buffer/pull/4, so we don't have to impl Send ourselves. Change-Id: If046596e13345ad4fec22209440e65859e44d540 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10748 Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: edef --- tvix/tools/turbofetch/Cargo.lock | 4 ++-- tvix/tools/turbofetch/Cargo.nix | 31 ++++++++++++++++++++++--------- tvix/tools/turbofetch/Cargo.toml | 2 +- tvix/tools/turbofetch/src/buffer.rs | 4 ---- 4 files changed, 25 insertions(+), 16 deletions(-) (limited to 'tvix/tools') diff --git a/tvix/tools/turbofetch/Cargo.lock b/tvix/tools/turbofetch/Cargo.lock index c3243a1262d9..4d65fc40639c 100644 --- a/tvix/tools/turbofetch/Cargo.lock +++ b/tvix/tools/turbofetch/Cargo.lock @@ -659,9 +659,9 @@ dependencies = [ [[package]] name = "magic-buffer" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1865eecb968438d303a38d7ba59239aec6ec58c5b0857c68242046abd7370b29" +checksum = "003aed0f6b361330d1c549e8ae765758cb9d46f7bace57112e8c25847966ff2e" dependencies = [ "libc", "mach2", diff --git a/tvix/tools/turbofetch/Cargo.nix b/tvix/tools/turbofetch/Cargo.nix index 42284eb7d036..d7263727e2dd 100644 --- a/tvix/tools/turbofetch/Cargo.nix +++ b/tvix/tools/turbofetch/Cargo.nix @@ -1,4 +1,4 @@ -# This file was @generated by crate2nix 0.11.0 with the command: +# This file was @generated by crate2nix 0.13.0 with the command: # "generate" "--all-features" # See https://github.com/kolloch/crate2nix for more info. @@ -1976,9 +1976,9 @@ rec { }; "magic-buffer" = rec { crateName = "magic-buffer"; - version = "0.1.0"; + version = "0.1.1"; edition = "2021"; - sha256 = "0a8b6zbsnii04il7r1dhqmcfrimf769aaywdlc1x6f44jv5ywr8q"; + sha256 = "0bpzcrwq89cc5q8mgkmsyx39vjsqaxvaxs29qp8k04rndc7ysfh0"; authors = [ "Sebastian Klose " ]; @@ -2511,6 +2511,7 @@ rec { crateName = "ring"; version = "0.16.20"; edition = "2018"; + links = "ring-asm"; sha256 = "1z682xp7v38ayq9g9nkbhhfpj6ygralmlx7wdmsfv8rnw99cylrh"; authors = [ "Brian Smith " @@ -2589,6 +2590,7 @@ rec { crateName = "ring"; version = "0.17.5"; edition = "2021"; + links = "ring_core_0_17_5"; sha256 = "02sd768l7594rm3jw048z7kkml7zcyw4ir62p6cxirap8wq0a0pv"; authors = [ "Brian Smith " @@ -4683,6 +4685,7 @@ rec { crateName = "wasm-bindgen-shared"; version = "0.2.88"; edition = "2018"; + links = "wasm_bindgen"; sha256 = "02vmw2rzsla1qm0zgfng4kqz52xn8k54v8ads4g1macv09fnq10d"; authors = [ "The wasm-bindgen Developers" @@ -5751,6 +5754,7 @@ rec { crateName = "zstd-sys"; version = "1.6.2+zstd.1.5.1"; edition = "2018"; + links = "zstd"; sha256 = "17xcr0mw8ps9hlc8m0dzj7yd52lb9r9ic9fbpxa4994yilj2zbrd"; authors = [ "Alexandre Bury " @@ -5797,12 +5801,12 @@ rec { os = pkgs.rust.lib.toTargetOs platform; arch = pkgs.rust.lib.toTargetArch platform; family = pkgs.rust.lib.toTargetFamily platform; + vendor = pkgs.rust.lib.toTargetVendor platform; env = "gnu"; endian = if platform.parsed.cpu.significantByte.name == "littleEndian" then "little" else "big"; pointer_width = toString platform.parsed.cpu.bits; - vendor = platform.parsed.vendor.name; debug_assertions = false; }; @@ -5874,7 +5878,6 @@ rec { ( _: { buildTests = true; - release = false; } ); # If the user hasn't set any pre/post commands, we don't want to @@ -5899,6 +5902,16 @@ rec { # recreate a file hierarchy as when running tests with cargo # the source for test data + # It's necessary to locate the source in $NIX_BUILD_TOP/source/ + # instead of $NIX_BUILD_TOP/ + # because we compiled those test binaries in the former and not the latter. + # So all paths will expect source tree to be there and not in the build top directly. + # For example: $NIX_BUILD_TOP := /build in general, if you ask yourself. + # TODO(raitobezarius): I believe there could be more edge cases if `crate.sourceRoot` + # do exist but it's very hard to reason about them, so let's wait until the first bug report. + mkdir -p source/ + cd source/ + ${pkgs.buildPackages.xorg.lndir}/bin/lndir ${crate.src} # build outputs @@ -6098,9 +6111,9 @@ rec { let package = crateConfigs."${dep.packageId}"; in - { inherit (dep) rename; version = package.version; }; + { inherit (dep) rename; inherit (package) version; }; in - lib.mapAttrs (name: choices: builtins.map versionAndRename choices) grouped; + lib.mapAttrs (name: builtins.map versionAndRename) grouped; in buildRustCrateForPkgsFunc pkgs ( @@ -6148,7 +6161,7 @@ rec { */ sanitizeForJson = val: if builtins.isAttrs val - then lib.mapAttrs (n: v: sanitizeForJson v) val + then lib.mapAttrs (n: sanitizeForJson) val else if builtins.isList val then builtins.map sanitizeForJson val else if builtins.isFunction val @@ -6257,7 +6270,7 @@ rec { enabledFeatures = enableFeatures (crateConfig.dependencies or [ ]) expandedFeatures; depWithResolvedFeatures = dependency: let - packageId = dependency.packageId; + inherit (dependency) packageId; features = dependencyFeatures enabledFeatures dependency; in { inherit packageId features; }; diff --git a/tvix/tools/turbofetch/Cargo.toml b/tvix/tools/turbofetch/Cargo.toml index ccec71ca11a8..6b2f0e752020 100644 --- a/tvix/tools/turbofetch/Cargo.toml +++ b/tvix/tools/turbofetch/Cargo.toml @@ -15,7 +15,7 @@ futures = { version = "0.3.30", default-features = false, features = ["std"] } httparse = "1.8.0" hyper = { version = "0.14.27", default-features = false } lambda_runtime = "0.8.2" -magic-buffer = "0.1.0" +magic-buffer = "0.1.1" rusoto_core = { version = "0.48.0", features = ["rustls"], default-features = false } rusoto_s3 = { version = "0.48.0", features = ["rustls"], default-features = false } serde_json = "1.0.108" diff --git a/tvix/tools/turbofetch/src/buffer.rs b/tvix/tools/turbofetch/src/buffer.rs index 13207f562184..d6ff93e3cfe7 100644 --- a/tvix/tools/turbofetch/src/buffer.rs +++ b/tvix/tools/turbofetch/src/buffer.rs @@ -12,10 +12,6 @@ pub struct Buffer { tail: usize, } -// SAFETY: MagicBuffer isn't bound to a thread, and neither are any of the other fields. -// MagicBuffer ought to be Send+Sync itself, upstream PR at https://github.com/sklose/magic-buffer/pull/4 -unsafe impl Send for Buffer {} - impl Buffer { /// Allocate a fresh buffer, with the specified capacity. /// The buffer can contain at most `capacity - 1` bytes. -- cgit 1.4.1