Created
March 20, 2022 08:58
-
-
Save geky/17194700a8dde0b9255f8a8808a688a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -uo pipefail | |
SRC=(lfs.c lfs_util.c) | |
HDR=(${SRC[@]/%.c/.h}) | |
export CC='arm-none-eabi-gcc -mthumb' | |
export CFLAGS='-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR' | |
export BUILDDIR=watch | |
diff="" | |
while [ $# -gt 0 ] | |
do | |
case $1 in | |
-d|--diff) diff=1 ;; | |
*) | |
echo "usage $0 [-d]" | |
exit 1 | |
;; | |
esac | |
shift | |
done | |
mkdir -p $BUILDDIR | |
while true | |
do | |
# Compile | |
make -j $BUILDDIR/lfs.csv | |
if [ $? -eq 0 ] | |
then | |
# Keep the last two builds | |
if [ -f $BUILDDIR/lfs.1.current.csv ] | |
then | |
mv $BUILDDIR/lfs{.1.current,.2.previous}.csv | |
fi | |
cp $BUILDDIR/lfs{,.1.current}.csv | |
# Keep build on most recent clean commit | |
if git diff --exit-code --quiet | |
then | |
cp $BUILDDIR/lfs{,.3.commit}.csv | |
fi | |
fi | |
# Print summary for each build, note that this | |
# accepts other, manually added, csv files! | |
prev="" | |
for build in $(ls -r $BUILDDIR/lfs.*.csv) | |
do | |
name="${build%%.csv}" | |
name="${name##*.}" | |
./scripts/summary.py $build ${diff:+-d ${prev:-$build}} -Y \ | |
| sed -e "s/.\{,27\}//; 2s/.\{,11\}/$(printf "%-10s " $name)/" \ | |
| tail ${prev:+-n1} | |
prev=$build | |
done | |
# Wait for events | |
inotifywait -rqe modify ${HDR[@]} ${SRC[@]} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment