]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/commitdiff
Did a lot of work on the make scripts.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Feb 2009 13:43:52 +0000 (14:43 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Feb 2009 13:43:52 +0000 (14:43 +0100)
Added a git shortlog option to make.sh.
Some new things in buildspy...

tools/make-batch
tools/make-beautify
tools/make-buildspy
tools/make-constants
tools/make-git
tools/make-include
tools/make-interactive
tools/make-packages

index b1cf92612e928422d49704a91cbeb7b91383d71d..c12404c8553e949ec612b57c6344cc4585ca4318 100644 (file)
@@ -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
index a7bca4f4cd76e8f0560ec0fc85dc5727e8ce12b1..181409ed103736b1a6469143a394eb21a9655561 100644 (file)
@@ -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
-}
index 8019b2baca906a32a5cb7d4234457a3dc1a85817..7ae3591d796b336a3d15cb26aa2f2d7dc15ec817 100755 (executable)
 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
index 7554bffb1815ffa07d35db80ae3c6a2767689641..8c670c6d170eccf2f53a1db1f2f6cf7663127a72 100644 (file)
@@ -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
index 04e70470c124af92884963b0aa93b2ae3424d585..ee3a1a54d3c71d61be5750cb7c381473c4eaa7b1 100755 (executable)
@@ -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."
 
index e5a3764dc141b1738520e3fecc854ff87c393e92..34745ccfb67d60a69edb23bf84e5ee1aa473c56e 100644 (file)
@@ -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}
index 55470574fbf2db8e605891077ce9189360c12a2e..002140832b894bfe13f91c0c7260385935f2e20c 100644 (file)
@@ -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
                        ;;
index d67b890b1d5c3fb9261b7bcf3a01771a2424c54e..6490866494f3f46ecb8535f4369b8c05e63a66fa 100644 (file)
@@ -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