This repository was archived by the owner on Mar 22, 2022. It is now read-only.
forked from apenwarr/gitbuilder
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathautobuilder.sh
More file actions
executable file
·62 lines (55 loc) · 1.41 KB
/
autobuilder.sh
File metadata and controls
executable file
·62 lines (55 loc) · 1.41 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
#!/bin/bash
DIR="$(dirname $0)"
cd "$DIR"
if [ ! -d build/. ]; then
echo >&2
echo "We need a directory named build/ in this directory." >&2
echo "You should 'git clone' the project you want to test," >&2
echo "like this:" >&2
echo >&2
echo " git clone /path/to/myproject.git build" >&2
echo >&2
exit 2
fi
if [ -e build.sh -a ! -x build.sh ]; then
chmod a+x build.sh
fi
if [ ! -x build.sh ]; then
echo >&2
echo "We need an executable file named build.sh in this directory" >&2
echo "in order to run the autobuilder." >&2
echo >&2
echo "Try copying build.sh.example as a starting point." >&2
echo >&2
exit 1
fi
mkdir -p out/pass out/fail out/ignore out/errcache
chmod a+w out/errcache
did_something=1
while [ -n "$did_something" ]; do
( cd build &&
git remote show | timeout 60 xargs git remote prune &&
timeout 60 git remote update )
did_something=
for branch in $(./branches.sh); do
ref=$(./next-rev.sh $branch)
if [ -z "$ref" ]; then
echo "$branch: already up to date."
continue;
fi
if [ -e "out/pass/$ref" -o -e "out/fail/$ref" ]; then
echo "$branch: weird, already built $ref!"
continue
fi
did_something=1
echo "Building $branch: $ref"
set -m
./runtee out/log ./run-build.sh $ref &
XPID=$!
trap "echo 'Killing (SIGINT)'; kill -TERM -$XPID; exit 1" SIGINT
trap "echo 'Killing (SIGTERM)'; kill -TERM -$XPID; exit 1" SIGTERM
wait; wait
done
sleep 5
done
exit 0