From ae26578d6d7d98c190dbe2b9b8c4db1c0c4df303 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Thu, 12 Jul 2012 13:23:45 +0100 Subject: [PATCH] Add new -l (local) command-line option to mkdist.sh Generates tarball from local checkout rather than git tag. Useful when you want to experiment with changes to files involved in the building process, such as Makefile.PL, without making a new git commit+tag each time. --- id-deb-build/mkdist.sh | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/id-deb-build/mkdist.sh b/id-deb-build/mkdist.sh index 473013e..2aa0d5a 100755 --- a/id-deb-build/mkdist.sh +++ b/id-deb-build/mkdist.sh @@ -3,6 +3,11 @@ die () { exit 1 } +if [ "x$1" = x-l ]; then + localFiles=t + shift +fi + if test -f IDMETA; then . ./IDMETA else @@ -38,14 +43,30 @@ if [ "x$1" != x ]; then fi trap 'rm -f tmp.tar' 0 -git archive --format=tar --prefix=$NAME-$VERSION/ v${VERSION} > tmp.tar || die "This version is not tagged in Git"; + +if [ -n "$localFiles" ]; then + echo "WARNING: using local files rather than git tag" >&2 + echo "This is fine for testing, but should not be used for releases " >&2 + pwd=`pwd` + dir=`basename "$pwd"` + cd .. + cp -a "$dir" $NAME-$VERSION + rm -rf $NAME-$VERSION/.git + tar cf "$pwd"/tmp.tar $NAME-$VERSION + rm -rf $NAME-$VERSION + cd "$dir" +else + echo "from git" + git archive --format=tar --prefix=$NAME-$VERSION/ v${VERSION} > tmp.tar || die "This version is not tagged in Git"; +fi + tar xf tmp.tar rm tmp.tar for file in debian $OMIT_FROM_DIST; do if [ -e "$file" ]; then echo "Omitting $file from distribution" - rm -r $NAME-$VERSION/$file + rm -rf $NAME-$VERSION/$file fi done tar cfz $NAME-$VERSION.tar.gz $NAME-$VERSION -rm -r $NAME-$VERSION +rm -rf $NAME-$VERSION -- 1.7.10.4