treewide: lib.isInOldestRelease -> lib.oldestSupportedReleaseIsAtLeast

This commit is contained in:
Robert Hensing 2024-10-08 11:14:24 +02:00
parent c2b411e674
commit 729225e355
8 changed files with 15 additions and 15 deletions

View File

@ -5,7 +5,7 @@
let let
inherit (builtins) head length; inherit (builtins) head length;
inherit (lib.trivial) isInOldestRelease mergeAttrs warn warnIf; inherit (lib.trivial) oldestSupportedReleaseIsAtLeast mergeAttrs warn warnIf;
inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName; inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName;
inherit (lib.lists) foldr foldl' concatMap elemAt all partition groupBy take foldl; inherit (lib.lists) foldr foldl' concatMap elemAt all partition groupBy take foldl;
in in
@ -2137,6 +2137,6 @@ rec {
"lib.zip is a deprecated alias of lib.zipAttrsWith." zipAttrsWith; "lib.zip is a deprecated alias of lib.zipAttrsWith." zipAttrsWith;
# DEPRECATED # DEPRECATED
cartesianProductOfSets = warnIf (isInOldestRelease 2405) cartesianProductOfSets = warnIf (oldestSupportedReleaseIsAtLeast 2405)
"lib.cartesianProductOfSets is a deprecated alias of lib.cartesianProduct." cartesianProduct; "lib.cartesianProductOfSets is a deprecated alias of lib.cartesianProduct." cartesianProduct;
} }

View File

@ -23,7 +23,7 @@ let
isAttrs isAttrs
isBool isBool
isFunction isFunction
isInOldestRelease oldestSupportedReleaseIsAtLeast
isList isList
isString isString
length length
@ -1030,7 +1030,7 @@ let
mkForce = mkOverride 50; mkForce = mkOverride 50;
mkVMOverride = mkOverride 10; # used by nixos-rebuild build-vm mkVMOverride = mkOverride 10; # used by nixos-rebuild build-vm
defaultPriority = warnIf (isInOldestRelease 2305) "lib.modules.defaultPriority is deprecated, please use lib.modules.defaultOverridePriority instead." defaultOverridePriority; defaultPriority = warnIf (oldestSupportedReleaseIsAtLeast 2305) "lib.modules.defaultPriority is deprecated, please use lib.modules.defaultOverridePriority instead." defaultOverridePriority;
mkFixStrictness = warn "lib.mkFixStrictness has no effect and will be removed. It returns its argument unmodified, so you can just remove any calls." id; mkFixStrictness = warn "lib.mkFixStrictness has no effect and will be removed. It returns its argument unmodified, so you can just remove any calls." id;
@ -1146,8 +1146,8 @@ let
}: doRename { }: doRename {
inherit from to; inherit from to;
visible = false; visible = false;
warn = isInOldestRelease sinceRelease; warn = oldestSupportedReleaseIsAtLeast sinceRelease;
use = warnIf (isInOldestRelease sinceRelease) use = warnIf (oldestSupportedReleaseIsAtLeast sinceRelease)
"Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'."; "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'.";
}; };

View File

@ -256,15 +256,15 @@ let
in { in {
pathType = lib.warnIf (lib.isInOldestRelease 2305) pathType = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305)
"lib.sources.pathType has been moved to lib.filesystem.pathType." "lib.sources.pathType has been moved to lib.filesystem.pathType."
lib.filesystem.pathType; lib.filesystem.pathType;
pathIsDirectory = lib.warnIf (lib.isInOldestRelease 2305) pathIsDirectory = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305)
"lib.sources.pathIsDirectory has been moved to lib.filesystem.pathIsDirectory." "lib.sources.pathIsDirectory has been moved to lib.filesystem.pathIsDirectory."
lib.filesystem.pathIsDirectory; lib.filesystem.pathIsDirectory;
pathIsRegularFile = lib.warnIf (lib.isInOldestRelease 2305) pathIsRegularFile = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305)
"lib.sources.pathIsRegularFile has been moved to lib.filesystem.pathIsRegularFile." "lib.sources.pathIsRegularFile has been moved to lib.filesystem.pathIsRegularFile."
lib.filesystem.pathIsRegularFile; lib.filesystem.pathIsRegularFile;

View File

@ -2272,7 +2272,7 @@ rec {
isCoercibleToString :: a -> bool isCoercibleToString :: a -> bool
``` ```
*/ */
isCoercibleToString = lib.warnIf (lib.isInOldestRelease 2305) isCoercibleToString = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305)
"lib.strings.isCoercibleToString is deprecated in favor of either isStringLike or isConvertibleWithToString. Only use the latter if it needs to return true for null, numbers, booleans and list of similarly coercibles." "lib.strings.isCoercibleToString is deprecated in favor of either isStringLike or isConvertibleWithToString. Only use the latter if it needs to return true for null, numbers, booleans and list of similarly coercibles."
isConvertibleWithToString; isConvertibleWithToString;

View File

@ -151,7 +151,7 @@ in
nodesCompat = nodesCompat =
mapAttrs mapAttrs
(name: config: config // { (name: config: config // {
config = lib.warnIf (lib.isInOldestRelease 2211) config = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211)
"Module argument `nodes.${name}.config` is deprecated. Use `nodes.${name}` instead." "Module argument `nodes.${name}.config` is deprecated. Use `nodes.${name}` instead."
config; config;
}) })

View File

@ -39,7 +39,7 @@ let
optionalDeprecationWarning = optionalDeprecationWarning =
# substitutions is only available starting 24.05. # substitutions is only available starting 24.05.
# TODO: Remove support for replacements sometime after the next release # TODO: Remove support for replacements sometime after the next release
lib.warnIf (args ? replacements && lib.isInOldestRelease 2405) '' lib.warnIf (args ? replacements && lib.oldestSupportedReleaseIsAtLeast 2405) ''
pkgs.substitute: For "${name}", `replacements` is used, which is deprecated since it doesn't support arguments with spaces. Use `substitutions` instead: pkgs.substitute: For "${name}", `replacements` is used, which is deprecated since it doesn't support arguments with spaces. Use `substitutions` instead:
substitutions = [ ${deprecationReplacement} ];''; substitutions = [ ${deprecationReplacement} ];'';
in in

View File

@ -466,7 +466,7 @@ rec {
which is cross aware instead. which is cross aware instead.
*/ */
generateOptparseApplicativeCompletions = commands: pkg: generateOptparseApplicativeCompletions = commands: pkg:
lib.warnIf (lib.isInOldestRelease 2211) "haskellLib.generateOptparseApplicativeCompletions is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211) "haskellLib.generateOptparseApplicativeCompletions is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!"
(pkgs.lib.foldr __generateOptparseApplicativeCompletion pkg commands); (pkgs.lib.foldr __generateOptparseApplicativeCompletion pkg commands);
/* /*
@ -475,7 +475,7 @@ rec {
which is cross aware instead. which is cross aware instead.
*/ */
generateOptparseApplicativeCompletion = command: pkg: generateOptparseApplicativeCompletion = command: pkg:
lib.warnIf (lib.isInOldestRelease 2211) "haskellLib.generateOptparseApplicativeCompletion is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions (plural!). Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211) "haskellLib.generateOptparseApplicativeCompletion is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions (plural!). Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!"
(__generateOptparseApplicativeCompletion command pkg); (__generateOptparseApplicativeCompletion command pkg);
# Don't fail at configure time if there are multiple versions of the # Don't fail at configure time if there are multiple versions of the

View File

@ -93,7 +93,7 @@ in rec {
inherit hasDistutilsCxxPatch; inherit hasDistutilsCxxPatch;
# Remove after 24.11 is released. # Remove after 24.11 is released.
pythonForBuild = pythonForBuild =
lib.warnIf (lib.isInOldestRelease 2311) "`pythonForBuild` (from `python*`) has been renamed to `pythonOnBuildForHost`" lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2311) "`pythonForBuild` (from `python*`) has been renamed to `pythonOnBuildForHost`"
pythonOnBuildForHost_overridden; pythonOnBuildForHost_overridden;
pythonOnBuildForHost = pythonOnBuildForHost_overridden; pythonOnBuildForHost = pythonOnBuildForHost_overridden;