2022-09-16 18:33:33 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# Automation for finalize_branch_for_release.sh.
|
|
|
|
# Sets up local environment, runs the finalization script and submits the results.
|
|
|
|
# WIP:
|
|
|
|
# - does not submit, only sends to gerrit.
|
|
|
|
|
|
|
|
# set -ex
|
|
|
|
|
|
|
|
function revert_local_changes() {
|
|
|
|
repo forall -c '\
|
2022-11-02 21:01:30 +01:00
|
|
|
git checkout . ; git revert --abort ; git clean -fdx ;\
|
2022-09-16 18:33:33 +02:00
|
|
|
git checkout @ ; git b fina-step1 -D ; git reset --hard; \
|
|
|
|
repo start fina-step1 ; git checkout @ ; git b fina-step1 -D ;\
|
2022-11-02 02:45:51 +01:00
|
|
|
previousHash="$(git log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT | tr \n \040)" ;\
|
2022-11-02 21:01:30 +01:00
|
|
|
if [[ $previousHash ]]; then git revert --no-commit --strategy=ort --strategy-option=theirs $previousHash ; fi ;'
|
2022-09-16 18:33:33 +02:00
|
|
|
}
|
|
|
|
|
2022-09-23 20:09:21 +02:00
|
|
|
function commit_changes() {
|
|
|
|
repo forall -c '\
|
|
|
|
if [[ $(git status --short) ]]; then
|
|
|
|
repo start fina-step1 ;
|
|
|
|
git add -A . ;
|
|
|
|
git commit -m FINALIZATION_STEP_1_SCRIPT_COMMIT -m WILL_BE_AUTOMATICALLY_REVERTED ;
|
|
|
|
repo upload --cbr --no-verify -t -y . ;
|
|
|
|
git clean -fdx ; git reset --hard ;
|
|
|
|
fi'
|
|
|
|
}
|
|
|
|
|
2022-09-16 18:33:33 +02:00
|
|
|
function finalize_step_1_main() {
|
|
|
|
local top="$(dirname "$0")"/../..
|
|
|
|
|
|
|
|
repo selfupdate
|
|
|
|
|
|
|
|
revert_local_changes
|
|
|
|
|
|
|
|
# vndk etc finalization
|
2022-09-22 20:30:53 +02:00
|
|
|
source $top/build/make/finalize-aidl-vndk-sdk-resources.sh
|
2022-09-16 18:33:33 +02:00
|
|
|
|
|
|
|
# move all changes to fina-step1 branch and commit with a robot message
|
2022-09-23 20:09:21 +02:00
|
|
|
commit_changes
|
2022-09-16 18:33:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
finalize_step_1_main
|