forked from gitonomy/gitlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-git-versions.sh
executable file
·74 lines (61 loc) · 1.55 KB
/
test-git-versions.sh
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
#!/bin/bash
set -e
URL="git@github.com:git/git.git"
VERSIONS="v1.6.3 v1.6.6 v1.7.1 v1.7.5 v1.7.9 v1.8.1"
DIRNAME="git-builds"
if [ ! -d "$DIRNAME" ]; then
mkdir - "$DIRNAME"
fi
cd "$DIRNAME"
# remote repository
if [ -d cache ]; then
echo "- update from github..."
cd cache
git fetch -q
cd ..
else
echo "- clone from github..."
git clone "$URL" cache -q
fi
# build
for VERSION in $VERSIONS; do
echo "- build $VERSION"
LOGFILE="build.$VERSION.log"
LOCKFILE="build.$VERSION.lock"
if [ -f "$LOCKFILE" ]; then
echo " - lock present, destroy build..."
rm -rf "$VERSION" "build.$VERSION.log"
fi
if [ -d "$VERSION" ]; then
echo " - already built, skipping..."
continue
fi
touch "$LOCKFILE"
echo " - log: $LOGFILE"
touch "$LOGFILE"
mkdir "$VERSION"
echo " - clone repository"
git clone -s cache "$VERSION/source" -q
echo " - checkout version"
cd "$VERSION/source"
git checkout "$VERSION" -q
mkdir ../build
PREFIX="`readlink -f ../build`"
echo " - build..."
autoconf >> "../../$LOGFILE" 2>&1
./configure --prefix="$PREFIX" >> "../../$LOGFILE" 2>&1
make all >> "../../$LOGFILE" 2>&1
make install >> "../../$LOGFILE" 2>&1
echo " - build ok"
cd ../..
rm "$LOCKFILE"
done
cd ..
# test
echo ""
for VERSION in $VERSIONS; do
echo "- test $VERSION"
GIT_COMMAND="`readlink -f $DIRNAME/$VERSION/build/bin/git`"
echo " - command: $GIT_COMMAND"
GIT_COMMAND="$GIT_COMMAND" phpunit || true
done