about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorDavid McFarland <corngood@gmail.com>2022-09-26 11:44:33 -0300
committerDavid McFarland <corngood@gmail.com>2022-10-02 16:09:27 -0300
commitf8763b87e0629828733ab6288230bb6105484992 (patch)
treeec2d6ad8d71e470c090435f24b37a8c3223c6608 /pkgs/build-support
parentb22074a46eaf7909778f39712733f92ffa7f1ac7 (diff)
downloadnixlib-f8763b87e0629828733ab6288230bb6105484992.tar
nixlib-f8763b87e0629828733ab6288230bb6105484992.tar.gz
nixlib-f8763b87e0629828733ab6288230bb6105484992.tar.bz2
nixlib-f8763b87e0629828733ab6288230bb6105484992.tar.lz
nixlib-f8763b87e0629828733ab6288230bb6105484992.tar.xz
nixlib-f8763b87e0629828733ab6288230bb6105484992.tar.zst
nixlib-f8763b87e0629828733ab6288230bb6105484992.zip
nuget-to-nix: exclude by package source, not list
This allows exclusions to be by version.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/default.nix5
-rwxr-xr-xpkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh6
2 files changed, 4 insertions, 7 deletions
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix
index 1892c6b79306..a8754218dece 100644
--- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix
+++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix
@@ -157,9 +157,6 @@ stdenvNoCC.mkDerivation (args // {
 
     fetch-deps =
       let
-        # Because this list is rather long its put in its own store path to maintain readability of the generated script
-        exclusions = writeText "nuget-package-exclusions" (lib.concatStringsSep "\n" (dotnet-sdk.passthru.packages { fetchNuGet = attrs: attrs.pname; }));
-
         # Derivations may set flags such as `--runtime <rid>` based on the host platform to avoid restoring/building nuget dependencies they dont have or dont need.
         # This introduces an issue; In this script we loop over all platforms from `meta` and add the RID flag for it, as to fetch all required dependencies.
         # The script would inherit the RID flag from the derivation based on the platform building the script, and set the flag for any iteration we do over the RIDs.
@@ -254,7 +251,7 @@ stdenvNoCC.mkDerivation (args // {
 
         echo "Writing lockfile..."
         echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n" > "$depsFile"
-        nuget-to-nix "$tmp/nuget_pkgs" "${exclusions}" >> "$depsFile"
+        nuget-to-nix "$tmp/nuget_pkgs" "${sdkDeps}" >> "$depsFile"
         echo "Succesfully wrote lockfile to $depsFile"
       '';
   } // args.passthru or { };
diff --git a/pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh b/pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh
index 5685b0f62bd9..d8c928f5179e 100755
--- a/pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh
+++ b/pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh
@@ -5,14 +5,14 @@ set -euo pipefail
 export PATH="@binPath@"
 
 if [ $# -eq 0 ]; then
-  >&2 echo "Usage: $0 <packages directory> [path to file with a list of excluded packages] > deps.nix"
+  >&2 echo "Usage: $0 <packages directory> [path to excluded package source] > deps.nix"
   exit 1
 fi
 
 pkgs=$1
-exclusions="${2:-/dev/null}"
 tmpfile=$(mktemp /tmp/nuget-to-nix.XXXXXX)
 trap "rm -f ${tmpfile}" EXIT
+excluded_source=$(realpath "${2:-$tmp/empty}")
 
 declare -A nuget_sources_cache
 
@@ -23,7 +23,7 @@ while read pkg_spec; do
     # Build version part should be ignored: `3.0.0-beta2.20059.3+77df2220` -> `3.0.0-beta2.20059.3`
     sed -nE 's/.*<id>([^<]*).*/\1/p; s/.*<version>([^<+]*).*/\1/p' "$pkg_spec")
 
-  if grep "$pkg_name" "$exclusions" > /dev/null; then
+  if [[ -e "$excluded_source/${pkg_name}.$pkg_version".nupkg ]]; then
     continue
   fi