kernel.resource: if the allocation fails, don't continue with aligning the memory
[AROS.git] / scripts / nightly / build
blob1aa7c971098cd2b0ede2aa4226584a7118b4a492
1 #!/bin/zsh
2 START_TIME=$(date -u +"%H:%M")
3 STOP_TIME="N/A"
4 UPLOAD_START_TIME="N/A"
5 UPLOAD_STOP_TIME="N/A"
7 if [ "$2" != "" ]; then
8 export LANG=$2
9 else
10 export LANG=en_US.ISO8859-1
13 export SP=$(dirname $0)
14 export CFG_NAME=$1
15 source $SP/setup initial
16 source $SP/mail
18 #-- Update sources -----------------------------------------------------------
19 printi "Starting $LANG nightly build on $CFG_NAME..."
20 zsh $SP/update
21 if [ $? != 0 ]; then
22 printe "Updating sources FAILED! ABORTING SCRIPT!"
24 STOP_TIME=$(date -u +"%H:%M")
26 mail_start "FAILED COMPLETELY"
27 mail_write ""
28 mail_write "Updating sources FAILED! Please see attached log."
30 mail_send "-a$LOG_BASE/update.log"
32 mail_stop
34 exit 5
37 #-- Build packages -----------------------------------------------------------
38 failed=()
39 succeeded=()
40 for package in $CFG_PACKAGES; do
41 printe "package $package[(ws:.:)1]-$package[(ws:.:)3]"
42 zsh $SP/pkg/$package[(ws:.:)1]-$package[(ws:.:)3]
43 if [ $? != 0 ]; then
44 printe "Build of package '"$package[(ws:.:)1]-$package[(ws:.:)3]"' FAILED."
45 failed=( $failed $package[(ws:.:)1]-$package[(ws:.:)3] )
46 else
47 printi "Build of package '"$package[(ws:.:)1]-$package[(ws:.:)3]"' completed successfully."
48 succeeded=( $succeeded $package[(ws:.:)1]-$package[(ws:.:)3] )
50 done
52 #-- Cleanup ------------------------------------------------------------------
53 setl cleanup.log
54 source $SP/cleanup
55 resetl
57 #-- Compress log files -------------------------------------------------------
58 printi "Compressing log files..."
59 pushd
60 cd $LOG_BASE
61 for file in *.log; do
62 bzip2 $file
63 md5sum $file.bz2 >$file.bz2.md5
64 done
65 popd
67 STOP_TIME=$(date -u +"%H:%M")
69 #-- Fix permissions ----------------------------------------------------------
70 chmod -R o-wx,g+wr Archive/
71 find Archive/ -type d | xargs chmod a+s,g+rwx,o+x
73 #-- Upload (backup and distribution) -----------------------------------------
74 printi "Uploading archives..."
75 if [ "$CFG_UPLOAD_ENABLE" = "yes" ]; then
76 UPLOAD_START_TIME=$(date -u +"%H:%M")
77 if [ "$CFG_BACKUP_ENABLE" = "yes" ]; then
78 rsync -avz -e "ssh -i $CFG_BS_KEY" Archive/ $CFG_BS_USER@$CFG_BS:$CFG_BS_DIRECTORY
80 rsync -avz -e "ssh -i $CFG_DS_KEY" Archive/ $CFG_DS_USER@$CFG_DS:$CFG_DS_DIRECTORY
81 UPLOAD_STOP_TIME=$(date -u +"%H:%M")
84 #-- Generate report ----------------------------------------------------------
85 if [ "$CFG_MAIL_ENABLE" = "yes" ]; then
86 if [ -z "$failed" ]; then
87 RESULT="completed successfully"
88 elif [ -z "$succeeded" ]; then
89 RESULT="FAILED COMPLETELY"
90 else
91 RESULT="FAILED PARTLY"
94 mail_start $RESULT
96 ATTACH=()
97 if [ ! -z "$failed" ]; then
98 mail_write ""
99 mail_write "The following packages FAILED to build completely:"
100 for package in $failed; do
101 mail_write $package
102 bzcat $LOG_BASE/$package.log.bz2 | tail -100 >/tmp/_aros_build_log_$package
103 ATTACH=( $ATTACH -a/tmp/_aros_build_log_$package )
104 done
105 mail_write ""
106 mail_write "Please see the attached shortened logs or the full logs at"
107 NIGHTLY=$(basename $CFG_DS_DIRECTORY)
108 mail_write "http://www.aros.org/downloads/$NIGHTLY/$VERSION/logs/ for details."
110 if [ ! -z "$succeeded" ]; then
111 mail_write ""
112 mail_write "The following packages were built successfully:"
113 for package in $succeeded; do
114 mail_write "$package"
115 done
116 mail_write ""
117 mail_write "The following archives were created:"
118 mail_write "$( find $ARCHIVE_BASE -type f -not -path '*/logs/*' -not -name '*.md5' | xargs -n 1 basename )"
119 mail_write ""
120 mail_write "The archives will be available for download from http://www.aros.org/download.php."
123 mail_send $ATTACH
125 if [ ! -z "$failed" ]; then
126 rm -rf /tmp/_aros_build_log_*
128 mail_stop
131 #-- Remove uploaded files ----------------------------------------------------
132 if [[ "$CFG_UPLOAD_ENABLE" = "yes" && "$CFG_UPLOAD_PRUNE" = "yes" ]]; then
133 # This is the old way.
134 rm -rf Archive/*
135 # The rm below is UNSAFE. If ARCHIVE_ROOT is undefined somehow, bye-bye
136 # to everything the build user can delete, from / on down.
137 #rm -rf $(ARCHIVE_ROOT)/*