forked from ceph/autobuild-ceph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-ceph.sh
executable file
·80 lines (68 loc) · 2.24 KB
/
build-ceph.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
75
76
77
78
79
80
#!/bin/sh -x
set -e
echo --START-IGNORE-WARNINGS
[ ! -x autogen.sh ] || ./autogen.sh || exit 1
autoconf || true
echo --STOP-IGNORE-WARNINGS
[ ! -x configure ] || ./configure --with-debug --with-radosgw --with-fuse --with-tcmalloc --with-libatomic-ops --with-gtk2 || exit 2
if [ ! -e Makefile ]; then
echo "$0: no Makefile, aborting." 1>&2
exit 3
fi
# Actually build the project
# clear out any $@ potentially passed in
set --
# enable ccache if it is installed
export CCACHE_DIR="$PWD/../../ccache"
if command -v ccache >/dev/null; then
if [ ! -e "$CCACHE_DIR" ]; then
echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2
else
set -- CC='ccache gcc' CXX='ccache g++'
fi
else
echo "$0: no ccache found, compiles will be slower." 1>&2
fi
ionice -c3 nice -n20 make -j16 "$@" || exit 4
# The "make -q check" probe in build.sh.example is faulty in that
# screwups in Makefiles make it think there are no unit tests to
# run. That's unacceptable; use a dumber probe.
if [ -e src/gtest ]; then
# run "make check", but give it a time limit in case a test gets stuck
../maxtime 1800 ionice -c3 nice -n20 make check "$@" || exit 5
fi
REV="$(git rev-parse HEAD)"
OUTDIR="../out/output/sha1/$REV"
OUTDIR_TMP="${OUTDIR}.tmp"
install -d -m0755 -- "$OUTDIR_TMP"
printf '%s\n' "$REV" >"$OUTDIR_TMP/sha1"
MACH="$(uname -m)"
INSTDIR="inst.tmp"
[ ! -e "$INSTDIR" ]
../maxtime 1800 ionice -c3 nice -n20 make install DESTDIR="$PWD/$INSTDIR"
tar czf "$OUTDIR_TMP/ceph.$MACH.tgz" -C "$INSTDIR" .
rm -rf -- "$INSTDIR"
# put our temp files inside .git/ so ls-files doesn't see them
git ls-files --modified >.git/modified-files
if [ -s .git/modified-files ]; then
rm -rf "$OUTDIR_TMP"
echo "error: Modified files:" 1>&2
cat .git/modified-files 1>&2
exit 6
fi
git ls-files --exclude-standard --others >.git/added-files
if [ -s .git/added-files ]; then
rm -rf "$OUTDIR_TMP"
echo "error: Added files:" 1>&2
cat .git/added-files 1>&2
exit 7
fi
# we're successful, the files are ok to be published; try to be as
# atomic as possible about replacing potentially existing OUTDIR
if [ -e "$OUTDIR" ]; then
rm -rf -- "$OUTDIR.old"
mv -- "$OUTDIR" "$OUTDIR.old"
fi
mv -- "$OUTDIR_TMP" "$OUTDIR"
rm -rf -- "$OUTDIR.old"
exit 0