From 3a7d2b8bbf1fd145aa522b93a68745182fd58d31 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Thu, 12 Sep 2024 10:56:34 -0300 Subject: [PATCH] update-dotnet-lockfiles: skip packages that don't evaluate This allows the script to run on platforms that can't fetch all of the packages, or without allowing unfree. --- .../scripts/update-dotnet-lockfiles.nix | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/maintainers/scripts/update-dotnet-lockfiles.nix b/maintainers/scripts/update-dotnet-lockfiles.nix index a79b0b074c8d..ad1d6e20ee56 100644 --- a/maintainers/scripts/update-dotnet-lockfiles.nix +++ b/maintainers/scripts/update-dotnet-lockfiles.nix @@ -17,28 +17,30 @@ let packagesWith = cond: pkgs: let packagesWithInner = attrs: - lib.unique ( - lib.concatLists ( - lib.mapAttrsToList (name: elem: - let - result = builtins.tryEval elem; - in - if result.success then - let - value = result.value; - in - if lib.isDerivation value then - lib.optional (cond value) value - else - if lib.isAttrs value && (value.recurseForDerivations or false || value.recurseForRelease or false) then - packagesWithInner value - else [] - else []) attrs)); + lib.concatLists ( + lib.mapAttrsToList (name: elem: + let + result = builtins.tryEval elem; + in + if result.success then + let + value = result.value; + in + if lib.isDerivation value then + lib.optional (cond value) value + else + if lib.isAttrs value && (value.recurseForDerivations or false || value.recurseForRelease or false) then + packagesWithInner value + else [] + else []) attrs); in packagesWithInner pkgs; - packages = - packagesWith (pkgs: pkgs ? fetch-deps) pkgs; + packages = lib.unique + (lib.filter (p: + (builtins.tryEval p.outPath).success || + builtins.trace "warning: skipping ${p.name} because it failed to evaluate" false) + (packagesWith (p: p ? fetch-deps) pkgs)); helpText = '' Please run: