From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: [v3 for 4.5 2/2] make: Make "src-tarball" target actually make a source tarball Date: Mon, 15 Sep 2014 17:25:04 +0100 Message-ID: <1410798304-22636-2-git-send-email-george.dunlap@eu.citrix.com> References: <1410798304-22636-1-git-send-email-george.dunlap@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1410798304-22636-1-git-send-email-george.dunlap@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Olaf Hering , Ian Campbell , George Dunlap , Jan Beulich , Anthony Perard , Ian Jackson List-Id: xen-devel@lists.xenproject.org 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 --- 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 v3: * Use fixed filename for temporary directory * Make script "crash-only" * Include all subtrees, configured or not CC: Ian Campbell CC: Ian Jackson CC: Jan Beulich CC: Anthony Perard CC: Olaf Hering --- Makefile | 28 +++++++++++++++++++++------- tools/misc/mktarball | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 7 deletions(-) create mode 100755 tools/misc/mktarball diff --git a/Makefile b/Makefile index 2389057..3b9bf7a 100644 --- a/Makefile +++ b/Makefile @@ -143,6 +143,23 @@ subtree-force-update: subtree-force-update-all: $(MAKE) -C tools subtree-force-update-all +# 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-force-update-all + bash ./tools/misc/mktarball $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory) + +.PHONY: src-tarball +src-tarball: subtree-force-update-all + bash ./tools/misc/mktarball $(XEN_ROOT) $$(git describe) + .PHONY: clean clean:: $(MAKE) -C xen clean @@ -171,13 +188,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:' @@ -211,6 +221,10 @@ help: @echo ' install-tboot - download, build, and install the tboot module' @echo ' clean-tboot - clean the tboot module if it exists' @echo + @echo 'Package targets:' + @echo ' src-tarball-release - make a source tarball with xen and qemu tagged with a release' + @echo ' src-tarball - make a source tarball with xen and qemu tagged with git describe' + @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..bdc1c5a --- /dev/null +++ b/tools/misc/mktarball @@ -0,0 +1,38 @@ +#!/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 -ex + +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" + +tdir="$xen_root/dist/tmp.src-tarball" + +rm -rf $tdir + +mkdir -p $tdir + +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" -- 1.9.1