3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #278242 from raphaelr/mknugetsource-remove-ifd

mkNugetSource: Remove meta.licenses attribute
This commit is contained in:
Weijia Wang 2024-01-18 09:22:38 +01:00 committed by GitHub
commit b0fb3f62d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,36 +3,26 @@
{ name { name
, description ? "" , description ? ""
, deps ? [] , deps ? []
}: , ...
}@args:
let stdenvNoCC.mkDerivation (lib.recursiveUpdate {
nuget-source = stdenvNoCC.mkDerivation { inherit name;
inherit name;
nativeBuildInputs = [ python3 ]; nativeBuildInputs = [ python3 ];
buildCommand = '' buildCommand = ''
mkdir -p $out/{lib,share} mkdir -p $out/{lib,share}
# use -L to follow symbolic links. When `projectReferences` is used in # use -L to follow symbolic links. When `projectReferences` is used in
# buildDotnetModule, one of the deps will be a symlink farm. # buildDotnetModule, one of the deps will be a symlink farm.
find -L ${lib.concatStringsSep " " deps} -type f -name '*.nupkg' -exec \ find -L ${lib.concatStringsSep " " deps} -type f -name '*.nupkg' -exec \
ln -s '{}' -t $out/lib ';' ln -s '{}' -t $out/lib ';'
# Generates a list of all licenses' spdx ids, if available. # Generates a list of all licenses' spdx ids, if available.
# Note that this currently ignores any license provided in plain text (e.g. "LICENSE.txt") # Note that this currently ignores any license provided in plain text (e.g. "LICENSE.txt")
python ${./extract-licenses-from-nupkgs.py} $out/lib > $out/share/licenses python ${./extract-licenses-from-nupkgs.py} $out/lib > $out/share/licenses
''; '';
meta.description = description; meta.description = description;
} // { # We need data from `$out` for `meta`, so we have to use overrides as to not hit infinite recursion. } (removeAttrs args [ "name" "description" "deps" ]))
meta = nuget-source.meta // {
licenses = let
# TODO: avoid IFD
depLicenses = lib.splitString "\n" (builtins.readFile "${nuget-source}/share/licenses");
in lib.flatten (lib.forEach depLicenses (spdx:
lib.optionals (spdx != "") (lib.getLicenseFromSpdxId spdx)
));
};
};
in nuget-source