From 719881967171ebf0f5df7610eb681e5d14e77913 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 23 Feb 2016 17:46:19 -0800 Subject: [PATCH 1/5] assert that you must build from inside your gopath License: MIT Signed-off-by: Jeromy --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 502c9d433..b7326dffa 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,9 @@ gx_upgrade: gxgo_upgrade: go get -u github.com/whyrusleeping/gx-go +path_check: + test "$(shell pwd)" = "$(GOPATH)/src/github.com/ipfs/go-ipfs" || (echo "go-ipfs must be built from within your \$$GOPATH directory." && false) + gx_check: @bin/check_gx_program "gx" "0.3" 'Upgrade or install gx using your package manager or run `make gx_upgrade`' @bin/check_gx_program "gx-go" "0.2" 'Upgrade or install gx-go using your package manager or run `make gxgo_upgrade`' @@ -44,7 +47,7 @@ vendor: godep install: build cd cmd/ipfs && go install -ldflags=$(ldflags) -build: deps +build: deps path_check cd cmd/ipfs && go build -i -ldflags=$(ldflags) nofuse: deps From cdea07dfc39f0479970d2cca1bc613d0644e2b5b Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 23 Feb 2016 17:52:07 -0800 Subject: [PATCH 2/5] move rule to be depended on by deps License: MIT Signed-off-by: Jeromy --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b7326dffa..f346e595a 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ gx_check: @bin/check_gx_program "gx" "0.3" 'Upgrade or install gx using your package manager or run `make gx_upgrade`' @bin/check_gx_program "gx-go" "0.2" 'Upgrade or install gx-go using your package manager or run `make gxgo_upgrade`' -deps: go_check gx_check +deps: go_check gx_check path_check gx --verbose install --global # saves/vendors third-party dependencies to Godeps/_workspace @@ -47,7 +47,7 @@ vendor: godep install: build cd cmd/ipfs && go install -ldflags=$(ldflags) -build: deps path_check +build: deps cd cmd/ipfs && go build -i -ldflags=$(ldflags) nofuse: deps From 65519a0367c333c50b8808ed57504b3aad17b6f5 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 23 Feb 2016 22:26:37 -0800 Subject: [PATCH 3/5] move gopath check to separate script and use realpath for symlink handling License: MIT Signed-off-by: Jeromy --- Makefile | 2 +- bin/check_go_path | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 bin/check_go_path diff --git a/Makefile b/Makefile index f346e595a..d2f1bc5ca 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ gxgo_upgrade: go get -u github.com/whyrusleeping/gx-go path_check: - test "$(shell pwd)" = "$(GOPATH)/src/github.com/ipfs/go-ipfs" || (echo "go-ipfs must be built from within your \$$GOPATH directory." && false) + @bin/check_go_path gx_check: @bin/check_gx_program "gx" "0.3" 'Upgrade or install gx using your package manager or run `make gx_upgrade`' diff --git a/bin/check_go_path b/bin/check_go_path new file mode 100755 index 000000000..eb157e29b --- /dev/null +++ b/bin/check_go_path @@ -0,0 +1,20 @@ +#!/bin/sh + +if [ -z "$GOPATH" ]; then + echo "GOPATH not set, you must have go configured properly to install ipfs" + exit 1 +fi + +if ! type -f realpath > /dev/null; then + echo "program 'realpath' not found, it is required for this check" + exit 1 +fi + +PWD=$(pwd) +REALPWD=$(realpath "$PWD") +EXPECTED="$GOPATH/src/github.com/ipfs/go-ipfs" + +if [ "$REALPWD" != "$EXPECTED" ]; then + echo "go-ipfs must be built from within your \$GOPATH directory." + exit 1 +fi From aa6db5dde3c856d6f71027a5438fd3055da56c84 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 1 Mar 2016 11:24:01 -0800 Subject: [PATCH 4/5] use makes realpath so its more crossplatform License: MIT Signed-off-by: Jeromy --- Makefile | 2 +- bin/check_go_path | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d2f1bc5ca..5b8a5bf1c 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ gxgo_upgrade: go get -u github.com/whyrusleeping/gx-go path_check: - @bin/check_go_path + @bin/check_go_path $(realpath $(shell pwd)) gx_check: @bin/check_gx_program "gx" "0.3" 'Upgrade or install gx using your package manager or run `make gx_upgrade`' diff --git a/bin/check_go_path b/bin/check_go_path index eb157e29b..cc78615a5 100755 --- a/bin/check_go_path +++ b/bin/check_go_path @@ -1,20 +1,21 @@ #!/bin/sh +PWD=$1 + +if [ -z "$PWD" ]; then + echo "must pass in your current working directory" + exit 1 +fi + if [ -z "$GOPATH" ]; then echo "GOPATH not set, you must have go configured properly to install ipfs" exit 1 fi -if ! type -f realpath > /dev/null; then - echo "program 'realpath' not found, it is required for this check" - exit 1 -fi - -PWD=$(pwd) -REALPWD=$(realpath "$PWD") EXPECTED="$GOPATH/src/github.com/ipfs/go-ipfs" -if [ "$REALPWD" != "$EXPECTED" ]; then +if [ "$PWD" != "$EXPECTED" ]; then echo "go-ipfs must be built from within your \$GOPATH directory." + echo "expected '$EXPECTED' but got '$PWD'" exit 1 fi From 64c6943ae23bfa6df84c35be6ec3c030fd764e36 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Wed, 2 Mar 2016 10:10:04 -0800 Subject: [PATCH 5/5] remove trailing whitespace License: MIT Signed-off-by: Jeromy --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5b8a5bf1c..794697034 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ vendor: godep install: build cd cmd/ipfs && go install -ldflags=$(ldflags) -build: deps +build: deps cd cmd/ipfs && go build -i -ldflags=$(ldflags) nofuse: deps