Skip to content

Commit

Permalink
Merge pull request #2711 from ipfs/dist-root
Browse files Browse the repository at this point in the history
build: specify a dist.ipfs.io hash
  • Loading branch information
whyrusleeping committed May 17, 2016
2 parents 5d74bc4 + 864e305 commit 1e717b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ else
endif


dist_root=/ipfs/QmXZQzBAFuoELw3NtjQZHkWSdA332PyQUj6pQjuhEukvg8
gx_bin=bin/gx-v0.7.0
gx-go_bin=bin/gx-go-v1.2.0

Expand All @@ -27,13 +28,13 @@ go_check:

bin/gx-v%:
@echo "installing gx $(@:bin/gx-%=%)"
@bin/dist_get gx $@ $(@:bin/gx-%=%)
@bin/dist_get ${dist_root} gx $@ $(@:bin/gx-%=%)
rm -f bin/gx
ln -s $(@:bin/%=%) bin/gx

bin/gx-go-v%:
@echo "installing gx-go $(@:bin/gx-go-%=%)"
@bin/dist_get gx-go $@ $(@:bin/gx-go-%=%)
@bin/dist_get ${dist_root} gx-go $@ $(@:bin/gx-go-%=%)
rm -f bin/gx-go
ln -s $(@:bin/%=%) bin/gx-go

Expand Down
22 changes: 12 additions & 10 deletions bin/dist_get
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,22 @@ get_go_vars() {
}

mkurl() {
m_name="$1"
m_vers="$2"
m_archive="$3"
m_root="$1"
m_name="$2"
m_vers="$3"
m_archive="$4"
m_govars=$(get_go_vars) || die "could not get go env vars"

echo "http://dist.ipfs.io/$m_name/$m_vers/${m_name}_${m_vers}_$m_govars.$m_archive"
echo "https://ipfs.io$m_root/$m_name/$m_vers/${m_name}_${m_vers}_$m_govars.$m_archive"
}

distname="$1"
outpath="$2"
version="$3"
distroot="$1"
distname="$2"
outpath="$3"
version="$4"

if [ -z "$distname" ] || [ -z "$outpath" ] || [ -z "$version" ]; then
die "usage: dist_get <distname> <outpath> <version>"
if [ -z "$distroot" ] || [ -z "$distname" ] || [ -z "$outpath" ] || [ -z "$version" ]; then
die "usage: dist_get <distroot> <distname> <outpath> <version>"
fi

case $version in
Expand Down Expand Up @@ -135,7 +137,7 @@ esac

mkdir -p bin/tmp

url=$(mkurl "$distname" "$version" "$archive")
url=$(mkurl "$distroot" "$distname" "$version" "$archive")
tmpfi="bin/tmp/$distname.$archive"

download "$url" "$tmpfi"
Expand Down

0 comments on commit 1e717b8

Please sign in to comment.