mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
lib.replaceChars: warn about being a deprecated alias
replaceStrings has been in nix since 2015(nix 1.10)
so it is safe to remove the fallback
d6d5885c15
This commit is contained in:
parent
084fd69045
commit
05a2dfd674
47 changed files with 64 additions and 75 deletions
|
@ -8,9 +8,9 @@ let
|
|||
systemd = cfg.package;
|
||||
in rec {
|
||||
|
||||
shellEscape = s: (replaceChars [ "\\" ] [ "\\\\" ] s);
|
||||
shellEscape = s: (replaceStrings [ "\\" ] [ "\\\\" ] s);
|
||||
|
||||
mkPathSafeName = lib.replaceChars ["@" ":" "\\" "[" "]"] ["-" "-" "-" "" ""];
|
||||
mkPathSafeName = lib.replaceStrings ["@" ":" "\\" "[" "]"] ["-" "-" "-" "" ""];
|
||||
|
||||
# a type for options that take a unit name
|
||||
unitNameType = types.strMatching "[a-zA-Z0-9@%:_.\\-]+[.](service|socket|device|mount|automount|swap|target|path|timer|scope|slice)";
|
||||
|
@ -258,7 +258,7 @@ in rec {
|
|||
|
||||
makeJobScript = name: text:
|
||||
let
|
||||
scriptName = replaceChars [ "\\" "@" ] [ "-" "_" ] (shellEscape name);
|
||||
scriptName = replaceStrings [ "\\" "@" ] [ "-" "_" ] (shellEscape name);
|
||||
out = (pkgs.writeShellScriptBin scriptName ''
|
||||
set -e
|
||||
${text}
|
||||
|
|
|
@ -48,7 +48,7 @@ rec {
|
|||
trim = s: removeSuffix "/" (removePrefix "/" s);
|
||||
normalizedPath = strings.normalizePath s;
|
||||
in
|
||||
replaceChars ["/"] ["-"]
|
||||
replaceStrings ["/"] ["-"]
|
||||
(replacePrefix "." (strings.escapeC ["."] ".")
|
||||
(strings.escapeC (stringToCharacters " !\"#$%&'()*+,;<=>=@[\\]^`{|}~-")
|
||||
(if normalizedPath == "/" then normalizedPath else trim normalizedPath)));
|
||||
|
@ -67,7 +67,7 @@ rec {
|
|||
else if builtins.isInt arg || builtins.isFloat arg then toString arg
|
||||
else throw "escapeSystemdExecArg only allows strings, paths and numbers";
|
||||
in
|
||||
replaceChars [ "%" "$" ] [ "%%" "$$" ] (builtins.toJSON s);
|
||||
replaceStrings [ "%" "$" ] [ "%%" "$$" ] (builtins.toJSON s);
|
||||
|
||||
# Quotes a list of arguments into a single string for use in a Exec*
|
||||
# line.
|
||||
|
@ -112,7 +112,7 @@ rec {
|
|||
else if isAttrs item then
|
||||
map (name:
|
||||
let
|
||||
escapedName = ''"${replaceChars [''"'' "\\"] [''\"'' "\\\\"] name}"'';
|
||||
escapedName = ''"${replaceStrings [''"'' "\\"] [''\"'' "\\\\"] name}"'';
|
||||
in
|
||||
recurse (prefix + "." + escapedName) item.${name}) (attrNames item)
|
||||
else if isList item then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue