Parent: [020af3] (diff)

Child: [dbdbde] (diff)

Download this file

makesrcdist.sh    123 lines (100 with data), 2.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh
# A shell-script to make an upplay source distribution. qmake is not
# too good at this...
fatal() {
echo $*
exit 1
}
usage() {
echo 'Usage: makescrdist.sh -t -s do_it'
echo ' -t : no tagging'
echo ' -s : snapshot release: use date instead of VERSION'
echo ' -s implies -t'
exit 1
}
create_tag() {
git tag -f -a $1 -m "Release $1 tagged" || fatal tag failed
}
test_tag() {
git tag -l | egrep '^'$1'$'
}
#set -x
TAR=${TAR-/bin/tar}
if test ! -f upplay.cpp;then
echo "Should be executed in the master upplay directory"
exit 1
fi
targetdir=${targetdir-/tmp}
dotag=${dotag-yes}
snap=${snap-no}
while getopts ts o
do case "$o" in
t) dotag=no;;
s) snap=yes;dotag=no;;
[?]) usage;;
esac
done
shift `expr $OPTIND - 1`
test $dotag = "yes" -a $snap = "yes" && usage
test $# -eq 1 || usage
echo dotag $dotag snap $snap
if test $snap = yes ; then
version=`date +%F_%H-%M-%S`
TAG=""
else
version=`egrep ^VERSION upplay.pro | cut -d'=' -f 2`
# trim whitespace
version=`echo $version | xargs`
TAG="UPPLAY_$version"
fi
if test "$dotag" = "yes" ; then
echo Creating AND TAGGING version $version
test_tag $TAG && fatal "Tag $TAG already exists"
else
echo Creating version $version, no tagging
fi
sleep 2
editedfiles="`git status -s |\
egrep -v 'makesrcdist.sh|excludefile|manifest.txt'`"
if test "$dotag" = "yes" -a ! -z "$editedfiles"; then
fatal "Edited files exist: " $editedfiles
fi
if test $dotag = yes ; then
releasename=upplay-$version
else
releasename=betaupplay-$version
fi
topdir=$targetdir/$releasename
if test ! -d $topdir ; then
mkdir $topdir || exit 1
else
echo "Removing everything under $topdir Ok ? (y/n)"
read rep
if test $rep = 'y';then
rm -rf $topdir/*
fi
fi
# Clean up this dir and copy the dist-specific files
make distclean
yes | clean.O
rm -f lib/*.dep
rm -f upplay qrc_upplay.cpp
$TAR chfX - excludefile . | (cd $topdir;$TAR xf -)
if test $snap = "yes" ; then
sed -e "/^VERSION/cVERSION=$version" $topdir/upplay.pro > $topdir/toto
mv -f $topdir/toto $topdir/upplay.pro
fi
# Can't now put ./Makefile in excludefile, gets ignored everywhere. So delete
# the top Makefile here (its' output by configure on the target system):
rm -f $topdir/Makefile
out=$releasename.tar.gz
(cd $targetdir ; \
$TAR chf - $releasename | \
gzip > $out)
echo "$targetdir/$out created"
# Check manifest against current reference
export LC_ALL=C
tar tzf $targetdir/$out | sort | cut -d / -f 2- | \
diff manifest.txt - || fatal "Please fix file list manifest.txt"
# We tag .. as there is the 'packaging/' directory in there
[ $dotag = "yes" ] && create_tag $TAG