fix(tvix/build): fix inconsistencies around paths

Change-Id: I76ce4e042f6fbe4bc897767b55ce4eb1f7269e5c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10541
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2024-01-05 17:41:37 +02:00 committed by clbot
parent 5f0360c566
commit 00aa3260c9
3 changed files with 9 additions and 9 deletions

View file

@ -86,7 +86,7 @@ type BuildRequest struct {
// slashes, and sorted. // slashes, and sorted.
ScratchPaths []string `protobuf:"bytes,4,rep,name=scratch_paths,json=scratchPaths,proto3" json:"scratch_paths,omitempty"` ScratchPaths []string `protobuf:"bytes,4,rep,name=scratch_paths,json=scratchPaths,proto3" json:"scratch_paths,omitempty"`
// The path where the castore input nodes will be located at, // The path where the castore input nodes will be located at,
// "/nix/store" in case of Nix. // "nix/store" in case of Nix.
// Builds might also write into here (Nix builds do that). // Builds might also write into here (Nix builds do that).
// This MUST be a clean relative path, without any ".", "..", or superfluous // This MUST be a clean relative path, without any ".", "..", or superfluous
// slashes. // slashes.

View file

@ -71,7 +71,7 @@ message BuildRequest {
repeated string scratch_paths = 4; repeated string scratch_paths = 4;
// The path where the castore input nodes will be located at, // The path where the castore input nodes will be located at,
// "/nix/store" in case of Nix. // "nix/store" in case of Nix.
// Builds might also write into here (Nix builds do that). // Builds might also write into here (Nix builds do that).
// This MUST be a clean relative path, without any ".", "..", or superfluous // This MUST be a clean relative path, without any ".", "..", or superfluous
// slashes. // slashes.

View file

@ -152,7 +152,7 @@ where
.map(|(key, value)| EnvVar { key, value }), .map(|(key, value)| EnvVar { key, value }),
), ),
inputs, inputs,
inputs_dir: nix_compat::store_path::STORE_DIR.into(), inputs_dir: nix_compat::store_path::STORE_DIR[1..].into(),
constraints, constraints,
working_dir: "build".into(), working_dir: "build".into(),
scratch_paths: vec!["build".into(), "nix/store".into()], scratch_paths: vec!["build".into(), "nix/store".into()],
@ -192,7 +192,7 @@ fn handle_pass_as_file(
Some((k, contents)) => { Some((k, contents)) => {
let (new_k, path) = calculate_pass_as_file_env(&k); let (new_k, path) = calculate_pass_as_file_env(&k);
additional_files.insert(path.clone(), contents); additional_files.insert(path[1..].to_string(), contents);
environment_vars.insert(new_k, Bytes::from(path)); environment_vars.insert(new_k, Bytes::from(path));
} }
None => { None => {
@ -311,7 +311,7 @@ mod test {
outputs: vec!["nix/store/fhaj6gmwns62s6ypkcldbaj2ybvkhx3p-foo".into()], outputs: vec!["nix/store/fhaj6gmwns62s6ypkcldbaj2ybvkhx3p-foo".into()],
environment_vars: expected_environment_vars, environment_vars: expected_environment_vars,
inputs: vec![INPUT_NODE_FOO.clone()], inputs: vec![INPUT_NODE_FOO.clone()],
inputs_dir: nix_compat::store_path::STORE_DIR.into(), inputs_dir: "nix/store".into(),
constraints: Some(BuildConstraints { constraints: Some(BuildConstraints {
system: derivation.system.clone(), system: derivation.system.clone(),
min_memory: 0, min_memory: 0,
@ -381,7 +381,7 @@ mod test {
outputs: vec!["nix/store/4q0pg5zpfmznxscq3avycvf9xdvx50n3-bar".into()], outputs: vec!["nix/store/4q0pg5zpfmznxscq3avycvf9xdvx50n3-bar".into()],
environment_vars: expected_environment_vars, environment_vars: expected_environment_vars,
inputs: vec![], inputs: vec![],
inputs_dir: nix_compat::store_path::STORE_DIR.into(), inputs_dir: "nix/store".into(),
constraints: Some(BuildConstraints { constraints: Some(BuildConstraints {
system: derivation.system.clone(), system: derivation.system.clone(),
min_memory: 0, min_memory: 0,
@ -455,7 +455,7 @@ mod test {
outputs: vec!["nix/store/pp17lwra2jkx8rha15qabg2q3wij72lj-foo".into()], outputs: vec!["nix/store/pp17lwra2jkx8rha15qabg2q3wij72lj-foo".into()],
environment_vars: expected_environment_vars, environment_vars: expected_environment_vars,
inputs: vec![], inputs: vec![],
inputs_dir: nix_compat::store_path::STORE_DIR.into(), inputs_dir: "nix/store".into(),
constraints: Some(BuildConstraints { constraints: Some(BuildConstraints {
system: derivation.system.clone(), system: derivation.system.clone(),
min_memory: 0, min_memory: 0,
@ -466,13 +466,13 @@ mod test {
additional_files: vec![ additional_files: vec![
// baz env // baz env
AdditionalFile { AdditionalFile {
path: "/build/.attr-15l04iksj1280dvhbzdq9ai3wlf8ac2188m9qv0gn81k9nba19ds" path: "build/.attr-15l04iksj1280dvhbzdq9ai3wlf8ac2188m9qv0gn81k9nba19ds"
.into(), .into(),
contents: "bar".into() contents: "bar".into()
}, },
// bar env // bar env
AdditionalFile { AdditionalFile {
path: "/build/.attr-1fcgpy7vc4ammr7s17j2xq88scswkgz23dqzc04g8sx5vcp2pppw" path: "build/.attr-1fcgpy7vc4ammr7s17j2xq88scswkgz23dqzc04g8sx5vcp2pppw"
.into(), .into(),
contents: "baz".into(), contents: "baz".into(),
}, },