From 6c6a1b5b8e9c51f984b965ad659ac5c967c8e0ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Mon, 8 Apr 2024 16:18:47 +0200 Subject: [PATCH] finalization: use same repo branch during dry-run Teach step-*.sh to re-use the same branch name if running in dry-run mode. This is useful for running the steps sequentially: if using different branch names, each 'repo start' will undo the changes created during the previous step-*.sh. Bug: 323940469 Test: croot && build/tools/finalization/step-1.sh --dry-run && build/tools/finalization/step-2.sh --dry-run Ignore-AOSP-first: VIC finalization happens outside AOSP Change-Id: I720f294f6abf5a8b276bb30f8c531fcbea749b76 --- tools/finalization/command-line-options.sh | 2 +- tools/finalization/step-0.sh | 5 +++-- tools/finalization/step-1.sh | 5 +++-- tools/finalization/step-2.sh | 5 +++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/finalization/command-line-options.sh b/tools/finalization/command-line-options.sh index 1c5df46cbb..d9397c2699 100644 --- a/tools/finalization/command-line-options.sh +++ b/tools/finalization/command-line-options.sh @@ -2,7 +2,7 @@ ARGV=$(getopt --options '' --long dry-run -- "$@") eval set -- "$ARGV" while true; do case "$1" in - --dry-run) repo_upload_dry_run_arg="--dry-run"; shift ;; + --dry-run) repo_upload_dry_run_arg="--dry-run"; repo_branch="finalization-dry-run"; shift ;; *) break esac done diff --git a/tools/finalization/step-0.sh b/tools/finalization/step-0.sh index 8da866c0dc..2087f6e670 100755 --- a/tools/finalization/step-0.sh +++ b/tools/finalization/step-0.sh @@ -9,7 +9,7 @@ function commit_step_0_changes() { set +e repo forall -c '\ if [[ $(git status --short) ]]; then - repo start "VINTF-$FINAL_BOARD_API_LEVEL-Finalization" ; + repo start "'$repo_branch'" ; git add -A . ; git commit -m "Vendor API level $FINAL_BOARD_API_LEVEL is now frozen" \ -m "Ignore-AOSP-First: VINTF $FINAL_BOARD_API_LEVEL Finalization @@ -21,8 +21,9 @@ Test: build"; function finalize_step_0_main() { local top="$(dirname "$0")"/../../../.. - source $top/build/make/tools/finalization/command-line-options.sh source $top/build/make/tools/finalization/environment.sh + local repo_branch="VINTF-$FINAL_BOARD_API_LEVEL-Finalization" + source $top/build/make/tools/finalization/command-line-options.sh local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug" diff --git a/tools/finalization/step-1.sh b/tools/finalization/step-1.sh index adc917e8de..736d64110e 100755 --- a/tools/finalization/step-1.sh +++ b/tools/finalization/step-1.sh @@ -7,7 +7,7 @@ function commit_step_1_changes() { set +e repo forall -c '\ if [[ $(git status --short) ]]; then - repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization" ; + repo start "'$repo_branch'" ; git add -A . ; git commit -m "$FINAL_PLATFORM_CODENAME is now $FINAL_PLATFORM_SDK_VERSION and extension version $FINAL_MAINLINE_EXTENSION" \ -m "Ignore-AOSP-First: $FINAL_PLATFORM_CODENAME Finalization @@ -19,8 +19,9 @@ Test: build"; function finalize_step_1_main() { local top="$(dirname "$0")"/../../../.. - source $top/build/make/tools/finalization/command-line-options.sh source $top/build/make/tools/finalization/environment.sh + local repo_branch="$FINAL_PLATFORM_CODENAME-SDK-Finalization" + source $top/build/make/tools/finalization/command-line-options.sh source $top/build/make/tools/finalization/finalize-sdk-resources.sh diff --git a/tools/finalization/step-2.sh b/tools/finalization/step-2.sh index 862c8f5217..52e388722e 100755 --- a/tools/finalization/step-2.sh +++ b/tools/finalization/step-2.sh @@ -4,7 +4,7 @@ function commit_step_2_changes() { repo forall -c '\ if [[ $(git status --short) ]]; then - repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization-Rel" ; + repo start "'$repo_branch'" ; git add -A . ; git commit -m "$FINAL_PLATFORM_CODENAME/$FINAL_PLATFORM_SDK_VERSION is now REL" \ -m "Ignore-AOSP-First: $FINAL_PLATFORM_CODENAME Finalization @@ -17,8 +17,9 @@ Test: build"; function finalize_step_2_main() { local top="$(dirname "$0")"/../../../.. - source $top/build/make/tools/finalization/command-line-options.sh source $top/build/make/tools/finalization/environment.sh + local repo_branch="$FINAL_PLATFORM_CODENAME-SDK-Finalization-Rel" + source $top/build/make/tools/finalization/command-line-options.sh # prebuilts etc source $top/build/make/tools/finalization/finalize-sdk-rel.sh