1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-22 22:49:41 +02:00

compile-openwrt-xburst.sh: don't copy failed build to IMAGES_URL

This commit is contained in:
Xiangfu Liu 2012-03-07 10:09:11 +08:00
parent f0ff76ceb2
commit 26a488ae1f

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# this script file is using in build host # This script file is using in build host
# $1: full_system minimal xbboot # $1: full_system minimal xbboot
OPENWRT_DIR_NAME="openwrt-xburst."$1 OPENWRT_DIR_NAME="openwrt-xburst."$1
@ -16,7 +16,9 @@ DATE_TIME=`date +"%Y%m%d-%H%M"`
GET_FEEDS_VERSION_SH="/home/xiangfu/bin/get-feeds-revision.sh" GET_FEEDS_VERSION_SH="/home/xiangfu/bin/get-feeds-revision.sh"
PATCH_OPENWRT_SH="/home/xiangfu/bin/patch-openwrt.sh" PATCH_OPENWRT_SH="/home/xiangfu/bin/patch-openwrt.sh"
IMAGES_DIR="/home/xiangfu/building/Nanonote/Ben/${OPENWRT_DIR_NAME}-${DATE_TIME}/" IMAGES_URL="http://fidelio.qi-hardware.com/~xiangfu/build-nanonote"
IMAGES_DIR_BASE="/home/xiangfu/building/Nanonote/Ben"
IMAGES_DIR="${IMAGES_DIR_BASE}/${OPENWRT_DIR_NAME}-${DATE_TIME}/"
DEST_DIR="/home/xiangfu/build-nanonote" DEST_DIR="/home/xiangfu/build-nanonote"
mkdir -p ${IMAGES_DIR} mkdir -p ${IMAGES_DIR}
mkdir -p ${DEST_DIR} mkdir -p ${DEST_DIR}
@ -24,7 +26,6 @@ mkdir -p ${DEST_DIR}
BUILD_LOG="${IMAGES_DIR}/BUILD_LOG" BUILD_LOG="${IMAGES_DIR}/BUILD_LOG"
VERSIONS_FILE="${IMAGES_DIR}/VERSIONS" VERSIONS_FILE="${IMAGES_DIR}/VERSIONS"
######################################################################## ########################################################################
cd ${OPENWRT_DIR} cd ${OPENWRT_DIR}
@ -47,37 +48,27 @@ if [ "$?" != "0" ]; then
echo "ERROR: update and install feeds failed" echo "ERROR: update and install feeds failed"
exit 1 exit 1
fi fi
cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/${CONFIG_FILE_TYPE} .config cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/${CONFIG_FILE_TYPE} \
.config
sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config
yes "" | make oldconfig > /dev/null yes "" | make oldconfig > /dev/null
echo "copy files, create VERSION, copy dl folder, last prepare..." echo "copy files, create VERSION, link dl folder, last prepare..."
rm -f files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/ rm -f files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/
rm -f dl && ln -s ~/dl rm -f dl && ln -s ~/dl
mkdir -p files/etc && echo ${DATE} > files/etc/VERSION mkdir -p files/etc && echo ${DATE} > files/etc/VERSION
mkdir -p files/etc/uci-defaults && echo -e "\0043\0041/bin/sh \ndate --set `date +"%Y%m%d%H%M"`\nhwclock --systohc" > files/etc/uci-defaults/99-set-time mkdir -p files/etc/uci-defaults && \
echo -e "\0043\0041/bin/sh \ndate --set `date +"%Y%m%d%H%M"`\nhwclock --systohc" > files/etc/uci-defaults/99-set-time
echo "patch openwrt " echo "patch openwrt..."
${PATCH_OPENWRT_SH} ${OPENWRT_DIR} ${PATCH_OPENWRT_SH} ${OPENWRT_DIR}
echo "starting compiling - this may take several hours..." echo "starting compiling - this may take several hours..."
time make ${MAKE_VARS} > ${IMAGES_DIR}/BUILD_LOG 2>&1 time make ${MAKE_VARS} > ${IMAGES_DIR}/BUILD_LOG 2>&1
if [ "$?" != "0" ]; then MAKE_RET="$?"
echo "ERROR: Build failed! Please refer to the log file"
tail -n 100 ${IMAGES_DIR}/BUILD_LOG > ${IMAGES_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
echo -e "\
say #qi-hardware The build has FAILED, \
see log here: http://fidelio.qi-hardware.com/~xiangfu/build-nanonote/${OPENWRT_DIR_NAME}-${DATE_TIME}/\nclose" \
| nc turandot.qi-hardware.com 3858
else
echo -e "\
say #qi-hardware The build was successful, \
see images here: http://fidelio.qi-hardware.com/~xiangfu/build-nanonote/${OPENWRT_DIR_NAME}-${DATE_TIME}/\nclose" \
| nc turandot.qi-hardware.com 3858
fi
echo "getting version numbers of used repositories..." echo "getting version numbers of used repositories..."
@ -93,11 +84,26 @@ mkdir -p ${IMAGES_DIR}/files
cp -a files/* ${IMAGES_DIR}/files/ cp -a files/* ${IMAGES_DIR}/files/
(cd ${IMAGES_DIR}; \ (cd ${IMAGES_DIR}; \
grep -E "ERROR:\ package.*failed to build" BUILD_LOG | grep -v "package/kernel" > failed_packages.txt; \ grep -E "ERROR:\ package.*failed to build" BUILD_LOG | \
grep -v "package/kernel" > failed_packages.txt; \
bzip2 -z BUILD_LOG; \ bzip2 -z BUILD_LOG; \
bzip2 -z openwrt-xburst-qi_lb60-root.ubi; \ bzip2 -z openwrt-xburst-qi_lb60-root.ubi; \
) )
if [ "${MAKE_RET}" != "0" ]; then
echo "ERROR: Build failed! please refer to the BUILD_LOG file"
tail -n 100 ${IMAGES_DIR}/BUILD_LOG > \
${IMAGES_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
MSG="The build was FAILED"
URL="http://fidelio.qi-hardware.com/~xiangfu/building/Nanonote/Ben/\
/${OPENWRT_DIR_NAME}-${DATE_TIME}"
else
mv ${IMAGES_DIR} ${DEST_DIR} mv ${IMAGES_DIR} ${DEST_DIR}
MSG="The build was successful"
URL="${IMAGES_URL}/${OPENWRT_DIR_NAME}-${DATE_TIME}"
fi
echo "DONE!" echo -e "say #qi-hardware ${MSG}: ${URL} \nclose" \
| nc turandot.qi-hardware.com 3858
echo "Done"