Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplifies release retrieval using git tags #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions bin/install
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
18 changes: 3 additions & 15 deletions bin/list-all
Original file line number Diff line number Diff line change
@@ -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;')