From: Ian Jackson Subject: Re: [PATCH 5/5] make: Make "src-tarball" target actually make a source tarball Date: Wed, 16 Jul 2014 16:06:42 +0100 Message-ID: <21446.38146.96203.437720@mariner.uk.xensource.com> References: <1405354526-20929-1-git-send-email-george.dunlap@eu.citrix.com> <1405354526-20929-5-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: <1405354526-20929-5-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: George Dunlap Cc: Anthony Perard , Ian Campbell , Jan Beulich , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org George Dunlap writes ("[PATCH 5/5] make: Make "src-tarball" target actually make a source tarball"): > At the moment, making a release tarball is an annoyingly manual > process that involves running "git archive" into a temporary directory. ... > +src-tarball: subtree-update > + bash ./tools/misc/mktarball $(XEN_ROOT) $$(git describe) Does this absolutely have to depend on subtree-update ? Perhaps we need a new "make the subtrees exist" target ? > diff --git a/tools/misc/mktarball b/tools/misc/mktarball ... > +function finish { > + [[ -n "$tdir" ]] && rm -rf $tdir > +} The use of the POSIX syntax finish() { seems much more prevalent in-tree, than the use of `function'. > +trap finish EXIT The EXIT trap handler should probably `set +e'. > +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)" Why not use a fixed filename ? This script isn't safe for concurrent invocation anyway, because the output filename is (mostly) fixed. If you do that you can do away with the trap handler entirely. You should probably make git_archive_into delete the destination directory. > +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 No newline at end of file. Thanks, Ian.