mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-19 00:08:32 +01:00
nuget-to-nix: deterministic sorting of output list
It is the package list output that should be sorted. The current output sequence is not logical because '.' is sorted in front of '/' with input sorting and is not deterministic for different language environments. To get a deterministic and logical sorting in environments with different language configured, env "LC_ALL=C" is set and the produced strings is that is sorted. To get alphabetic sorting and not a pure ASCII value sort "--ignore-case" is added.
This commit is contained in:
parent
f0ae4b6670
commit
bbcb7d3d34
1 changed files with 6 additions and 2 deletions
|
@ -8,6 +8,8 @@ if [ $# -eq 0 ]; then
|
|||
fi
|
||||
|
||||
pkgs=$1
|
||||
tmpfile=$(mktemp /tmp/nuget-to-nix.XXXXXX)
|
||||
trap 'rm -f "$tmpfile" EXIT
|
||||
|
||||
echo "{ fetchNuGet }: ["
|
||||
|
||||
|
@ -17,7 +19,9 @@ while read pkg_spec; do
|
|||
sed -nE 's/.*<id>([^<]*).*/\1/p; s/.*<version>([^<+]*).*/\1/p' "$pkg_spec")
|
||||
pkg_sha256="$(nix-hash --type sha256 --flat --base32 "$(dirname "$pkg_spec")"/*.nupkg)"
|
||||
|
||||
echo " (fetchNuGet { pname = \"$pkg_name\"; version = \"$pkg_version\"; sha256 = \"$pkg_sha256\"; })"
|
||||
done < <(find $1 -name '*.nuspec' | sort)
|
||||
echo " (fetchNuGet { pname = \"$pkg_name\"; version = \"$pkg_version\"; sha256 = \"$pkg_sha256\"; })" >> ${tmpfile}
|
||||
done < <(find $1 -name '*.nuspec')
|
||||
|
||||
LC_ALL=C sort --ignore-case ${tmpfile}
|
||||
|
||||
echo "]"
|
||||
|
|
Loading…
Reference in a new issue