texlive: reimplement fixHashes.sh in GNU Awk
The shell script doesn't work very well in non-GNU environments like darwin. This provides an implementation that uses just a single GNU tool - gawk, thus reduces number of points of failure.
This commit is contained in:
parent
a0cb913949
commit
d9fb53ddd6
@ -58,10 +58,9 @@ mv fixedHashes.nix fixedHashes-old.nix
|
||||
# start with empty fixedHashes
|
||||
echo '{}' > fixedHashes.nix
|
||||
|
||||
nix-build ../../../../.. -Q --no-out-link -A texlive.scheme-full.pkgs | ./fixHashes.sh > ./fixedHashes-new.nix
|
||||
nix-build ../../../../.. -Q --no-out-link -A texlive.scheme-full.pkgs | ./fixHashes.awk > ./fixedHashes-new.nix
|
||||
|
||||
# The script wrongly includes the nix store path to `biber`, which is a separate nixpkgs package
|
||||
grep -v -F '/nix/store/' fixedHashes-new.nix > fixedHashes.nix
|
||||
mv fixedHashes-new.nix fixedHashes.nix
|
||||
```
|
||||
|
||||
### Commit changes
|
||||
|
24
pkgs/tools/typesetting/tex/texlive/fixHashes.awk
Executable file
24
pkgs/tools/typesetting/tex/texlive/fixHashes.awk
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i "gawk -f" -p gawk
|
||||
|
||||
BEGIN {
|
||||
print "{"
|
||||
}
|
||||
|
||||
/-texlive-/ && !/\.bin/ {
|
||||
if (match($0, /-texlive-([^\/]*)/, m) == 0) {
|
||||
print "No match for \""$0"\"" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
cmd="nix-hash --type sha1 --base32 "$0
|
||||
if (( cmd | getline hash ) <= 0) {
|
||||
print "Error executing nix-hash" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
close(cmd)
|
||||
printf("\"%s\"=\"%s\";\n", m[1], hash)
|
||||
}
|
||||
|
||||
END {
|
||||
print "}"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "{"
|
||||
grep -v -F '.bin-' | while read path; do
|
||||
hash=`nix-hash --type sha1 --base32 "$path"`
|
||||
echo -n "$path" | sed -E 's/[^-]*-texlive-(.*)/"\1"/'
|
||||
echo "=\"$hash\";"
|
||||
done
|
||||
echo "}"
|
||||
|
Loading…
Reference in New Issue
Block a user