mk: fix maketarball to work with gomod

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera 2019-03-13 23:05:48 +01:00
parent 245c40b8fd
commit a6053d631a
2 changed files with 13 additions and 11 deletions

View File

@ -8,19 +8,17 @@ IFS=$'\n\t'
# readlink doesn't work on macos
OUTPUT="${1:-go-ipfs-source.tar.gz}"
if ! [[ "$OUTPUT" = /* ]]; then
OUTPUT="$PWD/$OUTPUT"
OUTPUT="$PWD/$OUTPUT"
fi
TMPDIR="$(mktemp -d)"
NEWIPFS="$TMPDIR/src/github.com/ipfs/go-ipfs"
mkdir -p "$NEWIPFS"
cp -r . "$NEWIPFS"
( cd "$NEWIPFS" &&
echo $PWD &&
GOPATH="$TMPDIR" gx install --local &&
(git rev-parse --short HEAD || true) > .tarball &&
chmod -R u=rwX,go=rX "$NEWIPFS" # normalize permissions
tar -czf "$OUTPUT" --exclude="./.git" .
)
cp -r . "$TMPDIR"
( cd "$TMPDIR" &&
echo $PWD &&
go mod vendor &&
(git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || true) > .tarball &&
chmod -R u=rwX,go=rX "$TMPDIR" # normalize permissions
tar -czf "$OUTPUT" --exclude="./.git" .
)
rm -rf "$TMPDIR"

View File

@ -10,6 +10,10 @@ unexport GOFLAGS
GOFLAGS ?=
GOTFLAGS ?=
ifeq ($(tarball-is),1)
GOFLAGS += -mod=vendor
endif
# match Go's default GOPATH behaviour
export GOPATH ?= $(shell $(GOCC) env GOPATH)