We now send the stage and built package to buildspy.
We also set a marker, when a build failed and don't
repeat the mistake. If git pull can get updates, we
reset and repeat building.
/.config
+/.failed
+/.running
/build_*
/cache
/ccache
LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-toolchain.log"
export LOGFILE
-
+
+ build_spy set stage ${STAGE} &
+
toolchain_make stage1
# make distcc first so that CCACHE_PREFIX works immediately
[ -z "$DISTCC_HOSTS" ] || toolchain_make distcc
LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-base.log"
export LOGFILE
-
+
+ build_spy set stage ${STAGE} &
+
ipfire_make stage2
ipfire_make gmp
ipfire_make mpfr
LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-ipfire.log"
export LOGFILE
-
+
+ build_spy set stage ${STAGE} &
+
### Building the configuration dirs and files
#
ipfire_make stage3
LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-misc.log"
export LOGFILE
-
+
+ build_spy set stage ${STAGE} &
+
ipfire_make stage4
### Console tools
LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-installer.log"
export LOGFILE
+ build_spy set stage ${STAGE} &
+
ipfire_make stage5
ipfire_make ccache
ipfire_make gmp
LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-packages.log"
export LOGFILE
+ build_spy set stage ${STAGE} &
+
toolchain_make strip
ipfire_make initramfs
#fi
mv $LFS/$IMAGES_DIR/{*.iso,*.tgz,*.img.gz} $BASEDIR >> $LOGFILE 2>&1
- #ipfire_make core-updates
- ### DISABLED ATM
-
for i in $(ls -1 $BASEDIR/src/rootfiles/extras); do
if [ -e $BASEDIR/lfs/$i ]; then
- echo -n
- ### Do nothing at the moment, we are gonna use a new packager
+ echo -n $i
+ beautify message SKIP
else
echo -n $i
beautify message SKIP
[ "$1" = "--clean" ] && $0 clean
- yes "y" | git_pull --batch
+ git_pull --batch
+
+ if [ -e "$FAILED" ]; then
+ echo -n "Last build failed..."
+ beautify message FAIL
+ exit 1
+ fi
+
screen -dmS ipfire $0 batch _run
}
--- /dev/null
+#!/bin/bash
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2008 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/>. #
+# #
+###############################################################################
+###############################################################################
+#
+# Beautifying variables & presentation & input output interface
+#
+###############################################################################
+
+## Screen Dimentions
+# Find current screen size
+if [ -z "${COLUMNS}" ]; then
+ COLUMNS=$(stty size)
+ COLUMNS=${COLUMNS##* }
+fi
+
+# When using remote connections, such as a serial port, stty size returns 0
+if [ "${COLUMNS}" = "0" ]; then
+ COLUMNS=80
+fi
+
+## Measurements for positioning result messages
+RESULT_WIDTH=4
+TIME_WIDTH=8
+OPT_WIDTH=7
+VER_WIDTH=10
+RESULT_COL=$((${COLUMNS} - $RESULT_WIDTH - 4))
+TIME_COL=$((${RESULT_COL} - $TIME_WIDTH - 5))
+VER_COL=$((${TIME_COL} - $VER_WIDTH - 5))
+OPT_COL=$((${VER_COL} - $OPT_WIDTH - 5))
+
+## Set Cursur Position Commands, used via echo -e
+SET_RESULT_COL="\\033[${RESULT_COL}G"
+SET_TIME_COL="\\033[${TIME_COL}G"
+SET_VER_COL="\\033[${VER_COL}G"
+SET_OPT_COL="\\033[${OPT_COL}G"
+
+# Normal colors
+CLR_NORM_BLK="\\033[0;30m" # black
+CLR_NORM_RED="\\033[0;31m" # red
+CLR_NORM_GRN="\\033[0;32m" # green
+CLR_NORM_YEL="\\033[0;33m" # yellow
+CLR_NORM_BLU="\\033[0;34m" # blue
+CLR_NORM_MAG="\\033[0;35m" # magenta
+CLR_NORM_CYN="\\033[0;36m" # cyan
+CLR_NORM_WHT="\\033[0;37m" # white
+CLR_NORM_GRY="\\033[0;39m" # grey
+
+# Emphased colors
+CLR_BOLD_BLK="\\033[1;30m" # black
+CLR_BOLD_RED="\\033[1;31m" # red
+CLR_BOLD_GRN="\\033[1;32m" # green
+CLR_BOLD_YEL="\\033[1;33m" # yellow
+CLR_BOLD_BLU="\\033[1;34m" # blue
+CLR_BOLD_MAG="\\033[1;35m" # magenta
+CLR_BOLD_CYN="\\033[1;36m" # cyan
+CLR_BOLD_WHT="\\033[1;37m" # white
+CLR_BOLD_GRY="\\033[1;39m" # grey
+
+# Background colors
+CLR_BACK_BLK="\\033[40m" # black
+CLR_BACK_RED="\\033[41m" # red
+CLR_BACK_GRN="\\033[42m" # green
+CLR_BACK_YEL="\\033[43m" # yellow
+CLR_BACK_BLU="\\033[44m" # blue
+CLR_BACK_MAG="\\033[45m" # magenta
+CLR_BACK_CYN="\\033[46m" # cyan
+CLR_BACK_WHT="\\033[47m" # white
+
+# Action colors
+BOLD=$CLR_BOLD_GRY
+DONE=$CLR_BOLD_GRN
+SKIP=$CLR_BOLD_BLU
+WARN=$CLR_BOLD_MAG
+FAIL=$CLR_BOLD_RED
+NORMAL=$CLR_NORM_GRY
+
+# Color hooks
+BRACKET_L="${CLR_BOLD_BLU}[${NORMAL}"
+BRACKET_R="${CLR_BOLD_BLU}]${NORMAL}"
+
+position_cursor() {
+ # ARG1=starting position on screen
+ # ARG2=string to be printed
+ # ARG3=offset, negative for left movement, positive for right movement, relative to ARG1
+ # For example if your starting position is column 50 and you want to print Hello three columns to the right
+ # of your starting position, your call will look like this:
+ # position_cursor 50 "Hello" 3 (you'll get the string Hello at position 53 (= 50 + 3)
+ # If on the other hand you want your string "Hello" to end three columns to the left of position 50,
+ # your call will look like this:
+ # position_cursor 50 "Hello" -3 (you'll get the string Hello at position 42 (= 50 - 5 -3)
+ # If you want to start printing at the exact starting location, use offset 0
+
+ START=$1
+ STRING=$2
+ OFFSET=$3
+
+ STRING_LENGTH=${#STRING}
+
+ if [ ${OFFSET} -lt 0 ]; then
+ COL=$((${START} + ${OFFSET} - ${STRING_LENGTH}))
+ else
+ COL=$((${START} + ${OFFSET}))
+ fi
+
+ SET_COL="\\033[${COL}G"
+
+ echo $SET_COL
+} # End of position_cursor()
+
+beautify() {
+ # Commands: build_stage, make_pkg, message, result
+ case "$1" in
+ message)
+ MESSAGE="$3"
+ echo -ne "${BOLD}${MESSAGE}${NORMAL}${SET_RESULT_COL}${BRACKET_L}"
+ case "$2" in
+ DONE) echo -ne "${DONE} DONE ${NORMAL}";;
+ WARN) echo -ne "${WARN} WARN ${NORMAL}";;
+ FAIL) echo -ne "${FAIL} FAIL ${NORMAL}";;
+ SKIP) echo -ne "${SKIP} SKIP ${NORMAL}";;
+ ON|ENAB*) echo -ne "${DONE} ENAB ${NORMAL}";;
+ OFF|DISA*) echo -ne "${FAIL} DISA ${NORMAL}";;
+ esac
+ echo -ne "${BRACKET_R}\n"
+ ;;
+ build_stage)
+ MESSAGE=$2
+ echo -ne "${BOLD}*** ${MESSAGE}${SET_OPT_COL} options${SET_VER_COL} version "
+ echo -ne "${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n"
+ ;;
+ make_pkg)
+ echo "$2" | while read PKG_VER PROGRAM OPTIONS
+ do
+ SET_VER_COL_REAL=`position_cursor $TIME_COL $PKG_VER -3`
+
+ echo -ne "${PROGRAM}"
+ if ! [ "$OPTIONS" == "" ]; then
+ echo -ne "${SET_OPT_COL}${BRACKET_L} ${BOLD}${OPTIONS}${NORMAL} ${BRACKET_R}"
+ fi
+
+ if [ "${PKG_VER}" == "${SNAME}" ] || [ "${PKG_VER}" == "LFS" ]; then
+ echo -ne "${SET_RESULT_COL}"
+ else
+ echo -ne "${SET_VER_COL}${BRACKET_L} ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
+ echo -ne "${NORMAL} ${BRACKET_R}${SET_RESULT_COL}"
+ fi
+ done
+ ;;
+ result)
+ RESULT=$2
+
+ if [ ! $3 ]; then
+ PKG_TIME=0
+ else
+ PKG_TIME=$3
+ fi
+
+ SET_TIME_COL_REAL=`position_cursor $RESULT_COL $PKG_TIME -3`
+ echo -ne "${SET_TIME_COL}${BRACKET_L} ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ${BRACKET_R}"
+ case "$RESULT" in
+ DONE) echo -ne "${SET_RESULT_COL}${BRACKET_L}${DONE} DONE ${NORMAL}${BRACKET_R}\n";;
+ FAIL) echo -ne "${SET_RESULT_COL}${BRACKET_L}${FAIL} FAIL ${NORMAL}${BRACKET_R}\n";;
+ SKIP) echo -ne "${SET_RESULT_COL}${BRACKET_L}${SKIP} SKIP ${NORMAL}${BRACKET_R}\n";;
+ esac
+ ;;
+ esac
+} # End of beautify()
+
+get_pkg_ver() {
+ PKG_VER=`grep ^VER $1 | awk '{print $3}'`
+
+ if [ -z $PKG_VER ]; then
+ PKG_VER=`grep "Exp " $1 | awk '{print $4}'`
+ fi
+
+ if [ ${#PKG_VER} -gt $VER_WIDTH ]; then
+ # If a package version number is greater than $VER_WIDTH, we keep the first 4 characters
+ # and replace enough characters to fit the resulting string on the screen. We'll replace
+ # the extra character with .. (two dots). That's why the "+ 2" in the formula below.
+ # Example: if we have a 21-long version number that we want to fit into a 10-long space,
+ # we have to remove 11 characters. But if we replace 11 characters with 2 characters, we'll
+ # end up with a 12-character long string. That's why we replace 12 characters with ..
+ REMOVE=`expr substr "$PKG_VER" 4 $[ ${#PKG_VER} - $VER_WIDTH + 2 ]`
+ PKG_VER=`echo ${PKG_VER/$REMOVE/..}`
+ fi
+
+ echo "$PKG_VER"
+} # End of get_pkg_ver()
+
+dialogerror() {
+ beautify message FAIL
+
+ echo -ne "${FAIL}ERROR${NORMAL}: ${BOLD}$*${NORMAL}\n"
+ [ -z "$LOGFILE" ] || \
+ echo " Check $LOGFILE for errors if applicable"
+} # End of dialogerror()
git_pull() {
if [ "$1" = "--batch" ]; then
shift
- git pull $*
+ git pull $* | grep -q "Already up-to-date." || rm -f $FAILED
else
if [ "$CURRENT_BRANCH" == "master" ]; then
if ! (git status | grep -q "working directory clean"); then
BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
export BASEDIR
+. $BASEDIR/tools/make-beautify # Load this very early
+
###############################################################################
#
# Read the local configuration to override the environment variables
#UCLIBC_SYSROOT_DIR=${UCLIBC_DIR}/${UCLIBC_TARGET}/sys-root
UCLIBC_SYSROOT_DIR=${INSTALLER_DIR}
-# A file that indicates that we are running
+# Files that indicates that we are running or failed
RUNNING=$BASEDIR/.running
-
-###############################################################################
-#
-# Beautifying variables & presentation & input output interface
-#
-###############################################################################
-
-## Screen Dimentions
-# Find current screen size
-if [ -z "${COLUMNS}" ]; then
- COLUMNS=$(stty size)
- COLUMNS=${COLUMNS##* }
-fi
-
-# When using remote connections, such as a serial port, stty size returns 0
-if [ "${COLUMNS}" = "0" ]; then
- COLUMNS=80
-fi
-
-## Measurements for positioning result messages
-RESULT_WIDTH=4
-TIME_WIDTH=8
-OPT_WIDTH=7
-VER_WIDTH=10
-RESULT_COL=$((${COLUMNS} - $RESULT_WIDTH - 4))
-TIME_COL=$((${RESULT_COL} - $TIME_WIDTH - 5))
-VER_COL=$((${TIME_COL} - $VER_WIDTH - 5))
-OPT_COL=$((${VER_COL} - $OPT_WIDTH - 5))
-
-## Set Cursur Position Commands, used via echo -e
-SET_RESULT_COL="\\033[${RESULT_COL}G"
-SET_TIME_COL="\\033[${TIME_COL}G"
-SET_VER_COL="\\033[${VER_COL}G"
-SET_OPT_COL="\\033[${OPT_COL}G"
-
-# Normal colors
-CLR_NORM_BLK="\\033[0;30m" # black
-CLR_NORM_RED="\\033[0;31m" # red
-CLR_NORM_GRN="\\033[0;32m" # green
-CLR_NORM_YEL="\\033[0;33m" # yellow
-CLR_NORM_BLU="\\033[0;34m" # blue
-CLR_NORM_MAG="\\033[0;35m" # magenta
-CLR_NORM_CYN="\\033[0;36m" # cyan
-CLR_NORM_WHT="\\033[0;37m" # white
-CLR_NORM_GRY="\\033[0;39m" # grey
-
-# Emphased colors
-CLR_BOLD_BLK="\\033[1;30m" # black
-CLR_BOLD_RED="\\033[1;31m" # red
-CLR_BOLD_GRN="\\033[1;32m" # green
-CLR_BOLD_YEL="\\033[1;33m" # yellow
-CLR_BOLD_BLU="\\033[1;34m" # blue
-CLR_BOLD_MAG="\\033[1;35m" # magenta
-CLR_BOLD_CYN="\\033[1;36m" # cyan
-CLR_BOLD_WHT="\\033[1;37m" # white
-CLR_BOLD_GRY="\\033[1;39m" # grey
-
-# Background colors
-CLR_BACK_BLK="\\033[40m" # black
-CLR_BACK_RED="\\033[41m" # red
-CLR_BACK_GRN="\\033[42m" # green
-CLR_BACK_YEL="\\033[43m" # yellow
-CLR_BACK_BLU="\\033[44m" # blue
-CLR_BACK_MAG="\\033[45m" # magenta
-CLR_BACK_CYN="\\033[46m" # cyan
-CLR_BACK_WHT="\\033[47m" # white
-
-# Action colors
-BOLD=$CLR_BOLD_GRY
-DONE=$CLR_BOLD_GRN
-SKIP=$CLR_BOLD_BLU
-WARN=$CLR_BOLD_MAG
-FAIL=$CLR_BOLD_RED
-NORMAL=$CLR_NORM_GRY
-
-# Color hooks
-BRACKET_L="${CLR_BOLD_BLU}[${NORMAL}"
-BRACKET_R="${CLR_BOLD_BLU}]${NORMAL}"
+FAILED=$BASEDIR/.failed
################################################################################
# #
(exit $RETVAL)
}
-position_cursor()
-{
- # ARG1=starting position on screen
- # ARG2=string to be printed
- # ARG3=offset, negative for left movement, positive for right movement, relative to ARG1
- # For example if your starting position is column 50 and you want to print Hello three columns to the right
- # of your starting position, your call will look like this:
- # position_cursor 50 "Hello" 3 (you'll get the string Hello at position 53 (= 50 + 3)
- # If on the other hand you want your string "Hello" to end three columns to the left of position 50,
- # your call will look like this:
- # position_cursor 50 "Hello" -3 (you'll get the string Hello at position 42 (= 50 - 5 -3)
- # If you want to start printing at the exact starting location, use offset 0
-
- START=$1
- STRING=$2
- OFFSET=$3
-
- STRING_LENGTH=${#STRING}
-
- if [ ${OFFSET} -lt 0 ]; then
- COL=$((${START} + ${OFFSET} - ${STRING_LENGTH}))
- else
- COL=$((${START} + ${OFFSET}))
- fi
-
- SET_COL="\\033[${COL}G"
-
- echo $SET_COL
-} # End of position_cursor()
-
-
-beautify()
-{
- # Commands: build_stage, make_pkg, message, result
- case "$1" in
- message)
- MESSAGE="$3"
- echo -ne "${BOLD}${MESSAGE}${NORMAL}${SET_RESULT_COL}${BRACKET_L}"
- case "$2" in
- DONE) echo -ne "${DONE} DONE ${NORMAL}";;
- WARN) echo -ne "${WARN} WARN ${NORMAL}";;
- FAIL) echo -ne "${FAIL} FAIL ${NORMAL}";;
- SKIP) echo -ne "${SKIP} SKIP ${NORMAL}";;
- ON|ENAB*) echo -ne "${DONE} ENAB ${NORMAL}";;
- OFF|DISA*) echo -ne "${FAIL} DISA ${NORMAL}";;
- esac
- echo -ne "${BRACKET_R}\n"
- ;;
- build_stage)
- MESSAGE=$2
- echo -ne "${BOLD}*** ${MESSAGE}${SET_OPT_COL} options${SET_VER_COL} version "
- echo -ne "${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n"
- ;;
- make_pkg)
- echo "$2" | while read PKG_VER PROGRAM OPTIONS
- do
- SET_VER_COL_REAL=`position_cursor $TIME_COL $PKG_VER -3`
-
- echo -ne "${PROGRAM}"
- if ! [ "$OPTIONS" == "" ]; then
- echo -ne "${SET_OPT_COL}${BRACKET_L} ${BOLD}${OPTIONS}${NORMAL} ${BRACKET_R}"
- fi
-
- if [ "${PKG_VER}" == "${SNAME}" ] || [ "${PKG_VER}" == "LFS" ]; then
- echo -ne "${SET_RESULT_COL}"
- else
- echo -ne "${SET_VER_COL}${BRACKET_L} ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
- echo -ne "${NORMAL} ${BRACKET_R}${SET_RESULT_COL}"
- fi
- done
- ;;
- result)
- RESULT=$2
-
- if [ ! $3 ]; then
- PKG_TIME=0
- else
- PKG_TIME=$3
- fi
-
- SET_TIME_COL_REAL=`position_cursor $RESULT_COL $PKG_TIME -3`
- echo -ne "${SET_TIME_COL}${BRACKET_L} ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ${BRACKET_R}"
- case "$RESULT" in
- DONE) echo -ne "${SET_RESULT_COL}${BRACKET_L}${DONE} DONE ${NORMAL}${BRACKET_R}\n";;
- FAIL) echo -ne "${SET_RESULT_COL}${BRACKET_L}${FAIL} FAIL ${NORMAL}${BRACKET_R}\n";;
- SKIP) echo -ne "${SET_RESULT_COL}${BRACKET_L}${SKIP} SKIP ${NORMAL}${BRACKET_R}\n";;
- esac
- ;;
- esac
-} # End of beautify()
-
-
-get_pkg_ver()
-{
- PKG_VER=`grep ^VER $1 | awk '{print $3}'`
-
- if [ -z $PKG_VER ]; then
- PKG_VER=`grep "Exp " $1 | awk '{print $4}'`
- fi
-
- if [ ${#PKG_VER} -gt $VER_WIDTH ]; then
- # If a package version number is greater than $VER_WIDTH, we keep the first 4 characters
- # and replace enough characters to fit the resulting string on the screen. We'll replace
- # the extra character with .. (two dots). That's why the "+ 2" in the formula below.
- # Example: if we have a 21-long version number that we want to fit into a 10-long space,
- # we have to remove 11 characters. But if we replace 11 characters with 2 characters, we'll
- # end up with a 12-character long string. That's why we replace 12 characters with ..
- REMOVE=`expr substr "$PKG_VER" 4 $[ ${#PKG_VER} - $VER_WIDTH + 2 ]`
- PKG_VER=`echo ${PKG_VER/$REMOVE/..}`
- fi
-
- echo "$PKG_VER"
-} # End of get_pkg_ver()
-
stdumount() {
sleep 0.3 # Wait one second for finish of processes
for fs in `mount | grep $BASEDIR/build_${MACHINE} | awk '{print $3}'`; do
exiterror() {
stdumount
-
- beautify message FAIL
-
- echo -ne "${FAIL}ERROR${NORMAL}: ${BOLD}$*${NORMAL}\n"
- [ -z "$LOGFILE" ] || \
- echo " Check $LOGFILE for errors if applicable"
+ dialogerror $*
build_spy error
- rm -f $RUNNING
+ touch $FAILED
+ rm -f $RUNNING 2>/dev/null
exit 1
} # End of exiterror()
exiterror "Download error in $1"
fi
+ build_spy set package $1 &
+
return 0 # pass all!
} # End of lfsmakecommoncheck()
#only restore on a clean disk
local BLD_TIME_START=`date +%s`
- touch $RUNNING
+ touch $RUNNING; rm -f $FAILED 2>/dev/null
echo -ne "Building for ${BOLD}${TARGET} (${MACHINE}) on ${MACHINE_REAL}${NORMAL}\n"
rm -rf $BASEDIR/build_${MACHINE}
rm -rf $BASEDIR/log_${MACHINE}
rm -rf $BASEDIR/packages
+ rm -f $FAILED $RUNNING 2>/dev/null
if [ -h $TOOLS_DIR ]; then
rm -f $TOOLS_DIR