-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMAKEALL
executable file
·95 lines (85 loc) · 2.59 KB
/
MAKEALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
BASE_FOLDER="${BASE_FOLDER:-/tmp/upstream-boot-build}"
BUILD_FOLDER=${BASE_FOLDER}/build
DEPLOY_FOLDER=${BASE_FOLDER}/deploy
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
LSDEFCONFIGS=`cd $SCRIPT_DIR/configs;ls|sort`
ARGS_DEFCONFIG=$*
DEFCONFIGS=${ARGS_DEFCONFIG:-$LSDEFCONFIGS}
build_config() {
config=$1
folder_name=`echo $config|sed -e "s/_defconfig//g"`
build_path=$BUILD_FOLDER/$folder_name
deploy_path=$DEPLOY_FOLDER/$folder_name
make -j`nproc` O=$build_path D=$deploy_path mrproper
make -j`nproc` O=$build_path D=$deploy_path $config
make -j`nproc` O=$build_path D=$deploy_path
make -j`nproc` O=$build_path D=$deploy_path sdcard
# Save on disk space by dropping the build artifacts unless needed.
if [ -z "$KEEP_BUILD_ARTIFACTS" ]; then
# Run this off in parallel while we start up the next build.
rm -rf $build_path &
fi
}
mkdir -p $BASE_FOLDER
make gitdesc 2>$BASE_FOLDER/git-revs.txt
C_T=`echo $DEFCONFIGS|wc -w`
C_C=1
ETA="Unknown"
T1=`date +%s`
AVG=0
for config in $DEFCONFIGS
do
echo Building for "$config"
build_config $config 2>&1 |tee $BASE_FOLDER/$config.txt | sed -e "s,^,\[$C_C\/$C_T][Eta: $ETA] $config: ,g"
T2=`date +%s`
TD=`expr $T2 - $T1`
T_AVG=`expr $TD / $C_C`
C_REM=`expr $C_T - $C_C`
T_REM=`expr $C_REM \* $T_AVG`
ETA=`date --date="$T_REM seconds" "+%Y-%m-%d/%H:%M:%S"`
C_C=`expr $C_C + 1`
done
count=0
pass=0
fail=0
echo
echo "==> Attempt to summarize Error Logs:"
SUMMARY_FILE=$BASE_FOLDER/build-summary.txt
ERROR_FILE=$BASE_FOLDER/error-summary.txt
echo >$SUMMARY_FILE
echo >$ERROR_FILE
for config in $DEFCONFIGS
do
LOG=$BASE_FOLDER/$config.txt
res=`tail -n 1 $LOG`
success=`echo $res|grep 'SDCARD IMG COMPLETE:'`
if [ x"$success" == x ]; then
((fail++))
echo "===> $config ($LOG) <====" | tee -a "$ERROR_FILE"
result="FAIL"
cat $LOG|grep -v removed|grep -v '^\s'|grep -v Leaving|grep -v Entering|grep -v '^#' | tee -a "$ERROR_FILE"
else
folder_name=`echo $config|sed -e "s/_defconfig//g"`
((pass++))
result="PASS: $DEPLOY_FOLDER/$folder_name"
fi
((count++))
echo $config: $result>>$SUMMARY_FILE
done
echo
echo "==> Git Configuration of Repos:"
cat $BASE_FOLDER/git-revs.txt
echo
echo "==> Result of Builds:"
cat $SUMMARY_FILE
echo
echo
echo "==> All done: See $DEPLOY_FOLDER for files and $BUILD_FOLDER for build artifacts. $BASE_FOLDER for build logs"
echo "==> Summary of Builds: ($count builds: $pass Passed, $fail Failed)"
D_AVG=`date -d@$T_AVG -u +%H:%M:%S`
D_D=`date -d@$TD -u +%H:%M:%S`
echo "===> Total Build time: $D_D, total builds=$C_T, Avergage time per build: $D_AVG"
if [ $fail -gt 0 ]; then
exit -1
fi