Added a git shortlog option to make.sh.
Some new things in buildspy...
###############################################################################
# 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
[ -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
-}
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() {
}
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
# 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
git commit $*
- [ "$?" -eq "0" ] || exiterror "git commit $* failed."
+ [ "$?" -eq "0" ] || dialogerror "git commit $* failed."
}
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
}
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."
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
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
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
}
[ -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}
gc)
git_gc
;;
+ shortlog|slog)
+ git_shortlog
+ ;;
put-key)
ssh_cert $*
;;
shift 2
pkg_info_wiki $@
;;
+ wikilist)
+ pkg_list_packages_wiki
+ ;;
*)
usage
;;
}
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