1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-05-17 06:57:40 +08:00

fix vendoring dependencies when building the source tarball

TMPDIR is a special variable indicating the _system_ temporary directory root.
Unfortunately, go refuses to honor `go.mod` files in this directory to prevent
random `/tmp/go.mod` files from messing with modules cloned into `/tmp`.

The fix is simple: rename TMPDIR to TEMP.
This commit is contained in:
Steven Allen
2019-05-17 12:34:11 -07:00
parent f72be19a90
commit 8d857bab3e

View File

@ -13,14 +13,14 @@ fi
GOCC=${GOCC=go}
TMPDIR="$(mktemp -d)"
cp -r . "$TMPDIR"
( cd "$TMPDIR" &&
TEMP="$(mktemp -d)"
cp -r . "$TEMP"
( cd "$TEMP" &&
echo $PWD &&
$GOCC mod vendor &&
(git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || true) > .tarball &&
chmod -R u=rwX,go=rX "$TMPDIR" # normalize permissions
chmod -R u=rwX,go=rX "$TEMP" # normalize permissions
tar -czf "$OUTPUT" --exclude="./.git" .
)
rm -rf "$TMPDIR"
rm -rf "$TEMP"