diff options
author | Silvan Mosberger <silvan.mosberger@tweag.io> | 2024-01-05 00:48:02 +0100 |
---|---|---|
committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2024-01-05 02:01:55 +0100 |
commit | 54b05324f41d3d45eccddc3feb4bbb9e0c060a39 (patch) | |
tree | 6b96e1d2c2b12337d45a36091be3764b735fcff9 /pkgs/test/nixpkgs-check-by-name | |
parent | 27c873af995394445eef05eaa1b95997f57e868a (diff) |
tests.nixpkgs-check-by-name: Internal strip nixpkgs prefix
Strips the Nixpkgs prefix from the callPackage paths, makes future error messages using this path be deterministic.
Diffstat (limited to 'pkgs/test/nixpkgs-check-by-name')
-rw-r--r-- | pkgs/test/nixpkgs-check-by-name/src/eval.nix | 5 | ||||
-rw-r--r-- | pkgs/test/nixpkgs-check-by-name/src/eval.rs | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/pkgs/test/nixpkgs-check-by-name/src/eval.nix b/pkgs/test/nixpkgs-check-by-name/src/eval.nix index b605a35a322a7..7707dc732b703 100644 --- a/pkgs/test/nixpkgs-check-by-name/src/eval.nix +++ b/pkgs/test/nixpkgs-check-by-name/src/eval.nix @@ -9,6 +9,9 @@ let attrs = builtins.fromJSON (builtins.readFile attrsPath); + nixpkgsPathLength = builtins.stringLength (toString nixpkgsPath) + 1; + removeNixpkgsPrefix = builtins.substring nixpkgsPathLength (-1); + # We need access to the `callPackage` arguments of each attribute. # The only way to do so is to override `callPackage` with our own version that adds this information to the result, # and then try to access this information. @@ -20,7 +23,7 @@ let Manual = { path = if builtins.isPath fn then - toString fn + removeNixpkgsPrefix (toString fn) else null; empty_arg = diff --git a/pkgs/test/nixpkgs-check-by-name/src/eval.rs b/pkgs/test/nixpkgs-check-by-name/src/eval.rs index 4004841c94304..7680af185bdbd 100644 --- a/pkgs/test/nixpkgs-check-by-name/src/eval.rs +++ b/pkgs/test/nixpkgs-check-by-name/src/eval.rs @@ -127,7 +127,6 @@ pub fn check_values( let check_result = validation::sequence(attributes.into_iter().map( |(attribute_name, attribute_value)| { let relative_package_file = structure::relative_file_for_package(&attribute_name); - let absolute_package_file = nixpkgs_path.join(&relative_package_file); use ratchet::RatchetState::*; use AttributeInfo::*; @@ -170,7 +169,7 @@ pub fn check_values( }), Manual { path, empty_arg } => { let correct_file = if let Some(call_package_path) = path { - absolute_package_file == *call_package_path + relative_package_file == *call_package_path } else { false }; |