blob: 373dd2828d2eedf465dc39a520b855f90347dd13 [file] [log] [blame]
Alex Buynytskyy0842d212022-09-16 09:33:33 -07001#!/bin/bash
2# Automation for finalize_branch_for_release.sh.
3# Sets up local environment, runs the finalization script and submits the results.
4# WIP:
5# - does not submit, only sends to gerrit.
6
7# set -ex
8
Alex Buynytskyy92f501a2022-11-03 12:29:06 -07009function revert_to_unfinalized_state() {
Alex Buynytskyy0842d212022-09-16 09:33:33 -070010 repo forall -c '\
Alex Buynytskyy739a3112022-11-02 20:01:30 +000011 git checkout . ; git revert --abort ; git clean -fdx ;\
Alex Buynytskyy0842d212022-09-16 09:33:33 -070012 git checkout @ ; git b fina-step1 -D ; git reset --hard; \
13 repo start fina-step1 ; git checkout @ ; git b fina-step1 -D ;\
Alex Buynytskyy07bc3172022-11-01 18:45:51 -070014 previousHash="$(git log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT | tr \n \040)" ;\
Alex Buynytskyy92f501a2022-11-03 12:29:06 -070015 if [[ $previousHash ]]; then git revert --no-commit --strategy=ort --strategy-option=ours $previousHash ; fi ;'
Alex Buynytskyy0842d212022-09-16 09:33:33 -070016}
17
Alex Buynytskyy73e0f972022-09-23 11:09:21 -070018function commit_changes() {
19 repo forall -c '\
20 if [[ $(git status --short) ]]; then
21 repo start fina-step1 ;
22 git add -A . ;
23 git commit -m FINALIZATION_STEP_1_SCRIPT_COMMIT -m WILL_BE_AUTOMATICALLY_REVERTED ;
24 repo upload --cbr --no-verify -t -y . ;
25 git clean -fdx ; git reset --hard ;
26 fi'
27}
28
Alex Buynytskyy0842d212022-09-16 09:33:33 -070029function finalize_step_1_main() {
30 local top="$(dirname "$0")"/../..
31
32 repo selfupdate
33
Alex Buynytskyy92f501a2022-11-03 12:29:06 -070034 revert_to_unfinalized_state
Alex Buynytskyy0842d212022-09-16 09:33:33 -070035
36 # vndk etc finalization
Alex Buynytskyy3bd1b912022-09-22 11:30:53 -070037 source $top/build/make/finalize-aidl-vndk-sdk-resources.sh
Alex Buynytskyy0842d212022-09-16 09:33:33 -070038
39 # move all changes to fina-step1 branch and commit with a robot message
Alex Buynytskyy73e0f972022-09-23 11:09:21 -070040 commit_changes
Alex Buynytskyy0842d212022-09-16 09:33:33 -070041}
42
43finalize_step_1_main