]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
BuildSpy now sends a short profile of the host.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Jun 2008 14:23:36 +0000 (16:23 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Jun 2008 14:23:36 +0000 (16:23 +0200)
tools/buildspy
tools/make-buildspy [new file with mode: 0644]
tools/make-include

index 7cde6245f6eaf324f0fa684ed725d7eb90e61965..6f5c968e33a943a3b8b8d68197d1fed6fee9860c 100644 (file)
@@ -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 (file)
index 0000000..fa1d7c1
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+# 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}
+}
index dc652619e450bfb6cc15dcd66143170cd58172ef..85dab5c5de51fd2298cf1d029be052dab29d2bf0 100644 (file)
@@ -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