blob: 6f7ac57e245da0b160f874ebb90764ab220118ff [file] [log] [blame]
Michael Bestas3952f6c2016-08-26 01:12:08 +03001function breakfast()
2{
3 target=$1
4 local variant=$2
Jackeagle86c04f32023-09-23 03:35:54 -04005
Michael Bestas3952f6c2016-08-26 01:12:08 +03006 if [ $# -eq 0 ]; then
7 # No arguments, so let's have the full menu
8 lunch
9 else
10 echo "z$target" | grep -q "-"
11 if [ $? -eq 0 ]; then
12 # A buildtype was specified, assume a full device name
13 lunch $target
14 else
Jackeagled6811aa2019-09-24 08:26:40 +020015 # This is probably just the BlissRoms model name
Michael Bestas3952f6c2016-08-26 01:12:08 +030016 if [ -z "$variant" ]; then
17 variant="userdebug"
18 fi
Matt Mowered8c2482017-01-02 02:26:01 -060019
Jis G Jacob74daf132024-09-04 08:23:35 -040020 lunch bliss_$target-ap3a-$variant
Michael Bestas3952f6c2016-08-26 01:12:08 +030021 fi
22 fi
23 return $?
24}
25
26alias bib=breakfast
27
28function eat()
29{
30 if [ "$OUT" ] ; then
Jackeagled6811aa2019-09-24 08:26:40 +020031 ZIPPATH=`ls -tr "$OUT"/Bliss-*.zip | tail -1`
Michael Bestas3952f6c2016-08-26 01:12:08 +030032 if [ ! -f $ZIPPATH ] ; then
33 echo "Nothing to eat"
34 return 1
35 fi
Alessandro Astonecdf9ae82019-09-28 16:53:08 +020036 echo "Waiting for device..."
Luca Stefani3d548072020-03-11 12:24:26 +010037 adb wait-for-device-recovery
Alessandro Astonecdf9ae82019-09-28 16:53:08 +020038 echo "Found device"
Jackeagled6811aa2019-09-24 08:26:40 +020039 if (adb shell getprop ro.bliss.device | grep -q "$BLISS_BUILD"); then
Alessandro Astonecdf9ae82019-09-28 16:53:08 +020040 echo "Rebooting to sideload for install"
41 adb reboot sideload-auto-reboot
42 adb wait-for-sideload
43 adb sideload $ZIPPATH
Ethan Chenb69c2ff2016-12-31 13:23:56 -080044 else
Jackeagled6811aa2019-09-24 08:26:40 +020045 echo "The connected device does not appear to be $BLISS_BUILD, run away!"
Michael Bestas3952f6c2016-08-26 01:12:08 +030046 fi
Ethan Chenb69c2ff2016-12-31 13:23:56 -080047 return $?
Michael Bestas3952f6c2016-08-26 01:12:08 +030048 else
49 echo "Nothing to eat"
50 return 1
51 fi
Michael Bestas3952f6c2016-08-26 01:12:08 +030052}
53
54function omnom()
55{
Jackeagle305db7c2020-01-23 10:35:22 +010056 blissify $*
Michael Bestas3952f6c2016-08-26 01:12:08 +030057 eat
58}
59
60function cout()
61{
62 if [ "$OUT" ]; then
63 cd $OUT
64 else
65 echo "Couldn't locate out directory. Try setting OUT."
66 fi
67}
68
69function dddclient()
70{
71 local OUT_ROOT=$(get_abs_build_var PRODUCT_OUT)
72 local OUT_SYMBOLS=$(get_abs_build_var TARGET_OUT_UNSTRIPPED)
73 local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)
74 local OUT_VENDOR_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED)
75 local OUT_EXE_SYMBOLS=$(get_symbols_directory)
76 local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS)
77 local ARCH=$(get_build_var TARGET_ARCH)
78 local GDB
79 case "$ARCH" in
80 arm) GDB=arm-linux-androideabi-gdb;;
81 arm64) GDB=arm-linux-androideabi-gdb; GDB64=aarch64-linux-android-gdb;;
82 mips|mips64) GDB=mips64el-linux-android-gdb;;
83 x86) GDB=x86_64-linux-android-gdb;;
84 x86_64) GDB=x86_64-linux-android-gdb;;
85 *) echo "Unknown arch $ARCH"; return 1;;
86 esac
87
88 if [ "$OUT_ROOT" -a "$PREBUILTS" ]; then
89 local EXE="$1"
90 if [ "$EXE" ] ; then
91 EXE=$1
92 if [[ $EXE =~ ^[^/].* ]] ; then
93 EXE="system/bin/"$EXE
94 fi
95 else
96 EXE="app_process"
97 fi
98
99 local PORT="$2"
100 if [ "$PORT" ] ; then
101 PORT=$2
102 else
103 PORT=":5039"
104 fi
105
106 local PID="$3"
107 if [ "$PID" ] ; then
108 if [[ ! "$PID" =~ ^[0-9]+$ ]] ; then
109 PID=`pid $3`
110 if [[ ! "$PID" =~ ^[0-9]+$ ]] ; then
111 # that likely didn't work because of returning multiple processes
112 # try again, filtering by root processes (don't contain colon)
113 PID=`adb shell ps | \grep $3 | \grep -v ":" | awk '{print $2}'`
114 if [[ ! "$PID" =~ ^[0-9]+$ ]]
115 then
116 echo "Couldn't resolve '$3' to single PID"
117 return 1
118 else
119 echo ""
120 echo "WARNING: multiple processes matching '$3' observed, using root process"
121 echo ""
122 fi
123 fi
124 fi
125 adb forward "tcp$PORT" "tcp$PORT"
126 local USE64BIT="$(is64bit $PID)"
127 adb shell gdbserver$USE64BIT $PORT --attach $PID &
128 sleep 2
129 else
130 echo ""
131 echo "If you haven't done so already, do this first on the device:"
132 echo " gdbserver $PORT /system/bin/$EXE"
133 echo " or"
134 echo " gdbserver $PORT --attach <PID>"
135 echo ""
136 fi
137
138 OUT_SO_SYMBOLS=$OUT_SO_SYMBOLS$USE64BIT
139 OUT_VENDOR_SO_SYMBOLS=$OUT_VENDOR_SO_SYMBOLS$USE64BIT
140
141 echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS"
142 echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS:$OUT_SO_SYMBOLS/hw:$OUT_SO_SYMBOLS/ssl/engines:$OUT_SO_SYMBOLS/drm:$OUT_SO_SYMBOLS/egl:$OUT_SO_SYMBOLS/soundfx:$OUT_VENDOR_SO_SYMBOLS:$OUT_VENDOR_SO_SYMBOLS/hw:$OUT_VENDOR_SO_SYMBOLS/egl"
143 echo >>"$OUT_ROOT/gdbclient.cmds" "source $ANDROID_BUILD_TOP/development/scripts/gdb/dalvik.gdb"
144 echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT"
145 # Enable special debugging for ART processes.
146 if [[ $EXE =~ (^|/)(app_process|dalvikvm)(|32|64)$ ]]; then
147 echo >> "$OUT_ROOT/gdbclient.cmds" "art-on"
148 fi
149 echo >>"$OUT_ROOT/gdbclient.cmds" ""
150
151 local WHICH_GDB=
152 # 64-bit exe found
153 if [ "$USE64BIT" != "" ] ; then
154 WHICH_GDB=$ANDROID_TOOLCHAIN/$GDB64
155 # 32-bit exe / 32-bit platform
156 elif [ "$(get_build_var TARGET_2ND_ARCH)" = "" ]; then
157 WHICH_GDB=$ANDROID_TOOLCHAIN/$GDB
158 # 32-bit exe / 64-bit platform
159 else
160 WHICH_GDB=$ANDROID_TOOLCHAIN_2ND_ARCH/$GDB
161 fi
162
163 ddd --debugger $WHICH_GDB -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
164 else
165 echo "Unable to determine build system output dir."
166 fi
167}
168
Jackeagled6811aa2019-09-24 08:26:40 +0200169function blissremote()
Michael Bestas3952f6c2016-08-26 01:12:08 +0300170{
171 if ! git rev-parse --git-dir &> /dev/null
172 then
173 echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
174 return 1
175 fi
Jackeagled6811aa2019-09-24 08:26:40 +0200176 git remote rm bliss 2> /dev/null
Michael Bestas9e6bde52018-04-02 19:54:45 +0300177 local REMOTE=$(git config --get remote.github.projectname)
Jackeagle305db7c2020-01-23 10:35:22 +0100178 local BLISS="true"
Michael Bestas9e6bde52018-04-02 19:54:45 +0300179 if [ -z "$REMOTE" ]
Michael Bestasaf3532b2017-08-23 17:40:40 +0300180 then
Michael Bestas9e6bde52018-04-02 19:54:45 +0300181 REMOTE=$(git config --get remote.aosp.projectname)
Jackeagle305db7c2020-01-23 10:35:22 +0100182 BLISS="false"
Michael Bestasaf3532b2017-08-23 17:40:40 +0300183 fi
Michael Bestas9e6bde52018-04-02 19:54:45 +0300184 if [ -z "$REMOTE" ]
185 then
186 REMOTE=$(git config --get remote.caf.projectname)
Jackeagle305db7c2020-01-23 10:35:22 +0100187 BLISS="false"
Michael Bestas9e6bde52018-04-02 19:54:45 +0300188 fi
189
Jackeagle305db7c2020-01-23 10:35:22 +0100190 if [ $BLISS = "false" ]
Michael Bestas9e6bde52018-04-02 19:54:45 +0300191 then
192 local PROJECT=$(echo $REMOTE | sed -e "s#platform/#android/#g; s#/#_#g")
Jackeagle305db7c2020-01-23 10:35:22 +0100193 local PFX="BLISS/"
Michael Bestas9e6bde52018-04-02 19:54:45 +0300194 else
195 local PROJECT=$REMOTE
196 fi
197
Jackeagle305db7c2020-01-23 10:35:22 +0100198 local BLISS_USER=$(git config --get review.review.blissroms.com.username)
199 if [ -z "$BLISS_USER" ]
Michael Bestas3952f6c2016-08-26 01:12:08 +0300200 then
Jackeagled6811aa2019-09-24 08:26:40 +0200201 git remote add bliss ssh://review.blissroms.com:29418/$PFX$PROJECT
Michael Bestas3952f6c2016-08-26 01:12:08 +0300202 else
Jackeagle305db7c2020-01-23 10:35:22 +0100203 git remote add bliss ssh://$BLISS_USER@review.blissroms.com:29418/$PFX$PROJECT
Michael Bestas3952f6c2016-08-26 01:12:08 +0300204 fi
Jackeagled6811aa2019-09-24 08:26:40 +0200205 echo "Remote 'bliss' created"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300206}
207
208function aospremote()
209{
210 if ! git rev-parse --git-dir &> /dev/null
211 then
212 echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
213 return 1
214 fi
215 git remote rm aosp 2> /dev/null
Michael Bestasad3a5702017-08-24 00:00:48 +0300216 local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
Rashed Abdel-Tawabfd8b8292017-10-24 21:55:52 -0400217 # Google moved the repo location in Oreo
218 if [ $PROJECT = "build/make" ]
219 then
220 PROJECT="build"
221 fi
Michael Bestas3952f6c2016-08-26 01:12:08 +0300222 if (echo $PROJECT | grep -qv "^device")
223 then
Michael Bestasad3a5702017-08-24 00:00:48 +0300224 local PFX="platform/"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300225 fi
226 git remote add aosp https://android.googlesource.com/$PFX$PROJECT
227 echo "Remote 'aosp' created"
228}
229
230function cafremote()
231{
232 if ! git rev-parse --git-dir &> /dev/null
233 then
234 echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
235 return 1
236 fi
237 git remote rm caf 2> /dev/null
Michael Bestasad3a5702017-08-24 00:00:48 +0300238 local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
Rashed Abdel-Tawabfd8b8292017-10-24 21:55:52 -0400239 # Google moved the repo location in Oreo
240 if [ $PROJECT = "build/make" ]
241 then
242 PROJECT="build"
243 fi
Rashed Abdel-Tawabb52c7082017-12-24 22:40:31 +0200244 if [[ $PROJECT =~ "qcom/opensource" ]];
245 then
246 PROJECT=$(echo $PROJECT | sed -e "s#qcom\/opensource#qcom-opensource#")
247 fi
Michael Bestas3952f6c2016-08-26 01:12:08 +0300248 if (echo $PROJECT | grep -qv "^device")
249 then
Michael Bestasad3a5702017-08-24 00:00:48 +0300250 local PFX="platform/"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300251 fi
Zhao Wei Liewfb4b8c52017-01-08 09:03:01 +0800252 git remote add caf https://source.codeaurora.org/quic/la/$PFX$PROJECT
Michael Bestas3952f6c2016-08-26 01:12:08 +0300253 echo "Remote 'caf' created"
254}
255
Michael Bestasa504aa42018-08-10 22:51:37 +0300256function githubremote()
257{
258 if ! git rev-parse --git-dir &> /dev/null
259 then
260 echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
261 return 1
262 fi
263 git remote rm github 2> /dev/null
264 local REMOTE=$(git config --get remote.aosp.projectname)
265
266 if [ -z "$REMOTE" ]
267 then
268 REMOTE=$(git config --get remote.caf.projectname)
269 fi
270
271 local PROJECT=$(echo $REMOTE | sed -e "s#platform/#android/#g; s#/#_#g")
272
273 git remote add github https://github.com/LineageOS/$PROJECT
274 echo "Remote 'github' created"
275}
276
Michael Bestas3952f6c2016-08-26 01:12:08 +0300277function installboot()
278{
Alessandro Astonef8f48772019-09-06 13:07:03 +0200279 if [ ! -e "$OUT/recovery/root/system/etc/recovery.fstab" ];
Michael Bestas3952f6c2016-08-26 01:12:08 +0300280 then
281 echo "No recovery.fstab found. Build recovery first."
282 return 1
283 fi
284 if [ ! -e "$OUT/boot.img" ];
285 then
286 echo "No boot.img found. Run make bootimage first."
287 return 1
288 fi
Alessandro Astonef8f48772019-09-06 13:07:03 +0200289 PARTITION=`grep "^\/boot" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $3'}`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300290 if [ -z "$PARTITION" ];
291 then
292 # Try for RECOVERY_FSTAB_VERSION = 2
Alessandro Astonef8f48772019-09-06 13:07:03 +0200293 PARTITION=`grep "[[:space:]]\/boot[[:space:]]" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $1'}`
294 PARTITION_TYPE=`grep "[[:space:]]\/boot[[:space:]]" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $3'}`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300295 if [ -z "$PARTITION" ];
296 then
297 echo "Unable to determine boot partition."
298 return 1
299 fi
300 fi
Luca Stefani3d548072020-03-11 12:24:26 +0100301 adb wait-for-device-recovery
Michael Bestas3952f6c2016-08-26 01:12:08 +0300302 adb root
Luca Stefani3d548072020-03-11 12:24:26 +0100303 adb wait-for-device-recovery
Jackeagled6811aa2019-09-24 08:26:40 +0200304 if (adb shell getprop ro.bliss.device | grep -q "$BLISS_BUILD");
Michael Bestas3952f6c2016-08-26 01:12:08 +0300305 then
306 adb push $OUT/boot.img /cache/
Michael Bestas3952f6c2016-08-26 01:12:08 +0300307 adb shell dd if=/cache/boot.img of=$PARTITION
Michael W2e203942018-01-14 18:46:02 +0100308 adb shell rm -rf /cache/boot.img
Michael Bestas3952f6c2016-08-26 01:12:08 +0300309 echo "Installation complete."
310 else
Jackeagled6811aa2019-09-24 08:26:40 +0200311 echo "The connected device does not appear to be $BLISS_BUILD, run away!"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300312 fi
313}
314
315function installrecovery()
316{
Alessandro Astonef8f48772019-09-06 13:07:03 +0200317 if [ ! -e "$OUT/recovery/root/system/etc/recovery.fstab" ];
Michael Bestas3952f6c2016-08-26 01:12:08 +0300318 then
319 echo "No recovery.fstab found. Build recovery first."
320 return 1
321 fi
322 if [ ! -e "$OUT/recovery.img" ];
323 then
324 echo "No recovery.img found. Run make recoveryimage first."
325 return 1
326 fi
Alessandro Astonef8f48772019-09-06 13:07:03 +0200327 PARTITION=`grep "^\/recovery" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $3'}`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300328 if [ -z "$PARTITION" ];
329 then
330 # Try for RECOVERY_FSTAB_VERSION = 2
Alessandro Astonef8f48772019-09-06 13:07:03 +0200331 PARTITION=`grep "[[:space:]]\/recovery[[:space:]]" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $1'}`
332 PARTITION_TYPE=`grep "[[:space:]]\/recovery[[:space:]]" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $3'}`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300333 if [ -z "$PARTITION" ];
334 then
335 echo "Unable to determine recovery partition."
336 return 1
337 fi
338 fi
Luca Stefani3d548072020-03-11 12:24:26 +0100339 adb wait-for-device-recovery
Michael Bestas3952f6c2016-08-26 01:12:08 +0300340 adb root
Luca Stefani3d548072020-03-11 12:24:26 +0100341 adb wait-for-device-recovery
Jackeagled6811aa2019-09-24 08:26:40 +0200342 if (adb shell getprop ro.bliss.device | grep -q "$BLISS_BUILD");
Michael Bestas3952f6c2016-08-26 01:12:08 +0300343 then
344 adb push $OUT/recovery.img /cache/
345 adb shell dd if=/cache/recovery.img of=$PARTITION
Michael W2e203942018-01-14 18:46:02 +0100346 adb shell rm -rf /cache/recovery.img
Michael Bestas3952f6c2016-08-26 01:12:08 +0300347 echo "Installation complete."
348 else
Jackeagled6811aa2019-09-24 08:26:40 +0200349 echo "The connected device does not appear to be $BLISS_BUILD, run away!"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300350 fi
351}
352
Jackeagled6811aa2019-09-24 08:26:40 +0200353function blissgerrit() {
Michael Bestas3952f6c2016-08-26 01:12:08 +0300354 if [ "$(__detect_shell)" = "zsh" ]; then
355 # zsh does not define FUNCNAME, derive from funcstack
356 local FUNCNAME=$funcstack[1]
357 fi
358
359 if [ $# -eq 0 ]; then
360 $FUNCNAME help
361 return 1
362 fi
Jackeagled6811aa2019-09-24 08:26:40 +0200363 local user=`git config --get review.review.blissroms.com.username`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300364 local review=`git config --get remote.github.review`
365 local project=`git config --get remote.github.projectname`
366 local command=$1
367 shift
368 case $command in
369 help)
370 if [ $# -eq 0 ]; then
371 cat <<EOF
372Usage:
373 $FUNCNAME COMMAND [OPTIONS] [CHANGE-ID[/PATCH-SET]][{@|^|~|:}ARG] [-- ARGS]
374
375Commands:
376 fetch Just fetch the change as FETCH_HEAD
377 help Show this help, or for a specific command
378 pull Pull a change into current branch
379 push Push HEAD or a local branch to Gerrit for a specific branch
380
381Any other Git commands that support refname would work as:
382 git fetch URL CHANGE && git COMMAND OPTIONS FETCH_HEAD{@|^|~|:}ARG -- ARGS
383
384See '$FUNCNAME help COMMAND' for more information on a specific command.
385
386Example:
387 $FUNCNAME checkout -b topic 1234/5
388works as:
389 git fetch http://DOMAIN/p/PROJECT refs/changes/34/1234/5 \\
390 && git checkout -b topic FETCH_HEAD
391will checkout a new branch 'topic' base on patch-set 5 of change 1234.
392Patch-set 1 will be fetched if omitted.
393EOF
394 return
395 fi
396 case $1 in
397 __cmg_*) echo "For internal use only." ;;
398 changes|for)
Jackeagled6811aa2019-09-24 08:26:40 +0200399 if [ "$FUNCNAME" = "blissgerrit" ]; then
Michael Bestas3952f6c2016-08-26 01:12:08 +0300400 echo "'$FUNCNAME $1' is deprecated."
401 fi
402 ;;
403 help) $FUNCNAME help ;;
404 fetch|pull) cat <<EOF
405usage: $FUNCNAME $1 [OPTIONS] CHANGE-ID[/PATCH-SET]
406
407works as:
408 git $1 OPTIONS http://DOMAIN/p/PROJECT \\
409 refs/changes/HASH/CHANGE-ID/{PATCH-SET|1}
410
411Example:
412 $FUNCNAME $1 1234
413will $1 patch-set 1 of change 1234
414EOF
415 ;;
416 push) cat <<EOF
417usage: $FUNCNAME push [OPTIONS] [LOCAL_BRANCH:]REMOTE_BRANCH
418
419works as:
420 git push OPTIONS ssh://USER@DOMAIN:29418/PROJECT \\
421 {LOCAL_BRANCH|HEAD}:refs/for/REMOTE_BRANCH
422
423Example:
424 $FUNCNAME push fix6789:gingerbread
425will push local branch 'fix6789' to Gerrit for branch 'gingerbread'.
426HEAD will be pushed from local if omitted.
427EOF
428 ;;
429 *)
430 $FUNCNAME __cmg_err_not_supported $1 && return
431 cat <<EOF
432usage: $FUNCNAME $1 [OPTIONS] CHANGE-ID[/PATCH-SET][{@|^|~|:}ARG] [-- ARGS]
433
434works as:
435 git fetch http://DOMAIN/p/PROJECT \\
436 refs/changes/HASH/CHANGE-ID/{PATCH-SET|1} \\
437 && git $1 OPTIONS FETCH_HEAD{@|^|~|:}ARG -- ARGS
438EOF
439 ;;
440 esac
441 ;;
442 __cmg_get_ref)
443 $FUNCNAME __cmg_err_no_arg $command $# && return 1
444 local change_id patchset_id hash
445 case $1 in
446 */*)
447 change_id=${1%%/*}
448 patchset_id=${1#*/}
449 ;;
450 *)
451 change_id=$1
452 patchset_id=1
453 ;;
454 esac
455 hash=$(($change_id % 100))
456 case $hash in
457 [0-9]) hash="0$hash" ;;
458 esac
459 echo "refs/changes/$hash/$change_id/$patchset_id"
460 ;;
461 fetch|pull)
462 $FUNCNAME __cmg_err_no_arg $command $# help && return 1
463 $FUNCNAME __cmg_err_not_repo && return 1
464 local change=$1
465 shift
466 git $command $@ http://$review/p/$project \
467 $($FUNCNAME __cmg_get_ref $change) || return 1
468 ;;
469 push)
470 $FUNCNAME __cmg_err_no_arg $command $# help && return 1
471 $FUNCNAME __cmg_err_not_repo && return 1
472 if [ -z "$user" ]; then
473 echo >&2 "Gerrit username not found."
474 return 1
475 fi
476 local local_branch remote_branch
477 case $1 in
478 *:*)
479 local_branch=${1%:*}
480 remote_branch=${1##*:}
481 ;;
482 *)
483 local_branch=HEAD
484 remote_branch=$1
485 ;;
486 esac
487 shift
488 git push $@ ssh://$user@$review:29418/$project \
489 $local_branch:refs/for/$remote_branch || return 1
490 ;;
491 changes|for)
Jackeagled6811aa2019-09-24 08:26:40 +0200492 if [ "$FUNCNAME" = "blissgerrit" ]; then
Michael Bestas3952f6c2016-08-26 01:12:08 +0300493 echo >&2 "'$FUNCNAME $command' is deprecated."
494 fi
495 ;;
496 __cmg_err_no_arg)
497 if [ $# -lt 2 ]; then
498 echo >&2 "'$FUNCNAME $command' missing argument."
499 elif [ $2 -eq 0 ]; then
500 if [ -n "$3" ]; then
501 $FUNCNAME help $1
502 else
503 echo >&2 "'$FUNCNAME $1' missing argument."
504 fi
505 else
506 return 1
507 fi
508 ;;
509 __cmg_err_not_repo)
510 if [ -z "$review" -o -z "$project" ]; then
511 echo >&2 "Not currently in any reviewable repository."
512 else
513 return 1
514 fi
515 ;;
516 __cmg_err_not_supported)
517 $FUNCNAME __cmg_err_no_arg $command $# && return
518 case $1 in
519 #TODO: filter more git commands that don't use refname
520 init|add|rm|mv|status|clone|remote|bisect|config|stash)
521 echo >&2 "'$FUNCNAME $1' is not supported."
522 ;;
523 *) return 1 ;;
524 esac
525 ;;
526 #TODO: other special cases?
527 *)
528 $FUNCNAME __cmg_err_not_supported $command && return 1
529 $FUNCNAME __cmg_err_no_arg $command $# help && return 1
530 $FUNCNAME __cmg_err_not_repo && return 1
531 local args="$@"
532 local change pre_args refs_arg post_args
533 case "$args" in
534 *--\ *)
535 pre_args=${args%%-- *}
536 post_args="-- ${args#*-- }"
537 ;;
538 *) pre_args="$args" ;;
539 esac
540 args=($pre_args)
541 pre_args=
542 if [ ${#args[@]} -gt 0 ]; then
543 change=${args[${#args[@]}-1]}
544 fi
545 if [ ${#args[@]} -gt 1 ]; then
546 pre_args=${args[0]}
547 for ((i=1; i<${#args[@]}-1; i++)); do
548 pre_args="$pre_args ${args[$i]}"
549 done
550 fi
551 while ((1)); do
552 case $change in
553 ""|--)
554 $FUNCNAME help $command
555 return 1
556 ;;
557 *@*)
558 if [ -z "$refs_arg" ]; then
559 refs_arg="@${change#*@}"
560 change=${change%%@*}
561 fi
562 ;;
563 *~*)
564 if [ -z "$refs_arg" ]; then
565 refs_arg="~${change#*~}"
566 change=${change%%~*}
567 fi
568 ;;
569 *^*)
570 if [ -z "$refs_arg" ]; then
571 refs_arg="^${change#*^}"
572 change=${change%%^*}
573 fi
574 ;;
575 *:*)
576 if [ -z "$refs_arg" ]; then
577 refs_arg=":${change#*:}"
578 change=${change%%:*}
579 fi
580 ;;
581 *) break ;;
582 esac
583 done
584 $FUNCNAME fetch $change \
585 && git $command $pre_args FETCH_HEAD$refs_arg $post_args \
586 || return 1
587 ;;
588 esac
589}
590
Jackeagled6811aa2019-09-24 08:26:40 +0200591function blissrebase() {
Michael Bestas3952f6c2016-08-26 01:12:08 +0300592 local repo=$1
593 local refs=$2
594 local pwd="$(pwd)"
595 local dir="$(gettop)/$repo"
596
597 if [ -z $repo ] || [ -z $refs ]; then
Dan Pasanen03447712016-12-19 11:22:55 -0600598 echo "LineageOS Gerrit Rebase Usage: "
Jackeagled6811aa2019-09-24 08:26:40 +0200599 echo " blissrebase <path to project> <patch IDs on Gerrit>"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300600 echo " The patch IDs appear on the Gerrit commands that are offered."
601 echo " They consist on a series of numbers and slashes, after the text"
602 echo " refs/changes. For example, the ID in the following command is 26/8126/2"
603 echo ""
604 echo " git[...]ges_apps_Camera refs/changes/26/8126/2 && git cherry-pick FETCH_HEAD"
605 echo ""
606 return
607 fi
608
609 if [ ! -d $dir ]; then
610 echo "Directory $dir doesn't exist in tree."
611 return
612 fi
613 cd $dir
614 repo=$(cat .git/config | grep git://github.com | awk '{ print $NF }' | sed s#git://github.com/##g)
615 echo "Starting branch..."
616 repo start tmprebase .
617 echo "Bringing it up to date..."
618 repo sync .
619 echo "Fetching change..."
Jackeagled6811aa2019-09-24 08:26:40 +0200620 git fetch "https://review.blissroms.com/p/$repo" "refs/changes/$refs" && git cherry-pick FETCH_HEAD
Michael Bestas3952f6c2016-08-26 01:12:08 +0300621 if [ "$?" != "0" ]; then
622 echo "Error cherry-picking. Not uploading!"
623 return
624 fi
625 echo "Uploading..."
626 repo upload .
627 echo "Cleaning up..."
628 repo abandon tmprebase .
629 cd $pwd
630}
631
632function mka() {
Luca Stefani085af722017-08-17 20:34:44 +0200633 m -j "$@"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300634}
635
636function cmka() {
637 if [ ! -z "$1" ]; then
638 for i in "$@"; do
639 case $i in
640 bacon|otapackage|systemimage)
641 mka installclean
642 mka $i
643 ;;
644 *)
645 mka clean-$i
646 mka $i
647 ;;
648 esac
649 done
650 else
651 mka clean
652 mka
653 fi
654}
655
Michael Bestas3952f6c2016-08-26 01:12:08 +0300656function repolastsync() {
657 RLSPATH="$ANDROID_BUILD_TOP/.repo/.repo_fetchtimes.json"
658 RLSLOCAL=$(date -d "$(stat -c %z $RLSPATH)" +"%e %b %Y, %T %Z")
659 RLSUTC=$(date -d "$(stat -c %z $RLSPATH)" -u +"%e %b %Y, %T %Z")
660 echo "Last repo sync: $RLSLOCAL / $RLSUTC"
661}
662
663function reposync() {
Luca Stefani085af722017-08-17 20:34:44 +0200664 repo sync -j 4 "$@"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300665}
666
667function repodiff() {
668 if [ -z "$*" ]; then
669 echo "Usage: repodiff <ref-from> [[ref-to] [--numstat]]"
670 return
671 fi
672 diffopts=$* repo forall -c \
673 'echo "$REPO_PATH ($REPO_REMOTE)"; git diff ${diffopts} 2>/dev/null ;'
674}
675
676# Return success if adb is up and not in recovery
677function _adb_connected {
678 {
Alessandro Astonecdf9ae82019-09-28 16:53:08 +0200679 if [[ "$(adb get-state)" == device ]]
Michael Bestas3952f6c2016-08-26 01:12:08 +0300680 then
681 return 0
682 fi
683 } 2>/dev/null
684
685 return 1
686};
687
688# Credit for color strip sed: http://goo.gl/BoIcm
689function dopush()
690{
691 local func=$1
692 shift
693
694 adb start-server # Prevent unexpected starting server message from adb get-state in the next line
695 if ! _adb_connected; then
696 echo "No device is online. Waiting for one..."
697 echo "Please connect USB and/or enable USB debugging"
698 until _adb_connected; do
699 sleep 1
700 done
701 echo "Device Found."
702 fi
703
Jackeagled6811aa2019-09-24 08:26:40 +0200704 if (adb shell getprop ro.bliss.device | grep -q "$BLISS_BUILD") || [ "$FORCE_PUSH" = "true" ];
Michael Bestas3952f6c2016-08-26 01:12:08 +0300705 then
706 # retrieve IP and PORT info if we're using a TCP connection
Marc K2be9cac2016-10-20 10:27:35 +0200707 TCPIPPORT=$(adb devices \
708 | egrep '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]):[0-9]+[^0-9]+' \
Michael Bestas3952f6c2016-08-26 01:12:08 +0300709 | head -1 | awk '{print $1}')
710 adb root &> /dev/null
711 sleep 0.3
712 if [ -n "$TCPIPPORT" ]
713 then
714 # adb root just killed our connection
715 # so reconnect...
716 adb connect "$TCPIPPORT"
717 fi
718 adb wait-for-device &> /dev/null
Michael Bestas3952f6c2016-08-26 01:12:08 +0300719 adb remount &> /dev/null
720
721 mkdir -p $OUT
722 ($func $*|tee $OUT/.log;return ${PIPESTATUS[0]})
723 ret=$?;
724 if [ $ret -ne 0 ]; then
725 rm -f $OUT/.log;return $ret
726 fi
727
Rashed Abdel-Tawab01806642017-01-19 15:52:13 -0500728 is_gnu_sed=`sed --version | head -1 | grep -c GNU`
729
Michael Bestas3952f6c2016-08-26 01:12:08 +0300730 # Install: <file>
Rashed Abdel-Tawab01806642017-01-19 15:52:13 -0500731 if [ $is_gnu_sed -gt 0 ]; then
Dhina17dd2a6e72024-07-10 18:32:14 +0530732 LOC="$(cat $OUT/.log | sed -r -e 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' -e 's/^\[ {0,2}[0-9]{1,3}% [0-9]{1,6}\/[0-9]{1,6}( [0-9]{0,2}?h?[0-9]{0,2}?m?[0-9]{0,2}s remaining)?\] +//' \
Marc K97b035d2016-10-20 10:27:44 +0200733 | grep '^Install: ' | cut -d ':' -f 2)"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300734 else
Dhina17dd2a6e72024-07-10 18:32:14 +0530735 LOC="$(cat $OUT/.log | sed -E "s/"$'\E'"\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" -E "s/^\[ {0,2}[0-9]{1,3}% [0-9]{1,6}\/[0-9]{1,6}( [0-9]{0,2}?h?[0-9]{0,2}?m?[0-9]{0,2}s remaining)?\] +//" \
Marc K97b035d2016-10-20 10:27:44 +0200736 | grep '^Install: ' | cut -d ':' -f 2)"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300737 fi
738
739 # Copy: <file>
Rashed Abdel-Tawab01806642017-01-19 15:52:13 -0500740 if [ $is_gnu_sed -gt 0 ]; then
Dhina17dd2a6e72024-07-10 18:32:14 +0530741 LOC="$LOC $(cat $OUT/.log | sed -r -e 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' -e 's/^\[ {0,2}[0-9]{1,3}% [0-9]{1,6}\/[0-9]{1,6}( [0-9]{0,2}?h?[0-9]{0,2}?m?[0-9]{0,2}s remaining)?\] +//' \
Marc K97b035d2016-10-20 10:27:44 +0200742 | grep '^Copy: ' | cut -d ':' -f 2)"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300743 else
Dhina17dd2a6e72024-07-10 18:32:14 +0530744 LOC="$LOC $(cat $OUT/.log | sed -E "s/"$'\E'"\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" -E 's/^\[ {0,2}[0-9]{1,3}% [0-9]{1,6}\/[0-9]{1,6}( [0-9]{0,2}?h?[0-9]{0,2}?m?[0-9]{0,2}s remaining)?\] +//' \
Marc K97b035d2016-10-20 10:27:44 +0200745 | grep '^Copy: ' | cut -d ':' -f 2)"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300746 fi
747
748 # If any files are going to /data, push an octal file permissions reader to device
749 if [ -n "$(echo $LOC | egrep '(^|\s)/data')" ]; then
750 CHKPERM="/data/local/tmp/chkfileperm.sh"
751(
752cat <<'EOF'
Bruno Martins5bc28e22022-02-08 19:35:40 +0000753#!/system/bin/sh
Michael Bestas3952f6c2016-08-26 01:12:08 +0300754FILE=$@
755if [ -e $FILE ]; then
756 ls -l $FILE | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf("%0o ",k);print}' | cut -d ' ' -f1
757fi
758EOF
759) > $OUT/.chkfileperm.sh
760 echo "Pushing file permissions checker to device"
761 adb push $OUT/.chkfileperm.sh $CHKPERM
762 adb shell chmod 755 $CHKPERM
763 rm -f $OUT/.chkfileperm.sh
764 fi
765
Sam Mortimerc3865952019-10-12 02:14:13 -0700766 RELOUT=$(echo $OUT | sed "s#^${ANDROID_BUILD_TOP}/##")
767
Michael Bestas3952f6c2016-08-26 01:12:08 +0300768 stop_n_start=false
Sam Mortimerc3865952019-10-12 02:14:13 -0700769 for TARGET in $(echo $LOC | tr " " "\n" | sed "s#.*${RELOUT}##" | sort | uniq); do
Roman Birgd51094c2018-03-28 09:47:30 -0700770 # Make sure file is in $OUT/system, $OUT/data, $OUT/odm, $OUT/oem, $OUT/product, $OUT/product_services or $OUT/vendor
Adrian DCa8e06d32018-06-17 00:15:00 +0200771 case $TARGET in
Roman Birgd51094c2018-03-28 09:47:30 -0700772 /system/*|/data/*|/odm/*|/oem/*|/product/*|/product_services/*|/vendor/*)
Adrian DCa8e06d32018-06-17 00:15:00 +0200773 # Get out file from target (i.e. /system/bin/adb)
774 FILE=$OUT$TARGET
Michael Bestas3952f6c2016-08-26 01:12:08 +0300775 ;;
776 *) continue ;;
777 esac
778
779 case $TARGET in
780 /data/*)
781 # fs_config only sets permissions and se labels for files pushed to /system
782 if [ -n "$CHKPERM" ]; then
783 OLDPERM=$(adb shell $CHKPERM $TARGET)
784 OLDPERM=$(echo $OLDPERM | tr -d '\r' | tr -d '\n')
785 OLDOWN=$(adb shell ls -al $TARGET | awk '{print $2}')
786 OLDGRP=$(adb shell ls -al $TARGET | awk '{print $3}')
787 fi
788 echo "Pushing: $TARGET"
789 adb push $FILE $TARGET
790 if [ -n "$OLDPERM" ]; then
791 echo "Setting file permissions: $OLDPERM, $OLDOWN":"$OLDGRP"
792 adb shell chown "$OLDOWN":"$OLDGRP" $TARGET
793 adb shell chmod "$OLDPERM" $TARGET
794 else
795 echo "$TARGET did not exist previously, you should set file permissions manually"
796 fi
797 adb shell restorecon "$TARGET"
798 ;;
Michael Wec0363e2020-06-17 17:37:09 +0200799 */SystemUI.apk|*/framework/*)
Michael Bestas3952f6c2016-08-26 01:12:08 +0300800 # Only need to stop services once
801 if ! $stop_n_start; then
802 adb shell stop
803 stop_n_start=true
804 fi
805 echo "Pushing: $TARGET"
806 adb push $FILE $TARGET
807 ;;
808 *)
809 echo "Pushing: $TARGET"
810 adb push $FILE $TARGET
811 ;;
812 esac
813 done
814 if [ -n "$CHKPERM" ]; then
815 adb shell rm $CHKPERM
816 fi
817 if $stop_n_start; then
818 adb shell start
819 fi
820 rm -f $OUT/.log
821 return 0
822 else
Jackeagled6811aa2019-09-24 08:26:40 +0200823 echo "The connected device does not appear to be $BLISS_BUILD, run away!"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300824 fi
825}
826
827alias mmp='dopush mm'
828alias mmmp='dopush mmm'
829alias mmap='dopush mma'
Zhao Wei Liew64fc5ae2016-12-10 16:48:27 +0800830alias mmmap='dopush mmma'
Michael Bestas3952f6c2016-08-26 01:12:08 +0300831alias mkap='dopush mka'
832alias cmkap='dopush cmka'
833
834function repopick() {
835 T=$(gettop)
Jackeagled6811aa2019-09-24 08:26:40 +0200836 $T/vendor/bliss/build/tools/repopick.py $@
Michael Bestas3952f6c2016-08-26 01:12:08 +0300837}
838
Michael Bestas656f7e52022-06-09 18:50:47 +0300839function sort-blobs-list() {
840 T=$(gettop)
841 $T/tools/extract-utils/sort-blobs-list.py $@
842}
843
Michael Bestas3952f6c2016-08-26 01:12:08 +0300844function fixup_common_out_dir() {
845 common_out_dir=$(get_build_var OUT_DIR)/target/common
846 target_device=$(get_build_var TARGET_DEVICE)
Sam Mortimer55d6ec52019-09-10 11:40:34 -0700847 common_target_out=common-${target_device}
Jackeagle305db7c2020-01-23 10:35:22 +0100848 if [ ! -z $BLISS_FIXUP_COMMON_OUT ]; then
Michael Bestas3952f6c2016-08-26 01:12:08 +0300849 if [ -d ${common_out_dir} ] && [ ! -L ${common_out_dir} ]; then
850 mv ${common_out_dir} ${common_out_dir}-${target_device}
Sam Mortimer55d6ec52019-09-10 11:40:34 -0700851 ln -s ${common_target_out} ${common_out_dir}
Michael Bestas3952f6c2016-08-26 01:12:08 +0300852 else
853 [ -L ${common_out_dir} ] && rm ${common_out_dir}
854 mkdir -p ${common_out_dir}-${target_device}
Sam Mortimer55d6ec52019-09-10 11:40:34 -0700855 ln -s ${common_target_out} ${common_out_dir}
Michael Bestas3952f6c2016-08-26 01:12:08 +0300856 fi
857 else
858 [ -L ${common_out_dir} ] && rm ${common_out_dir}
859 mkdir -p ${common_out_dir}
860 fi
861}
Jackeagle305db7c2020-01-23 10:35:22 +0100862
863function blissify()
864{
Jon West6f429fa2021-04-24 18:09:38 -0400865 abt="$ANDROID_BUILD_TOP"
866 cd $abt
867 clean="n"
868 deviceclean="n"
869 export BLISS_BUILD_VARIANT=vanilla
870 while test $# -gt 0
871 do
872 case $1 in
873
874 # Normal option processing
875 -h | --help)
876 echo "Usage: $0 options deviceCodename "
877 echo "options: -h | --help: Shows this dialog"
878 echo " -c | --clean: Clean up before running the build"
879 echo " -d | --devclean: Clean up device tree before running the build"
880 echo " -v | --vanilla: Build with no added app store solution **default option** "
Jis G Jacobfa721362024-10-27 12:34:10 -0400881 echo " -g | --gapps: Build with Google Play Services added"
Jon West6f429fa2021-04-24 18:09:38 -0400882 echo " -f | --fossa: build with FOSS (arm64-v8a) app store solutions added"
883 echo " -F | --fossx: build with FOSS (x86_64) app store solutions added"
Jackeagle5256b752023-08-03 14:14:46 -0400884 echo " -m | --microg: Build with MicroG added"
Jon West6f429fa2021-04-24 18:09:38 -0400885 echo ""
886 echo "deviceCodename: "
887 echo "your device codename, without the 'bliss_' in front"
888 echo ""
889 ;;
890 -c | --clean)
891 clean="y";
892 echo "Cleaning build and device tree selected."
893 ;;
894 -d | --devclean)
895 deviceclean="y";
896 echo "Cleaning device tree selected."
897 ;;
898 -v | --vanilla)
899 echo "Building as stock (no gapps) **DEFAULT**"
900 export BLISS_BUILD_VARIANT=vanilla
901 ;;
902 -g | --gapps)
Jis G Jacobfa721362024-10-27 12:34:10 -0400903 echo "Building with Gapps"
Jon West6f429fa2021-04-24 18:09:38 -0400904 export BLISS_BUILD_VARIANT=gapps
905 ;;
906 -f | --fossa)
907 echo "Building with FOSS apps for arm64-v8a support"
908 export BLISS_BUILD_VARIANT=foss
909 cd vendor/foss
910 bash update.sh 2
911 cd $abt
912 ;;
913 -F | --fossx)
914 echo "Building with FOSS apps for x86_64 support"
915 export BLISS_BUILD_VARIANT=foss
916 cd vendor/foss
917 bash update.sh 1
918 cd $abt
919 ;;
Jackeagle5256b752023-08-03 14:14:46 -0400920 -m | --microg)
921 echo "Building with MicroG"
922 export BLISS_BUILD_VARIANT=microg
923 ;;
Jon West68fe7e52021-06-02 15:24:20 -0400924 -u | --userdebug)
925 echo "Building userdebug variant"
926 TARGET_BUILD_VARIANT=userdebug
927 ;;
928 -U | --user)
929 echo "Building user variant"
930 TARGET_BUILD_VARIANT=user
931 ;;
932 -e | --eng)
933 echo "Building eng variant"
934 TARGET_BUILD_VARIANT=eng
935 ;;
936
Jon West6f429fa2021-04-24 18:09:38 -0400937
938 # ...
939
940 # Special cases
941 --)
942 echo "Please use --help to verify correct usage"
943 break
944 ;;
945 --*)
946 # error unknown (long) option $1
947 echo "Please use --help to verify correct usage"
948 break
949 ;;
950 -?)
951 echo "Please use --help to verify correct usage"
952 # error unknown (short) option $1
953 break
954 ;;
955
956 # FUN STUFF HERE:
957 # Split apart combined short options
958 -*)
959 split=$1
960 shift
961 set -- $(echo "$split" | cut -c 2- | sed 's/./-& /g') "$@"
962 continue
963 ;;
964
965 # Done with options
966 *)
967 break
968 ;;
969 esac
970
971 # for testing purposes:
972 shift
973 done
Jon West6f429fa2021-04-24 18:09:38 -0400974 if [ "$1" == "" ]; then
975 echo "No device name specified. Please use --help to verify correct usage"
976 return 0
977 fi
Jackeagle911602f2021-12-06 05:17:55 +0100978
Jon West68fe7e52021-06-02 15:24:20 -0400979 # Breakfast extension
980 if [ $TARGET_BUILD_VARIANT == "user" ];then
981 breakfast $* user
982 elif [ $TARGET_BUILD_VARIANT == "eng" ];then
983 breakfast $* eng
984 else
985 breakfast $*
986 fi
Jackeagled52fd812021-09-10 23:21:00 -0400987
988 if [ $clean == "y" ];then
989 echo "Cleaning up a bit"
990 make clean && make clobber
991 fi
992
993 if [ $deviceclean == "y" ];then
994 echo "Doing some device cleanup"
995 make deviceclean
996 fi
997
Jackeagle305db7c2020-01-23 10:35:22 +0100998 if [ $? -eq 0 ]; then
999 mka blissify
1000 else
Jon West6f429fa2021-04-24 18:09:38 -04001001 echo "No such item in brunch menu. Try 'breakfast' or verify your product is added to AndroidProducts.mk"
Jackeagle305db7c2020-01-23 10:35:22 +01001002 return 1
1003 fi
1004 return $?
1005}
Danny Line0ece602021-11-12 11:25:02 +00001006
1007# Override host metadata to make builds more reproducible and avoid leaking info
1008export BUILD_USERNAME=nobody
1009export BUILD_HOSTNAME=android-build