X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=id-deb-build%2Fmkdist.sh;h=40a99caa637dcef2389e158c66527ec8534eee4e;hb=7af2cd4eeeea3ee9b373457fd45f363f77073db8;hp=925d24997de17185148e5792ffc3102fde0af3a4;hpb=a6e87710f24e27778d8494f60c7815f4a87da8b0;p=git-tools-moved-to-github.git diff --git a/id-deb-build/mkdist.sh b/id-deb-build/mkdist.sh index 925d249..40a99ca 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 @@ -10,14 +15,14 @@ else fi #we will keep this to get the project name -DEBCHANGELOG=debian/changelog -l=`head -1 $DEBCHANGELOG` if [ "x$NAME" != x ]; then echo "Got name $NAME from IDMETA file" +elif test -f debian/control; then + NAME=`awk '/Source:/ {print $2}' debian/control` + echo "Warning: assuming name $NAME from debian/control" else - NAME=`echo $l|sed 's/ .*//g'` - echo "Warning: assuming name $NAME from debian/changelog" + die "No debian/control and no NAME in IDMETA" fi if [ "x$2" != x ]; then @@ -28,9 +33,9 @@ fi if [ "x$VERSION" != x ]; then echo "Got version $VERSION from IDMETA file" else - FULLVERSION=`echo $l|sed 's/.*(//g'|sed 's/).*//g'` + FULLVERSION=`head -1 $DEBCHANGELOG|sed 's/.*(//g'|sed 's/).*//g'` VERSION=`echo $FULLVERSION|sed 's/-.*//g'` - echo "Warning: assuming version $VERSION from debian/changelog" + echo "Warning: assuming version $VERSION from $DEBCHANGELOG" fi if [ "x$1" != x ]; then @@ -38,12 +43,31 @@ if [ "x$1" != x ]; then VERSION=$1 fi -git archive --format=tar --prefix=$NAME-$VERSION/ v${VERSION} > tmp.tar || die "This version is not tagged in Git"; +trap 'rm -f tmp.tar' 0 + +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 - echo "Omitting $file from distribution" - rm -r $NAME-$VERSION/$file + if [ -e "$file" ]; then + echo "Omitting $file from distribution" + rm -rf $NAME-$VERSION/$file + fi done tar cfz $NAME-$VERSION.tar.gz $NAME-$VERSION -rm -r $NAME-$VERSION +rm -rf $NAME-$VERSION