2020-10-16 01:34:49 +02:00
|
|
|
#!/usr/bin/env nix-shell
|
2021-08-24 04:26:52 +02:00
|
|
|
#!nix-shell --pure -i bash -p wget -p gnupg -p cacert -p nix
|
2009-11-08 01:32:12 +01:00
|
|
|
|
|
|
|
# Update patch set for GNU Bash or Readline.
|
|
|
|
|
|
|
|
if [ $# -ne 2 ]
|
|
|
|
then
|
2021-08-24 04:26:52 +02:00
|
|
|
echo "Usage: $(basename "$0") PROJECT VERSION"
|
2009-11-08 01:32:12 +01:00
|
|
|
echo ""
|
|
|
|
echo "Update the patch set for PROJECT (one of \`bash' or \`readline') for"
|
|
|
|
echo "the given version (e.g., \`4.0'). Produce \`PROJECT-patches.nix'."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
PROJECT="$1"
|
|
|
|
VERSION="$2"
|
2021-08-24 04:26:52 +02:00
|
|
|
DIR=$(dirname "$0")
|
|
|
|
VERSION_CONDENSED="$(echo "$VERSION" | sed -es/\\.//g)"
|
|
|
|
PATCH_LIST="$DIR/$PROJECT-$VERSION-patches.nix"
|
2009-11-08 01:32:12 +01:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rm -vf "$PATCH_LIST"
|
|
|
|
|
2020-10-16 01:34:49 +02:00
|
|
|
wget "https://tiswww.case.edu/php/chet/gpgkey.asc"
|
|
|
|
echo "4ef5051ce7200241e65d29c11eb57df8 gpgkey.asc" > gpgkey.asc.md5
|
|
|
|
md5sum -c gpgkey.asc.md5
|
|
|
|
gpg --import ./gpgkey.asc
|
|
|
|
rm gpgkey.asc{,.md5}
|
|
|
|
|
2009-11-08 01:32:12 +01:00
|
|
|
( echo "# Automatically generated by \`$(basename $0)'; do not edit." ; \
|
|
|
|
echo "" ; \
|
|
|
|
echo "patch: [" ) \
|
|
|
|
>> "$PATCH_LIST"
|
|
|
|
|
2021-08-24 04:26:52 +02:00
|
|
|
for i in {001..100}
|
2009-11-08 01:32:12 +01:00
|
|
|
do
|
2021-08-24 04:26:52 +02:00
|
|
|
wget -P "$DIR" "ftp.gnu.org/gnu/$PROJECT/$PROJECT-$VERSION-patches/$PROJECT$VERSION_CONDENSED-$i" || break
|
|
|
|
wget -P "$DIR" "ftp.gnu.org/gnu/$PROJECT/$PROJECT-$VERSION-patches/$PROJECT$VERSION_CONDENSED-$i.sig"
|
|
|
|
gpg --verify "$DIR/$PROJECT$VERSION_CONDENSED-$i.sig"
|
|
|
|
hash=$(nix-hash --flat --type sha256 --base32 "$DIR/$PROJECT$VERSION_CONDENSED-$i")
|
|
|
|
echo "(patch \"$i\" \"$hash\")" \
|
2009-11-08 01:32:12 +01:00
|
|
|
>> "$PATCH_LIST"
|
|
|
|
|
2021-08-24 04:26:52 +02:00
|
|
|
rm -f "$DIR/$PROJECT$VERSION_CONDENSED-$i"{,.sig}
|
2009-11-08 01:32:12 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
echo "]" >> "$PATCH_LIST"
|
|
|
|
|
2021-08-24 04:26:52 +02:00
|
|
|
# bash interprets numbers starting with 0 as octals
|
|
|
|
echo "Got $((10#$i - 1)) patches."
|
2009-11-08 01:32:12 +01:00
|
|
|
echo "Patch list has been written to \`$PATCH_LIST'."
|