From 69fe39b7a8f0a3afad8f585cf466c0c40c57cdf6 Mon Sep 17 00:00:00 2001 From: nverno Date: Tue, 30 Apr 2019 09:10:50 -0400 Subject: [PATCH] just get versions from git tags --- bin/install | 9 +-------- bin/list-all | 18 +++--------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/bin/install b/bin/install index 2a9c7b4..1ada6fb 100755 --- a/bin/install +++ b/bin/install @@ -1,15 +1,8 @@ #!/usr/bin/env bash -ghc_version () { - local version=$1 - local url="https://downloads.haskell.org/~ghc/${version}/" - curl -s "$url" | grep -oE 'ghc-[^-]+' | head -n 1 | sed -e 's/ghc-//g' -} - ghc_install() { local install_type=$1 - local release=$2 - local version=$(ghc_version $release) + local version=$2 local install_path=$3 local tmp_dir=$(mktemp -d -t haskell_XXXXXXX) diff --git a/bin/list-all b/bin/list-all index 40ca1db..747fcea 100755 --- a/bin/list-all +++ b/bin/list-all @@ -1,17 +1,5 @@ #!/usr/bin/env bash -ghc_releases=https://downloads.haskell.org/~ghc/ - -# stolen from https://github.com/rbenv/ruby-build/pull/631/files#diff-fdcfb8a18714b33b07529b7d02b54f1dR942 -function sort_versions() { - sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' | \ - LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}' -} - -function ghc_versions () { - curl -s "$ghc_releases" | grep -oE '[0-9]+\.[^/]+' | uniq -} - -versions="$(ghc_versions | sort_versions)" - -echo $versions +# just print releases +echo $(git ls-remote --tags --refs https://github.com/ghc/ghc "*release" | + sed 's;^.*refs/tags/ghc-\(.*\)-release$;\1;')