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.
This commit is contained in:
parent
27c873af99
commit
54b05324f4
@ -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 =
|
||||
|
@ -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
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user