From: Michael Tremer Date: Tue, 17 Jun 2008 14:23:36 +0000 (+0200) Subject: BuildSpy now sends a short profile of the host. X-Git-Tag: v3.0-alpha1~953 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0cba4ddea2d55df23a3ebe7c08e85c7ca4fb1ef1;p=ipfire-3.x.git BuildSpy now sends a short profile of the host. --- diff --git a/tools/buildspy b/tools/buildspy index 7cde6245f..6f5c968e3 100644 --- a/tools/buildspy +++ b/tools/buildspy @@ -52,7 +52,13 @@ action = sys.argv[1] data += "&action=%s" % (action,) if action == "set": - data += "&key=%s&val=%s" % (sys.argv[2], sys.argv[3]) + key = sys.argv[2] + val = "" + for i in sys.argv[3:]: + if len(val): + val += " " + val += i + data += "&key=%s&val=%s" % (key, val) elif action == "error": LOGFILE = os.environ["LOGFILE"] @@ -61,9 +67,6 @@ elif action == "error": f.close() data += "&log=%s" % (log,) -############################################################################### -# Create urlgrabber instance # -############################################################################### g = URLGrabber(user_agent = "IPFireBuildSpy/3.x",) try: gobj = g.urlread(URL, data=data) @@ -72,5 +75,3 @@ except URLGrabError, e: sys.exit(1) sys.exit(0) - -############################################################################### diff --git a/tools/make-buildspy b/tools/make-buildspy new file mode 100644 index 000000000..fa1d7c156 --- /dev/null +++ b/tools/make-buildspy @@ -0,0 +1,48 @@ +#!/bin/bash +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +# A small helper to make the git functions comfortable # +# # +############################################################################### + +build_spy() { + python $BASEDIR/tools/buildspy $* >/dev/null 2>&1 & +} # End of build_spy + +build_spy_send_profile() { + MEM_SIZE=$[ $(grep "^MemTotal:" /proc/meminfo | awk '{ print $2 }') * 1024 ] + + CPU_CNT=$(grep "^processor" < /proc/cpuinfo | wc -l) + CPU_MHZ=$(grep "^cpu MHz" --max-count=1 /proc/cpuinfo | awk -F': ' '{ print $2 }') + CPU_MIPS=$[ $(grep "^bogomips" --max-count=1 /proc/cpuinfo | awk '{ print $3 }' | awk -F. '{ print $1 }') * ${CPU_CNT} ] + CPU_NAME=$(grep "^vendor_id" --max-count=1 /proc/cpuinfo | awk -F': ' '{ print $2 }' | tr '\n' ' '; \ + grep "^model name" --max-count=1 /proc/cpuinfo | awk -F': ' '{ print $2 }') + + build_spy set hostname $(hostname -f || hostname) + sleep 1 + build_spy set cpu_mhz $CPU_MHZ + sleep 1 + build_spy set cpu_mips $CPU_MIPS + sleep 1 + build_spy set cpu_name $CPU_NAME + sleep 1 + build_spy set mem_size $MEM_SIZE + sleep 1 + build_spy set distcc ${DISTCC_PORT-3632} +} diff --git a/tools/make-include b/tools/make-include index dc652619e..85dab5c5d 100644 --- a/tools/make-include +++ b/tools/make-include @@ -194,6 +194,8 @@ NORMAL="\\033[0;39m" # # ################################################################################ +. $BASEDIR/tools/make-buildspy + evaluate() { if [ "$?" -eq "0" ]; then beautify message DONE @@ -359,11 +361,6 @@ exiterror() { exit 1 } # End of exiterror() -build_spy() { - UUID=${UUID} LOGFILE=${LOGFILE} \ - python $BASEDIR/tools/buildspy $* >/dev/null 2>&1 & -} # End of build_spy - ################################################################################ # This is the function that sets the environment of a chroot and enters it # ################################################################################ @@ -772,7 +769,7 @@ build() { echo -ne "Building for ${BOLD}${TARGET} (${MACHINE}) on ${MACHINE_REAL}${NORMAL}\n" - build_spy set hostname $(hostname -f) + build_spy_send_profile & build_spy compiling if [ -f $BASEDIR/log_${MACHINE}/02_base/stage2-LFS ]; then