From: Michael Tremer Date: Sat, 7 Feb 2009 13:43:52 +0000 (+0100) Subject: Did a lot of work on the make scripts. X-Git-Tag: v3.0-alpha1~27^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12b17e35bd37048a266eebe803d5a1b351cb3504;p=ipfire-3.x.git Did a lot of work on the make scripts. Added a git shortlog option to make.sh. Some new things in buildspy... --- diff --git a/tools/make-batch b/tools/make-batch index b1cf92612..c12404c85 100644 --- a/tools/make-batch +++ b/tools/make-batch @@ -45,7 +45,7 @@ batch_attach() { ############################################################################### # This is the main batch function that runs one thing after an other # ############################################################################### -batch_run() { +batch_run() { gettoolchain $0 build | $BASEDIR/tools/tee $BATCHLOG sleep 5 diff --git a/tools/make-beautify b/tools/make-beautify index a7bca4f4c..181409ed1 100644 --- a/tools/make-beautify +++ b/tools/make-beautify @@ -212,16 +212,3 @@ dialogerror() { [ -z "$LOGFILE" ] || \ echo " Check $LOGFILE for errors if applicable" } # End of dialogerror() - -software_list() { - local DATA - DATA="$BASEDIR/log_${TARGET}/_build.00-software.log" - - echo "====== List of softwares used to build $NAME Version: $VERSION ======" - echo - - sort < $DATA | uniq | tr ";" " " | \ - while read NAME VERSION; do - echo " * $NAME-$VERSION" - done -} diff --git a/tools/make-buildspy b/tools/make-buildspy index 8019b2bac..7ae3591d7 100755 --- a/tools/make-buildspy +++ b/tools/make-buildspy @@ -22,9 +22,18 @@ BUILD_SPY_FILENAME=$BASEDIR/.build_spy build_spy() { - local KEY - KEY=$1; shift 1 - echo -n "${KEY}=$* " >> $BUILD_SPY_FILENAME + local COMMAND + COMMAND=$1 + shift 1 + if [ "$COMMAND" = "start" ]; then + BASEDIR=$BASEDIR UUID=$UUID NAME=$NAME VERSION=$VERSION \ + LOGFILE="$BASEDIR/log_${TARGET}/_build.00-buildspy.log" \ + $BASEDIR/tools/make-buildspy & + elif [ "$COMMAND" = "exit" ]; then + echo -n "BUILDSPY_EXIT " >> $BUILD_SPY_FILENAME + else + echo -n "${COMMAND}=$* " >> $BUILD_SPY_FILENAME + fi } build_spy_send_profile() { @@ -39,23 +48,34 @@ build_spy_send_profile() { } if [ "$(basename $0)" == "make-buildspy" ]; then + if ps aux | grep -q [m]ake-buildspy; then + # Build spy is already running. Exiting silently. + exit 0 + fi while true; do DATA+=$(cat $BUILD_SPY_FILENAME 2>/dev/null || true) > $BUILD_SPY_FILENAME + for command in $DATA; do + if [ "$command" = "BUILDSPY_EXIT" ]; then + BUILDSPY_EXIT=1 + break + fi + done + if [ -n "$DATA" ] && \ $BASEDIR/tools/buildspy \ action=set uuid=$UUID $DATA >> $LOGFILE 2>&1; then DATA="" + else + continue fi - sleep 10 - # If $BUILD_SPY_FILENAME file has content we need a new loop. - # If not, check if we are still running. - if [ -s $BUILD_SPY_FILENAME ]; then - continue + if [ "$BUILDSPY_EXIT" = "1" ]; then + break fi - [ -e $BASEDIR/.running ] || break + + sleep 10 done rm -f $BUILD_SPY_FILENAME fi diff --git a/tools/make-constants b/tools/make-constants index 7554bffb1..8c670c6d1 100644 --- a/tools/make-constants +++ b/tools/make-constants @@ -40,8 +40,9 @@ KVER=$(grep --max-count=1 PKG_VER lfs/linux | awk '{ print $3 }' | tr -d '\n'; g # Read in machine type MACHINE_REAL=$(uname -m) -# Read in our tag -GIT_TAG=$(git tag 2>/dev/null | tail -1) +# Read in information from git +GIT_REV=$(git rev-list HEAD | head -n 1) +GIT_TAG=$(git tag 2>/dev/null | tail -n 1) # Embedded build EMB=0 diff --git a/tools/make-git b/tools/make-git index 04e70470c..ee3a1a54d 100755 --- a/tools/make-git +++ b/tools/make-git @@ -101,7 +101,7 @@ git_commit() { git commit $* - [ "$?" -eq "0" ] || exiterror "git commit $* failed." + [ "$?" -eq "0" ] || dialogerror "git commit $* failed." } git_diff() { @@ -124,13 +124,14 @@ git_diff() { git_log() { echo -n "Generating changelog from repository" - [ -z $GIT_TAG ] || LAST_TAG=$GIT_TAG - [ -z $LAST_TAG ] || EXT="$LAST_TAG..HEAD" - - git log -n 500 --no-merges --pretty=medium --shortstat $EXT > $BASEDIR/doc/ChangeLog + git log -n 500 --no-merges --pretty=medium --shortstat $(git_range) > $BASEDIR/doc/ChangeLog evaluate } +git_shortlog() { + git shortlog --no-merges $(git_range) +} + git_gc() { git gc --prune } @@ -139,6 +140,13 @@ git_export() { git archive HEAD | gzip -9 > ${SNAME}-${VERSION}.source.tar.gz } +git_range() { + local EXT + [ -z $GIT_TAG ] || LAST_TAG=$GIT_TAG + [ -z $LAST_TAG ] || EXT="$LAST_TAG..HEAD" + echo $EXT +} + ssh_cert() { test $# -gt 0 || exiterror "You need to pass the hostname of the remote host." diff --git a/tools/make-include b/tools/make-include index e5a3764dc..34745ccfb 100644 --- a/tools/make-include +++ b/tools/make-include @@ -88,6 +88,7 @@ exiterror() { echo "$(date -u '+%b %e %T') ERROR: $*" >> $LOGFILE build_spy log $(tail -n16 $LOGFILE | $BASEDIR/tools/base64) fi + build_spy exit touch $FAILED rm -f $RUNNING 2>/dev/null exit 1 @@ -534,9 +535,7 @@ build() { build_spy_send_profile build_spy state compiling - BASEDIR=$BASEDIR UUID=$UUID NAME=$NAME VERSION=$VERSION \ - LOGFILE="$BASEDIR/log_${TARGET}/_build.00-buildspy.log" \ - $BASEDIR/tools/make-buildspy & + build_spy start if [ -f $BASEDIR/log_${TARGET}/02_base/stage2-LFS ]; then prepareenv @@ -585,6 +584,7 @@ fi local BLD_TIME_END=$(date +%s) build_spy duration $[ $BLD_TIME_END - $BLD_TIME_START ] build_spy state idle + build_spy exit rm -f $RUNNING } @@ -668,7 +668,8 @@ puttarget() { [ -e "${BASEDIR}/packages" ] && cp -al ${BASEDIR}/packages ${DIR} [ -e "${BATCHLOG}" ] && \ python ${BASEDIR}/tools/alog2html < ${BATCHLOG} > ${DIR}/build_log.html - software_list > ${DIR}/packages-list.txt + pkg_list_packages > ${DIR}/packages-list.txt + git_log >/dev/null; cp -l ${BASEDIR}/doc/ChangeLog ${DIR} git_export; cp -l ${BASEDIR}/${SNAME}-${VERSION}.source.tar.gz ${DIR} git_diff >/dev/null && cp -l ${DIFF_NAME} ${DIR} cp -l ${BASEDIR}/${IMAGENAME}.* ${DIR} diff --git a/tools/make-interactive b/tools/make-interactive index 55470574f..002140832 100644 --- a/tools/make-interactive +++ b/tools/make-interactive @@ -229,6 +229,9 @@ g[iu]t) gc) git_gc ;; + shortlog|slog) + git_shortlog + ;; put-key) ssh_cert $* ;; @@ -303,6 +306,9 @@ package*|pkg) shift 2 pkg_info_wiki $@ ;; + wikilist) + pkg_list_packages_wiki + ;; *) usage ;; diff --git a/tools/make-packages b/tools/make-packages index d67b890b1..649086649 100644 --- a/tools/make-packages +++ b/tools/make-packages @@ -27,6 +27,20 @@ pkg_list_groups() { } pkg_list_packages() { + echo "#### List of softwares used to build $NAME Version: $VERSION ####" + local package + for i in $BASEDIR/lfs/*; do + package=$(basename $i) + ( unset NAME VERSION + eval $(pkg_info ${package}) + [ "$NAME" = "" ] && exit + printf " * %-30s" ${NAME}-${VERSION} + echo "${SHORT}" + ) + done +} + +pkg_list_packages_wiki() { echo "====== List of softwares used to build $NAME Version: $VERSION ======" local package for i in $BASEDIR/lfs/*; do