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

mk: add tarball support #4920

Merged
merged 1 commit into from
Apr 20, 2018
Merged
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ gx-workspace-update.json
bin/gx
bin/gx*
bin/tmp


vendor
.tarball
go-ipfs-source.tar.gz
2 changes: 2 additions & 0 deletions Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ TEST_SHORT :=
all: help # all has to be first defined target
.PHONY: all

include mk/git.mk # has to be before tarball.mk
include mk/tarball.mk
include mk/util.mk
include mk/golang.mk
include mk/gx.mk
Expand Down
22 changes: 22 additions & 0 deletions bin/maketarball.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# vim: set expandtab sw=2 ts=2:

# bash safe mode
set -euo pipefail
IFS=$'\n\t'


OUTPUT=$(realpath ${1:-go-ipfs-source.tar.gz})

TMPDIR="$(mktemp -d)"
NEWIPFS="$TMPDIR/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 &&
tar -czf "$OUTPUT" --exclude="./.git" .
)

rm -rf "$TMPDIR"
2 changes: 1 addition & 1 deletion cmd/ipfs/Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PATH := $(realpath $(d)):$(PATH)
# DEPS_OO_$(d) += merkledag/pb/merkledag.pb.go namesys/pb/namesys.pb.go
# DEPS_OO_$(d) += pin/internal/pb/header.pb.go unixfs/pb/unixfs.pb.go

$(d)_flags =-ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(shell git rev-parse --short HEAD)"
$(d)_flags =-ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(git-hash)"

$(d)-try-build $(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags)

Expand Down
1 change: 1 addition & 0 deletions mk/git.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git-commit:=$(shell git rev-parse --short HEAD 2>/dev/null)
3 changes: 3 additions & 0 deletions mk/gx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ gx-deps:
ifneq ($(IPFS_GX_USE_GLOBAL),1)
gx-deps: bin/gx bin/gx-go
endif
.PHONY: gx-deps

ifeq ($(tarball-is),0)
DEPS_GO += gx-deps
endif
13 changes: 13 additions & 0 deletions mk/tarball.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


ifeq (,$(wildcard .tarball))
tarball-is:=0
else
tarball-is:=1
# override git hash
git-hash:=$(shell cat .tarball)
endif


go-ipfs-source.tar.gz: distclean
bin/maketarball.sh $@