xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xen.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Ian Jackson <ian.jackson@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Anthony Perard <anthony.perard@citrix.com>
Subject: [PATCH 5/5] make: Make "src-tarball" target actually make a source tarball
Date: Mon, 14 Jul 2014 17:15:26 +0100	[thread overview]
Message-ID: <1405354526-20929-5-git-send-email-george.dunlap@eu.citrix.com> (raw)
In-Reply-To: <1405354526-20929-1-git-send-email-george.dunlap@eu.citrix.com>

At the moment, making a release tarball is an annoyingly manual
process that involves running "git archive" into a temporary directory.

Script this process up and make a target, so that the release manager
can simply type "make src-tarball-release" and have everything show up
nice and neat in dist/xen-$version.tar.gz.  "make src-tarball" will
make a version number based on git describe, which will typically have
the most recent tag, number of commits since that tag, and the git
commit id of the current HEAD.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

---

v2:
* Put quotes around assignments with variables in them
* Avoid pushd/popd
* Get rid of unnecessary error checks (since set -e will take care of it)
* Make a function to do the git archive
* Add "src-tarball-release" to do a clean version (e.g., 4.4.1)
* "src-tarball" will name it based on "git describe" (includes a short commit hash).
* Add mkdir -p $xen_root/dist/ to the script so that it works on a freshly cloned tree

CC: Ian Campbell <ian.campbell@citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Anthony Perard <anthony.perard@citrix.com>
---
 Makefile             |   27 ++++++++++++++++++++-------
 tools/misc/mktarball |   42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 7 deletions(-)
 create mode 100755 tools/misc/mktarball

diff --git a/Makefile b/Makefile
index b804bcf..28fecab 100644
--- a/Makefile
+++ b/Makefile
@@ -139,6 +139,23 @@ rpmball: dist
 subtree-update:
 	$(MAKE) -C tools subtree-update
 
+# Make a source tarball, including qemu sub-trees.
+#
+# src-tarball will use "git describe" for the version number.  This
+# will have the most recent tag, number of commits since that tag, and
+# git commit id of the head.  This is suitable for a "snapshot"
+# tarball of an unreleased tree.
+#
+# src-tarball-release will use "make xenversion" as the version
+# number.  This is suitable for release tarballs.
+.PHONY: src-tarball-release
+src-tarball-release: subtree-update
+	bash ./tools/misc/mktarball $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
+
+.PHONY: src-tarball
+src-tarball: subtree-update
+	bash ./tools/misc/mktarball $(XEN_ROOT) $$(git describe)
+
 .PHONY: clean
 clean::
 	$(MAKE) -C xen clean
@@ -167,13 +184,6 @@ endif
 .PHONY: mrproper
 mrproper: distclean
 
-# Prepare for source tarball
-.PHONY: src-tarball
-src-tarball: distclean
-	$(MAKE) -C xen .banner
-	rm -rf xen/tools/figlet .[a-z]*
-	$(MAKE) -C xen distclean
-
 .PHONY: help
 help:
 	@echo 'Installation targets:'
@@ -206,6 +216,9 @@ help:
 	@echo '  install-tboot    - download, build, and install the tboot module'
 	@echo '  clean-tboot      - clean the tboot module if it exists'
 	@echo
+	@echo 'Tarball targets:'
+	@echo '  src-tarball      - make a source tarball with xen and qemu suitable for a release'
+	@echo
 	@echo 'Environment:'
 	@echo '  [ this documentation is sadly not complete ]'
 
diff --git a/tools/misc/mktarball b/tools/misc/mktarball
new file mode 100755
index 0000000..06102eb
--- /dev/null
+++ b/tools/misc/mktarball
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# mktarball: Make a release tarball (including xen, qemu, and qemu-traditional)
+#
+# Takes 2 arguments, the path to the dist directory and the version
+
+set -e
+
+function finish {
+    [[ -n "$tdir" ]] && rm -rf $tdir
+}
+trap finish EXIT
+
+function git_archive_into {
+    mkdir "$2"
+
+    git --git-dir="$1"/.git \
+	archive --format=tar HEAD | \
+	tar Cxf "$2" - 
+}
+
+if [[ -z "$1" || -z "$2" ]] ; then
+  echo "usage: $0 path-to-XEN_ROOT xen-version"
+  exit 1
+fi
+
+xen_root="$1"
+desc="$2"
+
+mkdir -p $xen_root/dist/
+
+tdir="$(mktemp -d $xen_root/dist/xen.XXXXXXXX)"
+
+git_archive_into $xen_root $tdir/xen-$desc
+
+git_archive_into $xen_root/tools/qemu-xen-dir-remote $tdir/xen-$desc/tools/qemu-xen
+
+git_archive_into $xen_root/tools/qemu-xen-traditional-dir-remote $tdir/xen-$desc/tools/qemu-xen-traditional
+
+GZIP=-9v tar cz -f $xen_root/dist/xen-$desc.tar.gz -C $tdir xen-$desc
+
+echo "Source tarball in $xen_root/dist/xen-$desc.tar.gz"
\ No newline at end of file
-- 
1.7.9.5

  parent reply	other threads:[~2014-07-14 16:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 16:15 [PATCH 1/5] make: Check tools/qemu-xen[-traditional] for qemu before downloading George Dunlap
2014-07-14 16:15 ` [PATCH 2/5] make: Normalize config options for external trees George Dunlap
2014-07-16  8:58   ` Ian Campbell
2014-07-16 14:53   ` Ian Jackson
2014-07-21 10:22   ` Olaf Hering
2014-07-21 10:28     ` George Dunlap
2014-07-21 10:44       ` Olaf Hering
2014-07-21 10:46         ` George Dunlap
2014-07-21 10:49       ` Olaf Hering
2014-07-14 16:15 ` [PATCH 3/5] make: Make *-dir-force-update depend on *-dir-find George Dunlap
2014-07-16 14:53   ` Ian Jackson
2014-07-14 16:15 ` [PATCH 4/5] make: Add subtree-update target George Dunlap
2014-07-16  9:00   ` Ian Campbell
2014-07-16 14:54   ` Ian Jackson
2014-07-14 16:15 ` George Dunlap [this message]
2014-07-16 15:06   ` [PATCH 5/5] make: Make "src-tarball" target actually make a source tarball Ian Jackson
2014-07-16 16:56     ` Ian Campbell
2014-07-16 17:45       ` George Dunlap
2014-07-17  9:21         ` Ian Campbell
2014-07-17 16:46     ` George Dunlap
2014-07-18 10:45       ` Ian Jackson
2014-09-15 15:42       ` George Dunlap
2014-09-15 15:46         ` Ian Jackson
2014-07-16  9:02 ` [PATCH 1/5] make: Check tools/qemu-xen[-traditional] for qemu before downloading Ian Campbell
2014-07-16 14:50 ` Ian Jackson
2014-07-18 12:39 ` Ian Campbell
2014-07-23 10:52 ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405354526-20929-5-git-send-email-george.dunlap@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).