blob: 0be41f314994972772b2ab15bdf7805f245803a9 [file] [log] [blame]
micky38753722ce2024-10-12 10:40:41 -04001CLANG_VERSION=$(build/soong/scripts/get_clang_version.py)
2export LLVM_AOSP_PREBUILTS_VERSION="${CLANG_VERSION}"
3
Michael Bestas3952f6c2016-08-26 01:12:08 +03004function breakfast()
5{
6 target=$1
7 local variant=$2
Jackeagle86c04f32023-09-23 03:35:54 -04008
Michael Bestas3952f6c2016-08-26 01:12:08 +03009 if [ $# -eq 0 ]; then
10 # No arguments, so let's have the full menu
11 lunch
12 else
13 echo "z$target" | grep -q "-"
14 if [ $? -eq 0 ]; then
15 # A buildtype was specified, assume a full device name
16 lunch $target
17 else
Jackeagled6811aa2019-09-24 08:26:40 +020018 # This is probably just the BlissRoms model name
Michael Bestas3952f6c2016-08-26 01:12:08 +030019 if [ -z "$variant" ]; then
20 variant="userdebug"
21 fi
Matt Mowered8c2482017-01-02 02:26:01 -060022
Jis G Jacob3742fd92024-12-11 23:34:43 -050023 lunch bliss_$target-ap4a-$variant
Michael Bestas3952f6c2016-08-26 01:12:08 +030024 fi
25 fi
26 return $?
27}
28
29alias bib=breakfast
30
31function eat()
32{
33 if [ "$OUT" ] ; then
Jackeagled6811aa2019-09-24 08:26:40 +020034 ZIPPATH=`ls -tr "$OUT"/Bliss-*.zip | tail -1`
Michael Bestas3952f6c2016-08-26 01:12:08 +030035 if [ ! -f $ZIPPATH ] ; then
36 echo "Nothing to eat"
37 return 1
38 fi
Alessandro Astonecdf9ae82019-09-28 16:53:08 +020039 echo "Waiting for device..."
Luca Stefani3d548072020-03-11 12:24:26 +010040 adb wait-for-device-recovery
Alessandro Astonecdf9ae82019-09-28 16:53:08 +020041 echo "Found device"
Jackeagled6811aa2019-09-24 08:26:40 +020042 if (adb shell getprop ro.bliss.device | grep -q "$BLISS_BUILD"); then
Alessandro Astonecdf9ae82019-09-28 16:53:08 +020043 echo "Rebooting to sideload for install"
44 adb reboot sideload-auto-reboot
45 adb wait-for-sideload
46 adb sideload $ZIPPATH
Ethan Chenb69c2ff2016-12-31 13:23:56 -080047 else
Jackeagled6811aa2019-09-24 08:26:40 +020048 echo "The connected device does not appear to be $BLISS_BUILD, run away!"
Michael Bestas3952f6c2016-08-26 01:12:08 +030049 fi
Ethan Chenb69c2ff2016-12-31 13:23:56 -080050 return $?
Michael Bestas3952f6c2016-08-26 01:12:08 +030051 else
52 echo "Nothing to eat"
53 return 1
54 fi
Michael Bestas3952f6c2016-08-26 01:12:08 +030055}
56
57function omnom()
58{
Jackeagle305db7c2020-01-23 10:35:22 +010059 blissify $*
Michael Bestas3952f6c2016-08-26 01:12:08 +030060 eat
61}
62
63function cout()
64{
65 if [ "$OUT" ]; then
66 cd $OUT
67 else
68 echo "Couldn't locate out directory. Try setting OUT."
69 fi
70}
71
72function dddclient()
73{
74 local OUT_ROOT=$(get_abs_build_var PRODUCT_OUT)
75 local OUT_SYMBOLS=$(get_abs_build_var TARGET_OUT_UNSTRIPPED)
76 local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)
77 local OUT_VENDOR_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED)
78 local OUT_EXE_SYMBOLS=$(get_symbols_directory)
79 local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS)
80 local ARCH=$(get_build_var TARGET_ARCH)
81 local GDB
82 case "$ARCH" in
83 arm) GDB=arm-linux-androideabi-gdb;;
84 arm64) GDB=arm-linux-androideabi-gdb; GDB64=aarch64-linux-android-gdb;;
85 mips|mips64) GDB=mips64el-linux-android-gdb;;
86 x86) GDB=x86_64-linux-android-gdb;;
87 x86_64) GDB=x86_64-linux-android-gdb;;
88 *) echo "Unknown arch $ARCH"; return 1;;
89 esac
90
91 if [ "$OUT_ROOT" -a "$PREBUILTS" ]; then
92 local EXE="$1"
93 if [ "$EXE" ] ; then
94 EXE=$1
95 if [[ $EXE =~ ^[^/].* ]] ; then
96 EXE="system/bin/"$EXE
97 fi
98 else
99 EXE="app_process"
100 fi
101
102 local PORT="$2"
103 if [ "$PORT" ] ; then
104 PORT=$2
105 else
106 PORT=":5039"
107 fi
108
109 local PID="$3"
110 if [ "$PID" ] ; then
111 if [[ ! "$PID" =~ ^[0-9]+$ ]] ; then
112 PID=`pid $3`
113 if [[ ! "$PID" =~ ^[0-9]+$ ]] ; then
114 # that likely didn't work because of returning multiple processes
115 # try again, filtering by root processes (don't contain colon)
116 PID=`adb shell ps | \grep $3 | \grep -v ":" | awk '{print $2}'`
117 if [[ ! "$PID" =~ ^[0-9]+$ ]]
118 then
119 echo "Couldn't resolve '$3' to single PID"
120 return 1
121 else
122 echo ""
123 echo "WARNING: multiple processes matching '$3' observed, using root process"
124 echo ""
125 fi
126 fi
127 fi
128 adb forward "tcp$PORT" "tcp$PORT"
129 local USE64BIT="$(is64bit $PID)"
130 adb shell gdbserver$USE64BIT $PORT --attach $PID &
131 sleep 2
132 else
133 echo ""
134 echo "If you haven't done so already, do this first on the device:"
135 echo " gdbserver $PORT /system/bin/$EXE"
136 echo " or"
137 echo " gdbserver $PORT --attach <PID>"
138 echo ""
139 fi
140
141 OUT_SO_SYMBOLS=$OUT_SO_SYMBOLS$USE64BIT
142 OUT_VENDOR_SO_SYMBOLS=$OUT_VENDOR_SO_SYMBOLS$USE64BIT
143
144 echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS"
145 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"
146 echo >>"$OUT_ROOT/gdbclient.cmds" "source $ANDROID_BUILD_TOP/development/scripts/gdb/dalvik.gdb"
147 echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT"
148 # Enable special debugging for ART processes.
149 if [[ $EXE =~ (^|/)(app_process|dalvikvm)(|32|64)$ ]]; then
150 echo >> "$OUT_ROOT/gdbclient.cmds" "art-on"
151 fi
152 echo >>"$OUT_ROOT/gdbclient.cmds" ""
153
154 local WHICH_GDB=
155 # 64-bit exe found
156 if [ "$USE64BIT" != "" ] ; then
157 WHICH_GDB=$ANDROID_TOOLCHAIN/$GDB64
158 # 32-bit exe / 32-bit platform
159 elif [ "$(get_build_var TARGET_2ND_ARCH)" = "" ]; then
160 WHICH_GDB=$ANDROID_TOOLCHAIN/$GDB
161 # 32-bit exe / 64-bit platform
162 else
163 WHICH_GDB=$ANDROID_TOOLCHAIN_2ND_ARCH/$GDB
164 fi
165
166 ddd --debugger $WHICH_GDB -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
167 else
168 echo "Unable to determine build system output dir."
169 fi
170}
171
Jackeagled6811aa2019-09-24 08:26:40 +0200172function blissremote()
Michael Bestas3952f6c2016-08-26 01:12:08 +0300173{
174 if ! git rev-parse --git-dir &> /dev/null
175 then
176 echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
177 return 1
178 fi
Jackeagled6811aa2019-09-24 08:26:40 +0200179 git remote rm bliss 2> /dev/null
Michael Bestas9e6bde52018-04-02 19:54:45 +0300180 local REMOTE=$(git config --get remote.github.projectname)
Jackeagle305db7c2020-01-23 10:35:22 +0100181 local BLISS="true"
Michael Bestas9e6bde52018-04-02 19:54:45 +0300182 if [ -z "$REMOTE" ]
Michael Bestasaf3532b2017-08-23 17:40:40 +0300183 then
Michael Bestas9e6bde52018-04-02 19:54:45 +0300184 REMOTE=$(git config --get remote.aosp.projectname)
Jackeagle305db7c2020-01-23 10:35:22 +0100185 BLISS="false"
Michael Bestasaf3532b2017-08-23 17:40:40 +0300186 fi
Michael Bestas9e6bde52018-04-02 19:54:45 +0300187 if [ -z "$REMOTE" ]
188 then
189 REMOTE=$(git config --get remote.caf.projectname)
Jackeagle305db7c2020-01-23 10:35:22 +0100190 BLISS="false"
Michael Bestas9e6bde52018-04-02 19:54:45 +0300191 fi
192
Jackeagle305db7c2020-01-23 10:35:22 +0100193 if [ $BLISS = "false" ]
Michael Bestas9e6bde52018-04-02 19:54:45 +0300194 then
195 local PROJECT=$(echo $REMOTE | sed -e "s#platform/#android/#g; s#/#_#g")
Jackeagle305db7c2020-01-23 10:35:22 +0100196 local PFX="BLISS/"
Michael Bestas9e6bde52018-04-02 19:54:45 +0300197 else
198 local PROJECT=$REMOTE
199 fi
200
Jackeagle305db7c2020-01-23 10:35:22 +0100201 local BLISS_USER=$(git config --get review.review.blissroms.com.username)
202 if [ -z "$BLISS_USER" ]
Michael Bestas3952f6c2016-08-26 01:12:08 +0300203 then
Jackeagled6811aa2019-09-24 08:26:40 +0200204 git remote add bliss ssh://review.blissroms.com:29418/$PFX$PROJECT
Michael Bestas3952f6c2016-08-26 01:12:08 +0300205 else
Jackeagle305db7c2020-01-23 10:35:22 +0100206 git remote add bliss ssh://$BLISS_USER@review.blissroms.com:29418/$PFX$PROJECT
Michael Bestas3952f6c2016-08-26 01:12:08 +0300207 fi
Jackeagled6811aa2019-09-24 08:26:40 +0200208 echo "Remote 'bliss' created"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300209}
210
211function aospremote()
212{
213 if ! git rev-parse --git-dir &> /dev/null
214 then
215 echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
216 return 1
217 fi
218 git remote rm aosp 2> /dev/null
Michael Bestasad3a5702017-08-24 00:00:48 +0300219 local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
Rashed Abdel-Tawabfd8b8292017-10-24 21:55:52 -0400220 # Google moved the repo location in Oreo
221 if [ $PROJECT = "build/make" ]
222 then
223 PROJECT="build"
224 fi
Michael Bestas3952f6c2016-08-26 01:12:08 +0300225 if (echo $PROJECT | grep -qv "^device")
226 then
Michael Bestasad3a5702017-08-24 00:00:48 +0300227 local PFX="platform/"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300228 fi
229 git remote add aosp https://android.googlesource.com/$PFX$PROJECT
230 echo "Remote 'aosp' created"
231}
232
233function cafremote()
234{
235 if ! git rev-parse --git-dir &> /dev/null
236 then
237 echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
238 return 1
239 fi
240 git remote rm caf 2> /dev/null
Michael Bestasad3a5702017-08-24 00:00:48 +0300241 local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
Rashed Abdel-Tawabfd8b8292017-10-24 21:55:52 -0400242 # Google moved the repo location in Oreo
243 if [ $PROJECT = "build/make" ]
244 then
245 PROJECT="build"
246 fi
Rashed Abdel-Tawabb52c7082017-12-24 22:40:31 +0200247 if [[ $PROJECT =~ "qcom/opensource" ]];
248 then
249 PROJECT=$(echo $PROJECT | sed -e "s#qcom\/opensource#qcom-opensource#")
250 fi
Michael Bestas3952f6c2016-08-26 01:12:08 +0300251 if (echo $PROJECT | grep -qv "^device")
252 then
Michael Bestasad3a5702017-08-24 00:00:48 +0300253 local PFX="platform/"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300254 fi
Zhao Wei Liewfb4b8c52017-01-08 09:03:01 +0800255 git remote add caf https://source.codeaurora.org/quic/la/$PFX$PROJECT
Michael Bestas3952f6c2016-08-26 01:12:08 +0300256 echo "Remote 'caf' created"
257}
258
Michael Bestasa504aa42018-08-10 22:51:37 +0300259function githubremote()
260{
261 if ! git rev-parse --git-dir &> /dev/null
262 then
263 echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
264 return 1
265 fi
266 git remote rm github 2> /dev/null
267 local REMOTE=$(git config --get remote.aosp.projectname)
268
269 if [ -z "$REMOTE" ]
270 then
271 REMOTE=$(git config --get remote.caf.projectname)
272 fi
273
274 local PROJECT=$(echo $REMOTE | sed -e "s#platform/#android/#g; s#/#_#g")
275
276 git remote add github https://github.com/LineageOS/$PROJECT
277 echo "Remote 'github' created"
278}
279
Michael Bestas3952f6c2016-08-26 01:12:08 +0300280function installboot()
281{
Alessandro Astonef8f48772019-09-06 13:07:03 +0200282 if [ ! -e "$OUT/recovery/root/system/etc/recovery.fstab" ];
Michael Bestas3952f6c2016-08-26 01:12:08 +0300283 then
284 echo "No recovery.fstab found. Build recovery first."
285 return 1
286 fi
287 if [ ! -e "$OUT/boot.img" ];
288 then
289 echo "No boot.img found. Run make bootimage first."
290 return 1
291 fi
Alessandro Astonef8f48772019-09-06 13:07:03 +0200292 PARTITION=`grep "^\/boot" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $3'}`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300293 if [ -z "$PARTITION" ];
294 then
295 # Try for RECOVERY_FSTAB_VERSION = 2
Alessandro Astonef8f48772019-09-06 13:07:03 +0200296 PARTITION=`grep "[[:space:]]\/boot[[:space:]]" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $1'}`
297 PARTITION_TYPE=`grep "[[:space:]]\/boot[[:space:]]" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $3'}`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300298 if [ -z "$PARTITION" ];
299 then
300 echo "Unable to determine boot partition."
301 return 1
302 fi
303 fi
Luca Stefani3d548072020-03-11 12:24:26 +0100304 adb wait-for-device-recovery
Michael Bestas3952f6c2016-08-26 01:12:08 +0300305 adb root
Luca Stefani3d548072020-03-11 12:24:26 +0100306 adb wait-for-device-recovery
Jackeagled6811aa2019-09-24 08:26:40 +0200307 if (adb shell getprop ro.bliss.device | grep -q "$BLISS_BUILD");
Michael Bestas3952f6c2016-08-26 01:12:08 +0300308 then
309 adb push $OUT/boot.img /cache/
Michael Bestas3952f6c2016-08-26 01:12:08 +0300310 adb shell dd if=/cache/boot.img of=$PARTITION
Michael W2e203942018-01-14 18:46:02 +0100311 adb shell rm -rf /cache/boot.img
Michael Bestas3952f6c2016-08-26 01:12:08 +0300312 echo "Installation complete."
313 else
Jackeagled6811aa2019-09-24 08:26:40 +0200314 echo "The connected device does not appear to be $BLISS_BUILD, run away!"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300315 fi
316}
317
318function installrecovery()
319{
Alessandro Astonef8f48772019-09-06 13:07:03 +0200320 if [ ! -e "$OUT/recovery/root/system/etc/recovery.fstab" ];
Michael Bestas3952f6c2016-08-26 01:12:08 +0300321 then
322 echo "No recovery.fstab found. Build recovery first."
323 return 1
324 fi
325 if [ ! -e "$OUT/recovery.img" ];
326 then
327 echo "No recovery.img found. Run make recoveryimage first."
328 return 1
329 fi
Alessandro Astonef8f48772019-09-06 13:07:03 +0200330 PARTITION=`grep "^\/recovery" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $3'}`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300331 if [ -z "$PARTITION" ];
332 then
333 # Try for RECOVERY_FSTAB_VERSION = 2
Alessandro Astonef8f48772019-09-06 13:07:03 +0200334 PARTITION=`grep "[[:space:]]\/recovery[[:space:]]" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $1'}`
335 PARTITION_TYPE=`grep "[[:space:]]\/recovery[[:space:]]" $OUT/recovery/root/system/etc/recovery.fstab | awk {'print $3'}`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300336 if [ -z "$PARTITION" ];
337 then
338 echo "Unable to determine recovery partition."
339 return 1
340 fi
341 fi
Luca Stefani3d548072020-03-11 12:24:26 +0100342 adb wait-for-device-recovery
Michael Bestas3952f6c2016-08-26 01:12:08 +0300343 adb root
Luca Stefani3d548072020-03-11 12:24:26 +0100344 adb wait-for-device-recovery
Jackeagled6811aa2019-09-24 08:26:40 +0200345 if (adb shell getprop ro.bliss.device | grep -q "$BLISS_BUILD");
Michael Bestas3952f6c2016-08-26 01:12:08 +0300346 then
347 adb push $OUT/recovery.img /cache/
348 adb shell dd if=/cache/recovery.img of=$PARTITION
Michael W2e203942018-01-14 18:46:02 +0100349 adb shell rm -rf /cache/recovery.img
Michael Bestas3952f6c2016-08-26 01:12:08 +0300350 echo "Installation complete."
351 else
Jackeagled6811aa2019-09-24 08:26:40 +0200352 echo "The connected device does not appear to be $BLISS_BUILD, run away!"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300353 fi
354}
355
Jackeagled6811aa2019-09-24 08:26:40 +0200356function blissgerrit() {
Michael Bestas3952f6c2016-08-26 01:12:08 +0300357 if [ "$(__detect_shell)" = "zsh" ]; then
358 # zsh does not define FUNCNAME, derive from funcstack
359 local FUNCNAME=$funcstack[1]
360 fi
361
362 if [ $# -eq 0 ]; then
363 $FUNCNAME help
364 return 1
365 fi
Jackeagled6811aa2019-09-24 08:26:40 +0200366 local user=`git config --get review.review.blissroms.com.username`
Michael Bestas3952f6c2016-08-26 01:12:08 +0300367 local review=`git config --get remote.github.review`
368 local project=`git config --get remote.github.projectname`
369 local command=$1
370 shift
371 case $command in
372 help)
373 if [ $# -eq 0 ]; then
374 cat <<EOF
375Usage:
376 $FUNCNAME COMMAND [OPTIONS] [CHANGE-ID[/PATCH-SET]][{@|^|~|:}ARG] [-- ARGS]
377
378Commands:
379 fetch Just fetch the change as FETCH_HEAD
380 help Show this help, or for a specific command
381 pull Pull a change into current branch
382 push Push HEAD or a local branch to Gerrit for a specific branch
383
384Any other Git commands that support refname would work as:
385 git fetch URL CHANGE && git COMMAND OPTIONS FETCH_HEAD{@|^|~|:}ARG -- ARGS
386
387See '$FUNCNAME help COMMAND' for more information on a specific command.
388
389Example:
390 $FUNCNAME checkout -b topic 1234/5
391works as:
392 git fetch http://DOMAIN/p/PROJECT refs/changes/34/1234/5 \\
393 && git checkout -b topic FETCH_HEAD
394will checkout a new branch 'topic' base on patch-set 5 of change 1234.
395Patch-set 1 will be fetched if omitted.
396EOF
397 return
398 fi
399 case $1 in
400 __cmg_*) echo "For internal use only." ;;
401 changes|for)
Jackeagled6811aa2019-09-24 08:26:40 +0200402 if [ "$FUNCNAME" = "blissgerrit" ]; then
Michael Bestas3952f6c2016-08-26 01:12:08 +0300403 echo "'$FUNCNAME $1' is deprecated."
404 fi
405 ;;
406 help) $FUNCNAME help ;;
407 fetch|pull) cat <<EOF
408usage: $FUNCNAME $1 [OPTIONS] CHANGE-ID[/PATCH-SET]
409
410works as:
411 git $1 OPTIONS http://DOMAIN/p/PROJECT \\
412 refs/changes/HASH/CHANGE-ID/{PATCH-SET|1}
413
414Example:
415 $FUNCNAME $1 1234
416will $1 patch-set 1 of change 1234
417EOF
418 ;;
419 push) cat <<EOF
420usage: $FUNCNAME push [OPTIONS] [LOCAL_BRANCH:]REMOTE_BRANCH
421
422works as:
423 git push OPTIONS ssh://USER@DOMAIN:29418/PROJECT \\
424 {LOCAL_BRANCH|HEAD}:refs/for/REMOTE_BRANCH
425
426Example:
427 $FUNCNAME push fix6789:gingerbread
428will push local branch 'fix6789' to Gerrit for branch 'gingerbread'.
429HEAD will be pushed from local if omitted.
430EOF
431 ;;
432 *)
433 $FUNCNAME __cmg_err_not_supported $1 && return
434 cat <<EOF
435usage: $FUNCNAME $1 [OPTIONS] CHANGE-ID[/PATCH-SET][{@|^|~|:}ARG] [-- ARGS]
436
437works as:
438 git fetch http://DOMAIN/p/PROJECT \\
439 refs/changes/HASH/CHANGE-ID/{PATCH-SET|1} \\
440 && git $1 OPTIONS FETCH_HEAD{@|^|~|:}ARG -- ARGS
441EOF
442 ;;
443 esac
444 ;;
445 __cmg_get_ref)
446 $FUNCNAME __cmg_err_no_arg $command $# && return 1
447 local change_id patchset_id hash
448 case $1 in
449 */*)
450 change_id=${1%%/*}
451 patchset_id=${1#*/}
452 ;;
453 *)
454 change_id=$1
455 patchset_id=1
456 ;;
457 esac
458 hash=$(($change_id % 100))
459 case $hash in
460 [0-9]) hash="0$hash" ;;
461 esac
462 echo "refs/changes/$hash/$change_id/$patchset_id"
463 ;;
464 fetch|pull)
465 $FUNCNAME __cmg_err_no_arg $command $# help && return 1
466 $FUNCNAME __cmg_err_not_repo && return 1
467 local change=$1
468 shift
469 git $command $@ http://$review/p/$project \
470 $($FUNCNAME __cmg_get_ref $change) || return 1
471 ;;
472 push)
473 $FUNCNAME __cmg_err_no_arg $command $# help && return 1
474 $FUNCNAME __cmg_err_not_repo && return 1
475 if [ -z "$user" ]; then
476 echo >&2 "Gerrit username not found."
477 return 1
478 fi
479 local local_branch remote_branch
480 case $1 in
481 *:*)
482 local_branch=${1%:*}
483 remote_branch=${1##*:}
484 ;;
485 *)
486 local_branch=HEAD
487 remote_branch=$1
488 ;;
489 esac
490 shift
491 git push $@ ssh://$user@$review:29418/$project \
492 $local_branch:refs/for/$remote_branch || return 1
493 ;;
494 changes|for)
Jackeagled6811aa2019-09-24 08:26:40 +0200495 if [ "$FUNCNAME" = "blissgerrit" ]; then
Michael Bestas3952f6c2016-08-26 01:12:08 +0300496 echo >&2 "'$FUNCNAME $command' is deprecated."
497 fi
498 ;;
499 __cmg_err_no_arg)
500 if [ $# -lt 2 ]; then
501 echo >&2 "'$FUNCNAME $command' missing argument."
502 elif [ $2 -eq 0 ]; then
503 if [ -n "$3" ]; then
504 $FUNCNAME help $1
505 else
506 echo >&2 "'$FUNCNAME $1' missing argument."
507 fi
508 else
509 return 1
510 fi
511 ;;
512 __cmg_err_not_repo)
513 if [ -z "$review" -o -z "$project" ]; then
514 echo >&2 "Not currently in any reviewable repository."
515 else
516 return 1
517 fi
518 ;;
519 __cmg_err_not_supported)
520 $FUNCNAME __cmg_err_no_arg $command $# && return
521 case $1 in
522 #TODO: filter more git commands that don't use refname
523 init|add|rm|mv|status|clone|remote|bisect|config|stash)
524 echo >&2 "'$FUNCNAME $1' is not supported."
525 ;;
526 *) return 1 ;;
527 esac
528 ;;
529 #TODO: other special cases?
530 *)
531 $FUNCNAME __cmg_err_not_supported $command && return 1
532 $FUNCNAME __cmg_err_no_arg $command $# help && return 1
533 $FUNCNAME __cmg_err_not_repo && return 1
534 local args="$@"
535 local change pre_args refs_arg post_args
536 case "$args" in
537 *--\ *)
538 pre_args=${args%%-- *}
539 post_args="-- ${args#*-- }"
540 ;;
541 *) pre_args="$args" ;;
542 esac
543 args=($pre_args)
544 pre_args=
545 if [ ${#args[@]} -gt 0 ]; then
546 change=${args[${#args[@]}-1]}
547 fi
548 if [ ${#args[@]} -gt 1 ]; then
549 pre_args=${args[0]}
550 for ((i=1; i<${#args[@]}-1; i++)); do
551 pre_args="$pre_args ${args[$i]}"
552 done
553 fi
554 while ((1)); do
555 case $change in
556 ""|--)
557 $FUNCNAME help $command
558 return 1
559 ;;
560 *@*)
561 if [ -z "$refs_arg" ]; then
562 refs_arg="@${change#*@}"
563 change=${change%%@*}
564 fi
565 ;;
566 *~*)
567 if [ -z "$refs_arg" ]; then
568 refs_arg="~${change#*~}"
569 change=${change%%~*}
570 fi
571 ;;
572 *^*)
573 if [ -z "$refs_arg" ]; then
574 refs_arg="^${change#*^}"
575 change=${change%%^*}
576 fi
577 ;;
578 *:*)
579 if [ -z "$refs_arg" ]; then
580 refs_arg=":${change#*:}"
581 change=${change%%:*}
582 fi
583 ;;
584 *) break ;;
585 esac
586 done
587 $FUNCNAME fetch $change \
588 && git $command $pre_args FETCH_HEAD$refs_arg $post_args \
589 || return 1
590 ;;
591 esac
592}
593
Jackeagled6811aa2019-09-24 08:26:40 +0200594function blissrebase() {
Michael Bestas3952f6c2016-08-26 01:12:08 +0300595 local repo=$1
596 local refs=$2
597 local pwd="$(pwd)"
598 local dir="$(gettop)/$repo"
599
600 if [ -z $repo ] || [ -z $refs ]; then
Dan Pasanen03447712016-12-19 11:22:55 -0600601 echo "LineageOS Gerrit Rebase Usage: "
Jackeagled6811aa2019-09-24 08:26:40 +0200602 echo " blissrebase <path to project> <patch IDs on Gerrit>"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300603 echo " The patch IDs appear on the Gerrit commands that are offered."
604 echo " They consist on a series of numbers and slashes, after the text"
605 echo " refs/changes. For example, the ID in the following command is 26/8126/2"
606 echo ""
607 echo " git[...]ges_apps_Camera refs/changes/26/8126/2 && git cherry-pick FETCH_HEAD"
608 echo ""
609 return
610 fi
611
612 if [ ! -d $dir ]; then
613 echo "Directory $dir doesn't exist in tree."
614 return
615 fi
616 cd $dir
617 repo=$(cat .git/config | grep git://github.com | awk '{ print $NF }' | sed s#git://github.com/##g)
618 echo "Starting branch..."
619 repo start tmprebase .
620 echo "Bringing it up to date..."
621 repo sync .
622 echo "Fetching change..."
Jackeagled6811aa2019-09-24 08:26:40 +0200623 git fetch "https://review.blissroms.com/p/$repo" "refs/changes/$refs" && git cherry-pick FETCH_HEAD
Michael Bestas3952f6c2016-08-26 01:12:08 +0300624 if [ "$?" != "0" ]; then
625 echo "Error cherry-picking. Not uploading!"
626 return
627 fi
628 echo "Uploading..."
629 repo upload .
630 echo "Cleaning up..."
631 repo abandon tmprebase .
632 cd $pwd
633}
634
635function mka() {
Luca Stefani085af722017-08-17 20:34:44 +0200636 m -j "$@"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300637}
638
639function cmka() {
640 if [ ! -z "$1" ]; then
641 for i in "$@"; do
642 case $i in
643 bacon|otapackage|systemimage)
644 mka installclean
645 mka $i
646 ;;
647 *)
648 mka clean-$i
649 mka $i
650 ;;
651 esac
652 done
653 else
654 mka clean
655 mka
656 fi
657}
658
Michael Bestas3952f6c2016-08-26 01:12:08 +0300659function repolastsync() {
660 RLSPATH="$ANDROID_BUILD_TOP/.repo/.repo_fetchtimes.json"
661 RLSLOCAL=$(date -d "$(stat -c %z $RLSPATH)" +"%e %b %Y, %T %Z")
662 RLSUTC=$(date -d "$(stat -c %z $RLSPATH)" -u +"%e %b %Y, %T %Z")
663 echo "Last repo sync: $RLSLOCAL / $RLSUTC"
664}
665
666function reposync() {
Luca Stefani085af722017-08-17 20:34:44 +0200667 repo sync -j 4 "$@"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300668}
669
670function repodiff() {
671 if [ -z "$*" ]; then
672 echo "Usage: repodiff <ref-from> [[ref-to] [--numstat]]"
673 return
674 fi
675 diffopts=$* repo forall -c \
676 'echo "$REPO_PATH ($REPO_REMOTE)"; git diff ${diffopts} 2>/dev/null ;'
677}
678
679# Return success if adb is up and not in recovery
680function _adb_connected {
681 {
Alessandro Astonecdf9ae82019-09-28 16:53:08 +0200682 if [[ "$(adb get-state)" == device ]]
Michael Bestas3952f6c2016-08-26 01:12:08 +0300683 then
684 return 0
685 fi
686 } 2>/dev/null
687
688 return 1
689};
690
691# Credit for color strip sed: http://goo.gl/BoIcm
692function dopush()
693{
694 local func=$1
695 shift
696
697 adb start-server # Prevent unexpected starting server message from adb get-state in the next line
698 if ! _adb_connected; then
699 echo "No device is online. Waiting for one..."
700 echo "Please connect USB and/or enable USB debugging"
701 until _adb_connected; do
702 sleep 1
703 done
704 echo "Device Found."
705 fi
706
Jackeagled6811aa2019-09-24 08:26:40 +0200707 if (adb shell getprop ro.bliss.device | grep -q "$BLISS_BUILD") || [ "$FORCE_PUSH" = "true" ];
Michael Bestas3952f6c2016-08-26 01:12:08 +0300708 then
709 # retrieve IP and PORT info if we're using a TCP connection
Marc K2be9cac2016-10-20 10:27:35 +0200710 TCPIPPORT=$(adb devices \
711 | 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 +0300712 | head -1 | awk '{print $1}')
713 adb root &> /dev/null
714 sleep 0.3
715 if [ -n "$TCPIPPORT" ]
716 then
717 # adb root just killed our connection
718 # so reconnect...
719 adb connect "$TCPIPPORT"
720 fi
721 adb wait-for-device &> /dev/null
Michael Bestas3952f6c2016-08-26 01:12:08 +0300722 adb remount &> /dev/null
723
724 mkdir -p $OUT
725 ($func $*|tee $OUT/.log;return ${PIPESTATUS[0]})
726 ret=$?;
727 if [ $ret -ne 0 ]; then
728 rm -f $OUT/.log;return $ret
729 fi
730
Rashed Abdel-Tawab01806642017-01-19 15:52:13 -0500731 is_gnu_sed=`sed --version | head -1 | grep -c GNU`
732
Michael Bestas3952f6c2016-08-26 01:12:08 +0300733 # Install: <file>
Rashed Abdel-Tawab01806642017-01-19 15:52:13 -0500734 if [ $is_gnu_sed -gt 0 ]; then
Dhina17dd2a6e72024-07-10 18:32:14 +0530735 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 +0200736 | grep '^Install: ' | cut -d ':' -f 2)"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300737 else
Dhina17dd2a6e72024-07-10 18:32:14 +0530738 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 +0200739 | grep '^Install: ' | cut -d ':' -f 2)"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300740 fi
741
742 # Copy: <file>
Rashed Abdel-Tawab01806642017-01-19 15:52:13 -0500743 if [ $is_gnu_sed -gt 0 ]; then
Dhina17dd2a6e72024-07-10 18:32:14 +0530744 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 +0200745 | grep '^Copy: ' | cut -d ':' -f 2)"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300746 else
Dhina17dd2a6e72024-07-10 18:32:14 +0530747 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 +0200748 | grep '^Copy: ' | cut -d ':' -f 2)"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300749 fi
750
751 # If any files are going to /data, push an octal file permissions reader to device
752 if [ -n "$(echo $LOC | egrep '(^|\s)/data')" ]; then
753 CHKPERM="/data/local/tmp/chkfileperm.sh"
754(
755cat <<'EOF'
Bruno Martins5bc28e22022-02-08 19:35:40 +0000756#!/system/bin/sh
Michael Bestas3952f6c2016-08-26 01:12:08 +0300757FILE=$@
758if [ -e $FILE ]; then
759 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
760fi
761EOF
762) > $OUT/.chkfileperm.sh
763 echo "Pushing file permissions checker to device"
764 adb push $OUT/.chkfileperm.sh $CHKPERM
765 adb shell chmod 755 $CHKPERM
766 rm -f $OUT/.chkfileperm.sh
767 fi
768
Sam Mortimerc3865952019-10-12 02:14:13 -0700769 RELOUT=$(echo $OUT | sed "s#^${ANDROID_BUILD_TOP}/##")
770
Michael Bestas3952f6c2016-08-26 01:12:08 +0300771 stop_n_start=false
Sam Mortimerc3865952019-10-12 02:14:13 -0700772 for TARGET in $(echo $LOC | tr " " "\n" | sed "s#.*${RELOUT}##" | sort | uniq); do
Roman Birgd51094c2018-03-28 09:47:30 -0700773 # 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 +0200774 case $TARGET in
Roman Birgd51094c2018-03-28 09:47:30 -0700775 /system/*|/data/*|/odm/*|/oem/*|/product/*|/product_services/*|/vendor/*)
Adrian DCa8e06d32018-06-17 00:15:00 +0200776 # Get out file from target (i.e. /system/bin/adb)
777 FILE=$OUT$TARGET
Michael Bestas3952f6c2016-08-26 01:12:08 +0300778 ;;
779 *) continue ;;
780 esac
781
782 case $TARGET in
783 /data/*)
784 # fs_config only sets permissions and se labels for files pushed to /system
785 if [ -n "$CHKPERM" ]; then
786 OLDPERM=$(adb shell $CHKPERM $TARGET)
787 OLDPERM=$(echo $OLDPERM | tr -d '\r' | tr -d '\n')
788 OLDOWN=$(adb shell ls -al $TARGET | awk '{print $2}')
789 OLDGRP=$(adb shell ls -al $TARGET | awk '{print $3}')
790 fi
791 echo "Pushing: $TARGET"
792 adb push $FILE $TARGET
793 if [ -n "$OLDPERM" ]; then
794 echo "Setting file permissions: $OLDPERM, $OLDOWN":"$OLDGRP"
795 adb shell chown "$OLDOWN":"$OLDGRP" $TARGET
796 adb shell chmod "$OLDPERM" $TARGET
797 else
798 echo "$TARGET did not exist previously, you should set file permissions manually"
799 fi
800 adb shell restorecon "$TARGET"
801 ;;
Michael Wec0363e2020-06-17 17:37:09 +0200802 */SystemUI.apk|*/framework/*)
Michael Bestas3952f6c2016-08-26 01:12:08 +0300803 # Only need to stop services once
804 if ! $stop_n_start; then
805 adb shell stop
806 stop_n_start=true
807 fi
808 echo "Pushing: $TARGET"
809 adb push $FILE $TARGET
810 ;;
811 *)
812 echo "Pushing: $TARGET"
813 adb push $FILE $TARGET
814 ;;
815 esac
816 done
817 if [ -n "$CHKPERM" ]; then
818 adb shell rm $CHKPERM
819 fi
820 if $stop_n_start; then
821 adb shell start
822 fi
823 rm -f $OUT/.log
824 return 0
825 else
Jackeagled6811aa2019-09-24 08:26:40 +0200826 echo "The connected device does not appear to be $BLISS_BUILD, run away!"
Michael Bestas3952f6c2016-08-26 01:12:08 +0300827 fi
828}
829
830alias mmp='dopush mm'
831alias mmmp='dopush mmm'
832alias mmap='dopush mma'
Zhao Wei Liew64fc5ae2016-12-10 16:48:27 +0800833alias mmmap='dopush mmma'
Michael Bestas3952f6c2016-08-26 01:12:08 +0300834alias mkap='dopush mka'
835alias cmkap='dopush cmka'
836
837function repopick() {
838 T=$(gettop)
Jackeagled6811aa2019-09-24 08:26:40 +0200839 $T/vendor/bliss/build/tools/repopick.py $@
Michael Bestas3952f6c2016-08-26 01:12:08 +0300840}
841
Michael Bestas656f7e52022-06-09 18:50:47 +0300842function sort-blobs-list() {
843 T=$(gettop)
844 $T/tools/extract-utils/sort-blobs-list.py $@
845}
846
Michael Bestas3952f6c2016-08-26 01:12:08 +0300847function fixup_common_out_dir() {
848 common_out_dir=$(get_build_var OUT_DIR)/target/common
849 target_device=$(get_build_var TARGET_DEVICE)
Sam Mortimer55d6ec52019-09-10 11:40:34 -0700850 common_target_out=common-${target_device}
Jackeagle305db7c2020-01-23 10:35:22 +0100851 if [ ! -z $BLISS_FIXUP_COMMON_OUT ]; then
Michael Bestas3952f6c2016-08-26 01:12:08 +0300852 if [ -d ${common_out_dir} ] && [ ! -L ${common_out_dir} ]; then
853 mv ${common_out_dir} ${common_out_dir}-${target_device}
Sam Mortimer55d6ec52019-09-10 11:40:34 -0700854 ln -s ${common_target_out} ${common_out_dir}
Michael Bestas3952f6c2016-08-26 01:12:08 +0300855 else
856 [ -L ${common_out_dir} ] && rm ${common_out_dir}
857 mkdir -p ${common_out_dir}-${target_device}
Sam Mortimer55d6ec52019-09-10 11:40:34 -0700858 ln -s ${common_target_out} ${common_out_dir}
Michael Bestas3952f6c2016-08-26 01:12:08 +0300859 fi
860 else
861 [ -L ${common_out_dir} ] && rm ${common_out_dir}
862 mkdir -p ${common_out_dir}
863 fi
864}
Jackeagle305db7c2020-01-23 10:35:22 +0100865
866function blissify()
867{
Jon West6f429fa2021-04-24 18:09:38 -0400868 abt="$ANDROID_BUILD_TOP"
869 cd $abt
870 clean="n"
871 deviceclean="n"
872 export BLISS_BUILD_VARIANT=vanilla
873 while test $# -gt 0
874 do
875 case $1 in
876
877 # Normal option processing
878 -h | --help)
879 echo "Usage: $0 options deviceCodename "
880 echo "options: -h | --help: Shows this dialog"
881 echo " -c | --clean: Clean up before running the build"
882 echo " -d | --devclean: Clean up device tree before running the build"
883 echo " -v | --vanilla: Build with no added app store solution **default option** "
Jis G Jacobfa721362024-10-27 12:34:10 -0400884 echo " -g | --gapps: Build with Google Play Services added"
Jon West6f429fa2021-04-24 18:09:38 -0400885 echo " -f | --fossa: build with FOSS (arm64-v8a) app store solutions added"
886 echo " -F | --fossx: build with FOSS (x86_64) app store solutions added"
Jackeagle5256b752023-08-03 14:14:46 -0400887 echo " -m | --microg: Build with MicroG added"
Jon West6f429fa2021-04-24 18:09:38 -0400888 echo ""
889 echo "deviceCodename: "
890 echo "your device codename, without the 'bliss_' in front"
891 echo ""
892 ;;
893 -c | --clean)
894 clean="y";
895 echo "Cleaning build and device tree selected."
896 ;;
897 -d | --devclean)
898 deviceclean="y";
899 echo "Cleaning device tree selected."
900 ;;
901 -v | --vanilla)
902 echo "Building as stock (no gapps) **DEFAULT**"
903 export BLISS_BUILD_VARIANT=vanilla
904 ;;
905 -g | --gapps)
Jis G Jacobfa721362024-10-27 12:34:10 -0400906 echo "Building with Gapps"
Jon West6f429fa2021-04-24 18:09:38 -0400907 export BLISS_BUILD_VARIANT=gapps
908 ;;
909 -f | --fossa)
910 echo "Building with FOSS apps for arm64-v8a support"
911 export BLISS_BUILD_VARIANT=foss
912 cd vendor/foss
913 bash update.sh 2
914 cd $abt
915 ;;
916 -F | --fossx)
917 echo "Building with FOSS apps for x86_64 support"
918 export BLISS_BUILD_VARIANT=foss
919 cd vendor/foss
920 bash update.sh 1
921 cd $abt
922 ;;
Jackeagle5256b752023-08-03 14:14:46 -0400923 -m | --microg)
924 echo "Building with MicroG"
925 export BLISS_BUILD_VARIANT=microg
926 ;;
Jon West68fe7e52021-06-02 15:24:20 -0400927 -u | --userdebug)
928 echo "Building userdebug variant"
929 TARGET_BUILD_VARIANT=userdebug
930 ;;
931 -U | --user)
932 echo "Building user variant"
933 TARGET_BUILD_VARIANT=user
934 ;;
935 -e | --eng)
936 echo "Building eng variant"
937 TARGET_BUILD_VARIANT=eng
938 ;;
939
Jon West6f429fa2021-04-24 18:09:38 -0400940
941 # ...
942
943 # Special cases
944 --)
945 echo "Please use --help to verify correct usage"
946 break
947 ;;
948 --*)
949 # error unknown (long) option $1
950 echo "Please use --help to verify correct usage"
951 break
952 ;;
953 -?)
954 echo "Please use --help to verify correct usage"
955 # error unknown (short) option $1
956 break
957 ;;
958
959 # FUN STUFF HERE:
960 # Split apart combined short options
961 -*)
962 split=$1
963 shift
964 set -- $(echo "$split" | cut -c 2- | sed 's/./-& /g') "$@"
965 continue
966 ;;
967
968 # Done with options
969 *)
970 break
971 ;;
972 esac
973
974 # for testing purposes:
975 shift
976 done
Jon West6f429fa2021-04-24 18:09:38 -0400977 if [ "$1" == "" ]; then
978 echo "No device name specified. Please use --help to verify correct usage"
979 return 0
980 fi
Jackeagle911602f2021-12-06 05:17:55 +0100981
Jon West68fe7e52021-06-02 15:24:20 -0400982 # Breakfast extension
983 if [ $TARGET_BUILD_VARIANT == "user" ];then
984 breakfast $* user
985 elif [ $TARGET_BUILD_VARIANT == "eng" ];then
986 breakfast $* eng
987 else
988 breakfast $*
989 fi
Jackeagled52fd812021-09-10 23:21:00 -0400990
991 if [ $clean == "y" ];then
992 echo "Cleaning up a bit"
993 make clean && make clobber
994 fi
995
996 if [ $deviceclean == "y" ];then
997 echo "Doing some device cleanup"
998 make deviceclean
999 fi
1000
Jackeagle305db7c2020-01-23 10:35:22 +01001001 if [ $? -eq 0 ]; then
1002 mka blissify
1003 else
Jon West6f429fa2021-04-24 18:09:38 -04001004 echo "No such item in brunch menu. Try 'breakfast' or verify your product is added to AndroidProducts.mk"
Jackeagle305db7c2020-01-23 10:35:22 +01001005 return 1
1006 fi
1007 return $?
1008}
Danny Line0ece602021-11-12 11:25:02 +00001009
1010# Override host metadata to make builds more reproducible and avoid leaking info
1011export BUILD_USERNAME=nobody
1012export BUILD_HOSTNAME=android-build