ccache_stats() {
if [ -e $BASEDIR/ccache ]; then
- PATH=$PATH:build_${MACHINE}/tools_${MACHINE}/usr/bin \
+ PATH=$PATH:build_${TARGET}/${TOOLS_DIR}/usr/bin \
CCACHE_DIR=${BASEDIR}/ccache \
ccache -s
else
distcc_mon() {
+ # run gnome thing if we can...
+ if [ -n "$DISPLAY" ]; then
+ monitor=$(which distccmon-gnome 2>/dev/null)
+ if [ -n "$monitor" ]; then
+ DISTCC_DIR=$BASEDIR/distcc $monitor &
+ return 0
+ fi
+ fi
+
INTERVAL=1 # in seconds
if [ -e $BASEDIR/distcc ]; then
clear
echo "$NAME - Distcc monitor - Cancel with ctrl+c"
echo
- PATH=$PATH:build_${MACHINE}/tools_${MACHINE}/usr/bin \
+ PATH=$PATH:build_${TARGET}/${TOOLS_DIR}/usr/bin \
DISTCC_DIR=${BASEDIR}/distcc \
distccmon-text
done
distccd_start() {
echo -n "Running distcc daemon"
- TOOLS_DIR=$TOOLS_DIR $BASEDIR/tools/make-compilers &
+
+ if [ "$DISTCC_PORT" == "0" ]; then
+ beautify message DISA
+ return
+ fi
+
+ TOOLS_DIR=$TOOLS_DIR DISTCC_PORT=$DISTCC_PORT DISTCC_JOBS=$DISTCC_JOBS \
+ LOGFILE=$BASEDIR/log_${TARGET}/_build.00-distccd.log \
+ $BASEDIR/tools/make-compilers &
if [ "$?" -eq "0" ]; then
beautify message DONE
else
}
distccd_stop() {
- echo "Stopping distcc daemon"
- killall distccd
+ echo -n "Stopping distcc daemon"
+ killall distccd &>/dev/null
if [ "$?" -eq "0" ]; then
beautify message DONE
else
fi
}
+distccd_restart() {
+ distccd_stop
+ distccd_start
+}
+
+distcc_get_hosts() {
+ if [ -n "$DISTCC_HOSTS" ]; then
+ logger --distcc "[INFO] Using local hosts: $DISTCC_HOSTS"
+ echo "$DISTCC_HOSTS" > $BASEDIR/distcc/hosts
+ return 0
+ fi
+ logger --distcc "[INFO] Getting hosts..."
+ for i in $($BASEDIR/tools/buildspy uuid=$UUID action=get distcc=raw); do
+ logger --distcc "[INFO] Got host: $i"
+ echo "$i" >> $BASEDIR/distcc/hosts_new
+ done
+ [ -s "$BASEDIR/distcc/hosts_new" ] && mv -f $BASEDIR/distcc/hosts{_new,}
+}
+
+distcc_reload() {
+ local NOW=$(date "+%s")
+ [ -z "$DISTCC_RELOAD_TIMESTAMP" ] && DISTCC_RELOAD_TIMESTAMP=$NOW
+
+ # Exit if last reload is less than 5 minutes ago
+ if [ $(( $DISTCC_RELOAD_TIMESTAMP + 300 )) -ge $NOW ]; then
+ return 0
+ fi
+
+ logger --distcc "[INFO] Reloading distcc..."
+ distcc_get_hosts
+ DISTCC_RELOAD_TIMESTAMP=$NOW
+}
+
if [ "$(basename $0)" == "make-compilers" ]; then
# Exit, when distccd is already running
- pidof distccd >/dev/null && exit 1
+ pidof distccd &>/dev/null && exit
# Run distccd
- DISTCCD_PATH=$TOOLS_DIR/bin:$(echo $TOOLS_DIR/libexec/gcc/*-pc-linux-gnu/*/) \
+ DISTCCD_PATH=$TOOLS_DIR/bin \
$TOOLS_DIR/usr/bin/distccd --daemon --allow 0.0.0.0/0 \
- --user nobody --nice 10 --jobs 4 &>/dev/null
+ --user nobody --nice 10 --jobs $DISTCC_JOBS --port $DISTCC_PORT \
+ --log-file $LOGFILE --stats --job-lifetime 600 \
+ --stats-port $(( $DISTCC_PORT + 1 )) &>/dev/null
# When $TOOLS_DIR is not available (esp. gcc) --> exit
while pidof distccd >/dev/null && [ -x $TOOLS_DIR/bin/gcc ]; do
sleep 10
done
- distccd_stop
+ killall distccd &>/dev/null
fi