-
Notifications
You must be signed in to change notification settings - Fork 84
/
maketarball
executable file
·80 lines (67 loc) · 2.14 KB
/
maketarball
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
#!/bin/bash
# usage: maketarball
# maketarball <branch>
# maketarball <tag>
#
# With no arguments, this creates a source tarball from git master with a
# filename based on today's date.
#
# With a <branch> argument, this creates a tarball of the branch.
#
# With a <tag> argument, this creates a tarball of the tag.
#
# Examples:
#
# ./maketarball
# ./maketarball Miro-2.5
# ./maketarball v2.5.2
NOWDATE=`date "+%Y-%m-%d"`
if [ -z "$1" ]
then
BRANCH=master
PREFIX="miro-$NOWDATE-$BRANCH"
else
BRANCH=$1
PREFIX="miro-$BRANCH"
fi
# convert PREFIX to all lowercase.
# rename miro-miro- (branch names) to something more palatable
# nix the v from tag names.
PREFIX=`echo "$PREFIX" | tr '[A-Z]' '[a-z]' | sed s/miro-miro-/miro-$NOWDATE-Miro-/ | sed s/v//`
echo "== BRANCH $BRANCH"
echo "== PREFIX $PREFIX"
rm -rf temp-miro
git archive --format=tar $BRANCH tv > miro.tar
mkdir temp-miro
mv miro.tar temp-miro
cd temp-miro
tar -xvf miro.tar
if [ -e tv ]
then
echo "checkout successful."
else
echo "ERROR: checkout failed--see above for details."
exit $?;
fi
cd tv
# go through app.config.template and expand the revision-related properties
cd resources
REVISION_NUM=`git rev-parse --short=8 "$BRANCH"`
REVISION_URL=`git config --list | grep remote.origin.url | sed s/remote.origin.url=//`
REVISION="$REVISION_URL - $REVISION_NUM"
# this looks awful, but it just replaces / with \/
REVISION_NUM_ESCAPED=`echo $REVISION_NUM | sed "s/\\\\//\\\\\\\\\\\\//g"`
REVISION_URL_ESCAPED=`echo $REVISION_URL | sed "s/\\\\//\\\\\\\\\\\\//g"`
REVISION_ESCAPED=`echo $REVISION | sed "s/\\\\//\\\\\\\\\\\\//g"`
cat < app.config.template | sed "s/^appRevisionNum .*$/appRevisionNum = $REVISION_NUM_ESCAPED/;s/^appRevisionURL .*$/appRevisionURL = $REVISION_URL_ESCAPED/;s/^appRevision .*$/appRevision = $REVISION_ESCAPED/" > app.config.template2
mv app.config.template2 app.config.template
cd ..
cd ..
# remove files that shouldn't be distributed
rm tv/platform/windows-xul/askBarSetup-4.1.0.2.exe
rm tv/platform/windows-xul/ask_toolbar.bmp
mv tv "$PREFIX"
tar -zcvf "$PREFIX.tar.gz" "$PREFIX"
mv "$PREFIX.tar.gz" ..
cd ..
rm -Rf temp-miro