forked from sagemath/sage-patchbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spkg-dist
executable file
·52 lines (43 loc) · 1.01 KB
/
spkg-dist
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
#/bin/bash
if [ $# -ge 1 ]; then
VERSION=$1
else
VERSION="UNCOMMITTED"
fi
if [ ! -e .git ]; then
echo "Must be called from the git repository."
echo
echo "git clone git://github.com/sagemath/sage-patchbot.git"
exit 1
fi
rm -rf workspace-*
TMP=$(mktemp -d workspace-XXXXXX)
ORIGINAL=$(pwd)
git diff --stat
if [ "$VERSION" == "UNCOMMITTED" ]; then
git diff > $TMP/uncommitted.patch
HEAD=$(git rev-parse HEAD)
else
HEAD=$(git rev-parse $VERSION)
if [ "$?" -ne "0" ]; then
echo "Unknown tag or commit: $VERSION"
exit 1
fi
fi
# Clone the repo.
cd $TMP
git clone $ORIGINAL patchbot-$VERSION
cd patchbot-$VERSION
if [ -e "../uncommitted.patch" ]; then
patch -p1 < ../uncommitted.patch
fi
# Format as an spkg.
rm -rf .git*
rm -rf .hg*
mv README.* sage_patchbot
echo $VERSION > sage_patchbot/version.txt
# sage -pkg patchbot-$VERSION
tar --auto-compress --create --file=patchbot-$VERSION.tar.bz2 sage_patchbot
cp patchbot-$VERSION.tar.bz2 $ORIGINAL
cd $ORIGINAL
rm -rf $TMP