forked from AOKP/pseudo_buildbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_device.sh
executable file
·68 lines (59 loc) · 1.75 KB
/
build_device.sh
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
#!/bin/bash
# $1 should be lunch combo
# $2 should be device name
# select device and prepare varibles
BUILD_ROOT=`pwd`
cd $BUILD_ROOT
if [ $2 = "toro" ] || [ $2 = "maguro" ] || [ $2 = "toroplus" ]; then
. build/envsetup.sh
else
. build/envsetup2.sh
fi
lunch $1
TARGET_VENDOR=$(echo $TARGET_PRODUCT | cut -f1 -d '_')
# bacon check
BACON=true
# create log dir if not already present
if test ! -d "$ANDROID_PRODUCT_OUT"
echo "$ANDROID_PRODUCT_OUT doesn't exist, creating now"
then mkdir -p "$ANDROID_PRODUCT_OUT"
fi
# build
if [ "$BACON" = "true" ]; then
make -j$(($(grep processor /proc/cpuinfo | wc -l) * 2)) gummy 2>&1 | tee "$ANDROID_PRODUCT_OUT"/"$TARGET_PRODUCT"_bot.log
else
make -j$(($(grep processor /proc/cpuinfo | wc -l) * 2)) otapackage 2>&1 | tee "$ANDROID_PRODUCT_OUT"/"$TARGET_PRODUCT"_bot.log
fi
echo deleting old zips
# clean out of previous zip
if [ "$BACON" = "true" ]; then
ZIP=$(tail -2 "$ANDROID_PRODUCT_OUT"/"$TARGET_PRODUCT"_bot.log | cut -f3 -d ' ' | cut -f1 -d ' ' | sed -e '/^$/ d')
else
ZIP=$(grep "Package OTA" "$ANDROID_PRODUCT_OUT"/"$TARGET_PRODUCT"_bot.log | cut -f5 -d '/')
fi
mkdir ../upload
echo rm outd/zip
OUTD=$(echo $(cd ../upload && pwd))
rm $OUTD/$ZIP
echo cp zip to outd
cp "$ANDROID_PRODUCT_OUT"/$ZIP $OUTD/$ZIP
# finish
echo "$2 build complete"
# md5sum list
cd $OUTD
md5sum $ZIP | cat >> md5sum
# upload
echo "checking on upload reference file"
BUILDBOT=$BUILD_ROOT/vendor/$TARGET_VENDOR/bot/
cd $BUILDBOT
if test -x upload ; then
echo "Upload file exists, executing now"
cp upload $OUTD
cd $OUTD
# device and zip names are passed on for upload
./upload $2 $ZIP && rm upload
else
echo "No upload file found (or set to +x), build complete."
fi
cd $BUILD_ROOT
rm -rf out/target/product/$2