1
0
mirror of https://github.com/lxc/incus.git synced 2026-02-05 09:46:19 +01:00

Makefile: Rework "make dist"

This rework makes everything happen inside the temp directory, always
use the current HEAD of whatever git branch it's called from and doesn't
cause a re-download of the LXD tree.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
Stéphane Graber
2016-12-16 16:21:49 -05:00
parent 1c7104aecc
commit 77023591b5

View File

@@ -56,20 +56,29 @@ gccgo:
.PHONY: dist
dist:
# Cleanup
rm -Rf $(ARCHIVE).gz
# Create build dir
$(eval TMP := $(shell mktemp -d))
rm -Rf lxd-$(VERSION) $(ARCHIVE) $(ARCHIVE).gz
mkdir -p lxd-$(VERSION)/
-GOPATH=$(TMP) go get -t -v -d ./...
-GOPATH=$(TMP) go get -t -v -d ./...
-GOPATH=$(TMP) go get -t -v -d ./...
GOPATH=$(TMP) go get -t -v -d ./...
rm -rf $(TMP)/src/github.com/lxc/lxd
ln -s ../../../.. $(TMP)/src/github.com/lxc/lxd
mv $(TMP)/ lxd-$(VERSION)/dist
git archive --prefix=lxd-$(VERSION)/ --output=$(ARCHIVE) HEAD
tar -uf $(ARCHIVE) --exclude-vcs lxd-$(VERSION)/
gzip -9 $(ARCHIVE)
rm -Rf lxd-$(VERSION) $(ARCHIVE)
git archive --prefix=lxd-$(VERSION)/ HEAD | tar -x -C $(TMP)
mkdir -p $(TMP)/dist/src/github.com/lxc
ln -s ../../../../lxd-$(VERSION) $(TMP)/dist/src/github.com/lxc/lxd
# Download dependencies
-cd $(TMP)/lxd-$(VERSION) && GOPATH=$(TMP)/dist go get -t -v -d ./...
-cd $(TMP)/lxd-$(VERSION) && GOPATH=$(TMP)/dist go get -t -v -d ./...
-cd $(TMP)/lxd-$(VERSION) && GOPATH=$(TMP)/dist go get -t -v -d ./...
cd $(TMP)/lxd-$(VERSION) && GOPATH=$(TMP)/dist go get -t -v -d ./...
# Assemble tarball
rm $(TMP)/dist/src/github.com/lxc/lxd
ln -s ../../../../ $(TMP)/dist/src/github.com/lxc/lxd
mv $(TMP)/dist $(TMP)/lxd-$(VERSION)/
tar --exclude-vcs -C $(TMP) -zcf $(ARCHIVE).gz lxd-$(VERSION)/
# Cleanup
rm -Rf $(TMP)
.PHONY: i18n update-po update-pot build-mo static-analysis
i18n: update-pot