hackage-metadata: update the scripts
This commit is contained in:
parent
9431d4dc82
commit
21fb8638ac
@ -18,11 +18,14 @@ PACKAGE=$1
|
||||
OUTDIR=$2
|
||||
|
||||
versions="$(wget -O - https://hackage.haskell.org/package/"$PACKAGE"/preferred.json | jq '."normal-version"[]' -r)"
|
||||
#versions="$(wget -O - https://hackage.haskell.org/package/"$PACKAGE"/preferred.json | jq '."deprecated-version"[]' -r)"
|
||||
|
||||
|
||||
|
||||
mkdir -p "$OUTDIR"
|
||||
|
||||
for v in $versions; do
|
||||
|
||||
wget https://hackage.haskell.org/package/"$PACKAGE-$v"/"$PACKAGE".cabal -O "$OUTDIR/${PACKAGE}-${v}.cabal"
|
||||
wget https://hackage.haskell.org/package/"$PACKAGE-$v"/"$PACKAGE".cabal -O "$OUTDIR/${PACKAGE}-${v}.cabal" &
|
||||
|
||||
done
|
||||
|
@ -31,6 +31,9 @@ hidden_prompt "Password" pw
|
||||
|
||||
|
||||
versions="$(curl https://hackage.haskell.org/package/"$PACKAGE"/preferred.json | jq '."normal-version"[]' -r)"
|
||||
#versions="$(curl https://hackage.haskell.org/package/"$PACKAGE"/preferred.json | jq '."deprecated-version"[]' -r)"
|
||||
|
||||
echo "Versions: $versions"
|
||||
|
||||
for v in $versions; do
|
||||
rev=$(cat $OUTDIR/$PACKAGE-$v.cabal | grep -i "^x-revision:" | tr -s '[:blank:]*' '\t' | cut -f 2)
|
||||
@ -39,16 +42,21 @@ for v in $versions; do
|
||||
rev=0
|
||||
fi
|
||||
|
||||
echo -n "$PACKAGE v$v rev:$rev..."
|
||||
|
||||
content=$( ( echo "X-Revision: $((rev + 1))"; cat $OUTDIR/$PACKAGE-$v.cabal | sed '/^X-Revision:/Id' ) )
|
||||
|
||||
resp=$(curl --form-string "cabalfile=$content" -F "publish=Publish new revision" https://hackage.haskell.org/package/"${PACKAGE}-${v}"/"${PACKAGE}.cabal"/edit -u "$user:$pw")
|
||||
resp=$(curl -s --form-string "cabalfile=$content" -F "publish=Publish new revision" https://hackage.haskell.org/package/"${PACKAGE}-${v}"/"${PACKAGE}.cabal"/edit -u "$user:$pw")
|
||||
|
||||
changes=$(printf '%s\n' "$resp" | sed -n '/Changes in this revision/,/<\/ul>/p' | w3m -dump -T text/html)
|
||||
|
||||
errors=$(printf '%s\n' "$resp" | sed -n '/Errors/,/<\/form>/p')
|
||||
|
||||
notpublished=$(printf '%s\n' "$resp" | grep "Cannot publish new revision")
|
||||
if printf '%s\n' "$resp" | grep -q "Cannot publish new revision"; then
|
||||
notpublished=1
|
||||
fi
|
||||
|
||||
printf 'Changes:\n%s\n' "$changes"
|
||||
if [ -z "$changes" -o -n "$notpublished" ]; then
|
||||
if printf '%s\n' "$errors" | grep -q "No changes"; then
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user