From 423fc3f232e8b88c2c49ca48202358860aadb44b Mon Sep 17 00:00:00 2001 From: V Date: Tue, 25 Aug 2020 12:12:05 +0200 Subject: [PATCH] lib/strings: deprecate readPathsFromFile > NOTE: This function is not performant and should be avoided. It's not used at all in-tree now, so we can remove it completely after any remaining users are given notice. --- lib/strings.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/strings.nix b/lib/strings.nix index 0baa942355c..9fa9f023561 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -689,14 +689,15 @@ rec { "/prefix/nix-profiles-library-paths.patch" "/prefix/compose-search-path.patch" ] */ - readPathsFromFile = rootPath: file: - let - lines = lib.splitString "\n" (builtins.readFile file); - removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line)); - relativePaths = removeComments lines; - absolutePaths = builtins.map (path: rootPath + "/${path}") relativePaths; - in - absolutePaths; + readPathsFromFile = lib.warn "lib.readPathsFromFile is deprecated, use a list instead" + (rootPath: file: + let + lines = lib.splitString "\n" (builtins.readFile file); + removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line)); + relativePaths = removeComments lines; + absolutePaths = builtins.map (path: rootPath + "/${path}") relativePaths; + in + absolutePaths); /* Read the contents of a file removing the trailing \n