Revert "lib,doc: remove obvious usages of toString on paths"

This commit is contained in:
Anderson Torres 2022-11-05 21:57:23 -03:00 committed by GitHub
parent e6c6826d42
commit 4b59590ac5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -38,7 +38,7 @@ let
substr = builtins.substring prefixLen filenameLen filename; substr = builtins.substring prefixLen filenameLen filename;
in substr; in substr;
removeNixpkgs = removeFilenamePrefix pkgs.path; removeNixpkgs = removeFilenamePrefix (builtins.toString pkgs.path);
liblocations = liblocations =
builtins.filter builtins.filter

View File

@ -140,7 +140,7 @@ let
origSrc = if isFiltered then src.origSrc else src; origSrc = if isFiltered then src.origSrc else src;
in lib.cleanSourceWith { in lib.cleanSourceWith {
filter = (path: type: filter = (path: type:
let relPath = lib.removePrefix (origSrc + "/") (path); let relPath = lib.removePrefix (toString origSrc + "/") (toString path);
in lib.any (re: match re relPath != null) regexes); in lib.any (re: match re relPath != null) regexes);
inherit src; inherit src;
}; };
@ -175,12 +175,12 @@ let
*/ */
commitIdFromGitRepo = commitIdFromGitRepo =
let readCommitFromFile = file: path: let readCommitFromFile = file: path:
let fileName = path + "/" + file; let fileName = toString path + "/" + file;
packedRefsName = path + "/packed-refs"; packedRefsName = toString path + "/packed-refs";
absolutePath = base: path: absolutePath = base: path:
if lib.hasPrefix "/" path if lib.hasPrefix "/" path
then path then path
else /. + "${base}/${path}"; else toString (/. + "${base}/${path}");
in if pathIsRegularFile path in if pathIsRegularFile path
# Resolve git worktrees. See gitrepository-layout(5) # Resolve git worktrees. See gitrepository-layout(5)
then then
@ -226,7 +226,7 @@ let
pathHasContext = builtins.hasContext or (lib.hasPrefix storeDir); pathHasContext = builtins.hasContext or (lib.hasPrefix storeDir);
canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext src); canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext (toString src));
# -------------------------------------------------------------------------- # # -------------------------------------------------------------------------- #
# Internal functions # Internal functions

View File

@ -213,8 +213,8 @@ rec {
# Default value to return if revision can not be determined # Default value to return if revision can not be determined
default: default:
let let
revisionFile = ./.. + "/.git-revision"; revisionFile = "${toString ./..}/.git-revision";
gitRepo = ./.. + "/.git"; gitRepo = "${toString ./..}/.git";
in if lib.pathIsGitRepo gitRepo in if lib.pathIsGitRepo gitRepo
then lib.commitIdFromGitRepo gitRepo then lib.commitIdFromGitRepo gitRepo
else if lib.pathExists revisionFile then lib.fileContents revisionFile else if lib.pathExists revisionFile then lib.fileContents revisionFile