4 if [ ! -e Makefile ]; then
5 echo "$0: no Makefile, aborting." 1>&2
9 # Actually build the project
11 # clear out any $@ potentially passed in
14 # enable ccache if it is installed
15 export CCACHE_DIR="$PWD/../../ccache"
16 if command -v ccache >/dev/null; then
17 if [ ! -e "$CCACHE_DIR" ]; then
18 echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2
20 set -- CC='ccache gcc' CXX='ccache g++'
23 echo "$0: no ccache found, compiles will be slower." 1>&2
26 flavor=`hostname | sed -e "s|gitbuilder-\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)$|\5|"`
27 config="../../kernel-config-deb.$flavor"
28 if [ ! -e "$config" ]; then
29 echo "no $config found for flavor $flavor"
33 install -d -m0755 build~/out
35 # we really need this to get the packages the way we want them, so just enforce it here
36 grep -v '^CONFIG_LOCALVERSION_AUTO=' $config
37 echo 'CONFIG_LOCALVERSION_AUTO=y'
40 echo "$0: new kernel config options:"
41 # listnewconfig was contained in v2.6.36, but it seems out/ignore/*
42 # doesn't work quite right to ignore everything before that, so
43 # instead just ignore errors coming from it
44 ionice -c3 nice -n20 make O=build~/out listnewconfig "$@" || :
46 echo "$0: running make oldconfig..."
47 yes '' | ionice -c3 nice -n20 make O=build~/out oldconfig "$@"
49 #echo "$0: applying perf.patch..."
50 #patch -p1 < ../../perf.patch
52 echo "$0: building..."
53 # build dir has ~ suffix so it gets ignored by git and doesn't make
54 # the source tree look modified (get "+" in version); using subdir out
55 # so the debs go to e.g.
56 # build~/linux-image-2.6.38-ceph-00020-g4b2a58a_ceph_amd64.deb
58 NCPU=$(( 2 * `grep -c processor /proc/cpuinfo` ))
59 ionice -c3 nice -n20 make O=build~/out LOCALVERSION=-ceph deb-pkg -j$NCPU "$@" || exit 4
61 REV="$(git rev-parse HEAD)"
62 OUTDIR="../out/output/sha1/$REV"
63 OUTDIR_TMP="${OUTDIR}.tmp"
64 install -d -m0755 -- "$OUTDIR_TMP"
65 printf '%s\n' "$REV" >"$OUTDIR_TMP/sha1"
66 mv -- build~/*.deb "$OUTDIR_TMP/"
67 cp -- build~/out/.config $OUTDIR_TMP/config
68 cp -- build~/out/include/config/kernel.release $OUTDIR_TMP/version
70 # build a simple repro in OUTDIR_TMP too
71 DIST="squeeze" # this could be anything
75 install -d -m0755 -- "conf"
76 cat > conf/distributions <<EOF
80 Architectures: i386 amd64 source
81 Origin: New Dream Network
82 Description: Kernel autobuilds
83 DebIndices: Packages Release . .gz .bz2
84 DscIndices: Sources Release .gz .bz2
87 for f in image headers;
89 reprepro -b . includedeb $DIST linux-$f-*.deb
91 # make a consistently named symlink
92 normal=`ls linux-$f-*.deb | grep -v -- -dbg`
93 ln -s $normal linux-$f.deb
95 dbg=`ls linux-$f-*.deb | grep -- -dbg || true`
96 if [ -n "$dbd" ]; then
97 ln -s $dbg linux-$f-dbg.deb
102 # we're successful, the files are ok to be published; try to be as
103 # atomic as possible about replacing potentially existing OUTDIR
104 if [ -e "$OUTDIR" ]; then
105 rm -rf -- "$OUTDIR.old"
106 mv -- "$OUTDIR" "$OUTDIR.old"
108 mv -- "$OUTDIR_TMP" "$OUTDIR"
109 rm -rf -- "$OUTDIR.old"