ghc-mod/scripts/extract-upload-date.sh
2016-10-30 20:52:46 +01:00

18 lines
510 B
Bash
Executable File

#!/bin/sh
PACKAGE=$1
OUTDIR=$2
versions="$(wget -O - https://hackage.haskell.org/package/"$PACKAGE"/preferred.json | jq '(."normal-version" + ."deprecated-version")[]' -r)"
mkdir -p "$OUTDIR"
for v in $versions; do
date=$(wget -O - https://hackage.haskell.org/package/"$PACKAGE-$v" \
| w3m -dump -T text/html \
| grep Uploaded \
| sed -r 's/^\s+Uploaded\s+(.*) by .*$/\1/')
date --date="$date" '+%s' > "$OUTDIR"/"$PACKAGE-$v".upload-date
done