The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/249

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
From 3721b86fb1a932c35d7020cc2b4de27b948b29a2 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.h...@canonical.com>
Date: Mon, 21 Oct 2019 09:01:45 +0200
Subject: [PATCH] Makefile: Add dist target

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
---
 Makefile | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 11fea26..98e4b7c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,7 @@
-.PHONY: default check
+VERSION=$(shell grep "var Version" shared/version/version.go | cut -d'"' -f2)
+ARCHIVE=distrobuidler-$(VERSION).tar
+
+.PHONY: default check dist
 
 default:
        gofmt -s -w .
@@ -13,3 +16,28 @@ check: default
        golint -set_exit_status ./...
        deadcode ./
        go vet ./...
+
+dist:
+       # Cleanup
+       rm -Rf $(ARCHIVE).gz
+
+       # Create build dir
+       $(eval TMP := $(shell mktemp -d))
+       git archive --prefix=distrobuilder-$(VERSION)/ HEAD | tar -x -C $(TMP)
+       mkdir -p $(TMP)/_dist/src/github.com/lxc
+       ln -s ../../../../distrobuilder-$(VERSION) 
$(TMP)/_dist/src/github.com/lxc/distrobuilder
+
+       # Download dependencies
+       cd $(TMP)/distrobuilder-$(VERSION) && GOPATH=$(TMP)/_dist go get -t -v 
-d ./...
+
+       # Write a manifest
+       cd $(TMP)/_dist && find . -type d -name .git | while read line; do 
GITDIR=$$(dirname $$line); echo "$${GITDIR}: $$(cd $${GITDIR} && git show-ref 
HEAD $${GITDIR} | cut -d' ' -f1)"; done | sort > $(TMP)/_dist/MANIFEST
+
+       # Assemble tarball
+       rm $(TMP)/_dist/src/github.com/lxc/distrobuilder
+       ln -s ../../../../ $(TMP)/_dist/src/github.com/lxc/distrobuilder
+       mv $(TMP)/_dist $(TMP)/distrobuilder-$(VERSION)/
+       tar --exclude-vcs -C $(TMP) -zcf $(ARCHIVE).gz distrobuilder-$(VERSION)/
+
+       # Cleanup
+       rm -Rf $(TMP)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to