[CRIU] [PATCH] make: Add snapshot target

Cyrill Gorcunov gorcunov at openvz.org
Thu Oct 5 19:30:50 MSK 2017


From: Cyrill Gorcunov <gorcunov at virtuozzo.com>

Sometimes for debug sake we need to build criu from source,
and setting up git on the target machine is not an option,
or due to network slow connection it takes too much time
to upload the whole history. just pack current HEAD into
a tarball.

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Makefile b/Makefile
index 796cad874da2..0a465473fc72 100644
--- a/Makefile
+++ b/Makefile
@@ -310,6 +310,14 @@ tar-name := $(shell echo $(head-name) | sed -e 's/^v//g')
 dist tar: criu-$(tar-name).tar.bz2 ;
 .PHONY: dist tar
 
+ifeq ($(filter-out snapshot,$(MAKECMDGOALS)),)
+snapshot-prefix := $(shell git describe --always --long)
+snapshot-file := criu-$(snapshot-prefix).tar.bz2
+endif
+snapshot:
+	git archive --format tar --prefix 'criu-$(snapshot-prefix)/' HEAD | bzip2 > $(snapshot-file)
+.PHONY: snapshot
+
 TAGS_FILES_REGEXP := . -name '*.[hcS]' ! -path './.*' \( ! -path './test/*' -o -path './test/zdtm/lib/*' \)
 tags:
 	$(call msg-gen, $@)
@@ -356,6 +364,7 @@ TAGS_FILES_REGEXP := . -name '*.[hcS]' ! -path './.*' \( ! -path './test/*' -o -
 	@echo '      install         - Install CRIU (see INSTALL.md)'
 	@echo '      uninstall       - Uninstall CRIU'
 	@echo '      dist            - Create a source tarball'
+	@echo '      snapshot        - Create a source tarball for current HEAD'
 	@echo '      clean           - Clean most, but leave enough to navigate'
 	@echo '      mrproper        - Delete all compiled/generated files'
 	@echo '      tags            - Generate tags file (ctags)'
-- 
2.7.5



More information about the CRIU mailing list