ghc-mod/scripts/download-metadata.sh

29 lines
1.4 KiB
Bash
Raw Normal View History

2015-11-05 20:23:19 +00:00
#!/bin/sh
################################################################################
# #
# Download package metadata for all versions on Hackage #
# #
# Copyright (C) 2015 Daniel Gröber <dxld@darkboxed.org> #
# #
# Copying and distribution of this file, with or without modification, #
# are permitted in any medium without royalty provided the copyright #
# notice and this notice are preserved. This file is offered as-is, #
# without any warranty. #
# #
# Usage: ./download-metadata.sh PACKAGE OUTPUT_DIRECTORY #
# #
################################################################################
PACKAGE=$1
OUTDIR=$2
2015-11-26 15:08:08 +00:00
versions="$(wget -O - https://hackage.haskell.org/package/"$PACKAGE"/preferred.json | jq '."normal-version"[]' -r)"
2015-11-05 20:23:19 +00:00
mkdir -p "$OUTDIR"
for v in $versions; do
wget https://hackage.haskell.org/package/"$PACKAGE-$v"/"$PACKAGE".cabal -O "$OUTDIR/${PACKAGE}-${v}.cabal"
done