root/nightlycompile.sh @ 4f190dbb
9f0b2d87 | p4u | #!/bin/bash
|
|
# This is a dummy script to be used with crontab for nighly compilations and so
|
|||
#
|
|||
# Example of usage:
|
|||
ddef1604 | Simó Albert i Beltran | # FORCE="1" TARGETS="alix rspro" COMMUNITY="myNet" BRANCH="testing" ./nightlycompile.sh
|
|
9f0b2d87 | p4u | #
|
|
# Mail to send alerts in case something goes wrong
|
|||
MAIL="admin@qmp.cat"
|
|||
# In the output directory, files older than this will be removed
|
|||
DAYS_TO_PRESERVE="10"
|
|||
e5818914 | p4u | COMMUNITY=${COMMUNITY:-qMp}
|
|
BRANCH=${BRANCH:-testing}
|
|||
9f0b2d87 | p4u | ||
# If target is not specified, compiling for all targets
|
|||
e5818914 | p4u | TARGETS=${TARGETS:-$(make list_targets)}
|
|
# Targets which are not gonna be compiled
|
|||
NOTARGETS=${NOTARGETS:-}
|
|||
9f0b2d87 | p4u | ||
ee446b02 | Jorge L. Florit | # Extra packages (separated by spaces)
|
|
EXTRA_PACKS=${EXTRA_PACKS:-}
|
|||
9f0b2d87 | p4u | # If FORCE is 1, compilation process will be forced
|
|
[ -z "$FORCE" ] && FORCE=0
|
|||
f1639b88 | p4u | [ $FORCE -eq 0 ] && {
|
|
7f54166f | Simó Albert i Beltran | if make is_up_to_date QMP_GIT_BRANCH=$BRANCH >& /dev/null
|
|
f1639b88 | p4u | then
|
|
echo "Nothing to compile, qMp in last version"
|
|||
exit 0
|
|||
fi
|
|||
}
|
|||
9f0b2d87 | p4u | ||
2c54aea6 | p4u | make update_all
|
|
293b74f1 | p4u | (cd build/qmp && git checkout $BRANCH)
|
|
f1639b88 | p4u | ||
9f0b2d87 | p4u | for t in $TARGETS; do
|
|
e5818914 | p4u | [[ "$NOTARGETS" =~ "$t" ]] && continue
|
|
9f0b2d87 | p4u | echo "Compiling target $t"
|
|
ee446b02 | Jorge L. Florit | nice -n 25 make T=$t build J=2 QMP_GIT_BRANCH=$BRANCH COMMUNITY=$COMMUNITY EXTRA_PACKS=$EXTRA_PACKS
|
|
9f0b2d87 | p4u | ||
f1639b88 | p4u | [ $? -ne 0 ] && [ ! -z "$MAIL" ] &&
|
|
echo "Error detected during QMP compilation process" | mail -s "[qMp] build system" $MAIL
|
|||
9f0b2d87 | p4u | done
|
|
f1639b88 | p4u | [ $DAYS_TO_PRESERVE -gt 0 ] &&
|
|
find images/ -iname "*.bin" -type f -mtime +$DAYS_TO_PRESERVE -exec rm -f '{}' \;
|
|||
293b74f1 | p4u | (cd images && md5sum *.bin > IMAGES)
|