Merge "The latest version of finalization scripts."

This commit is contained in:
Treehugger Robot 2022-12-01 01:19:28 +00:00 committed by Gerrit Code Review
commit 30aeecb648
3 changed files with 117 additions and 11 deletions

35
finalize-sdk-rel.sh Executable file
View file

@ -0,0 +1,35 @@
#!/bin/bash
set -ex
function finalize_sdk_rel() {
local DEV_SRC_DIR="$(dirname "$0")"/../..
local BUILD_PREFIX='UP1A'
local PLATFORM_CODENAME='UpsideDownCake'
local PLATFORM_VERSION='14'
local PLATFORM_SDK_VERSION='34'
# build/make/core/version_defaults.mk
sed -i -e "s/PLATFORM_VERSION_CODENAME.${BUILD_PREFIX} := .*/PLATFORM_VERSION_CODENAME.${BUILD_PREFIX} := REL/g" "$DEV_SRC_DIR/build/make/core/version_defaults.mk"
# cts
echo "$PLATFORM_VERSION" > "$DEV_SRC_DIR/cts/tests/tests/os/assets/platform_versions.txt"
git -C "$DEV_SRC_DIR/cts" mv hostsidetests/theme/assets/${PLATFORM_CODENAME} hostsidetests/theme/assets/${PLATFORM_SDK_VERSION}
# system/sepolicy
mkdir -p "$DEV_SRC_DIR/system/sepolicy/prebuilts/api/${PLATFORM_SDK_VERSION}.0/"
cp -r "$DEV_SRC_DIR/system/sepolicy/public/" "$DEV_SRC_DIR/system/sepolicy/prebuilts/api/${PLATFORM_SDK_VERSION}.0/"
cp -r "$DEV_SRC_DIR/system/sepolicy/private/" "$DEV_SRC_DIR/system/sepolicy/prebuilts/api/${PLATFORM_SDK_VERSION}.0/"
# prebuilts/abi-dumps/ndk
git -C "$DEV_SRC_DIR/prebuilts/abi-dumps/ndk" mv ${PLATFORM_CODENAME} ${PLATFORM_SDK_VERSION}
# prebuilts/abi-dumps/vndk
git -C "$DEV_SRC_DIR/prebuilts/abi-dumps/vndk" mv ${PLATFORM_CODENAME} ${PLATFORM_SDK_VERSION}
# prebuilts/abi-dumps/platform
git -C "$DEV_SRC_DIR/prebuilts/abi-dumps/platform" mv ${PLATFORM_CODENAME} ${PLATFORM_SDK_VERSION}
}
finalize_sdk_rel

View file

@ -2,18 +2,43 @@
# Continuous Integration script for *-finalization-1 branches.
# Reverts previous finalization script commits and runs local build.
set -ex
function revert_to_unfinalized_state() {
repo forall -c '\
git checkout . ; git revert --abort ; git clean -fdx ;\
git checkout @ ; git branch fina-step1 -D ; git reset --hard; \
repo start fina-step1 ; git checkout @ ; git b fina-step1 -D ;\
baselineHash="$(git log --format=%H --no-merges --max-count=1 --grep ^FINALIZATION_STEP_1_BASELINE_COMMIT)" ;\
declare -a projects=(
"build/make/"
"build/soong/"
"cts/"
"frameworks/base/"
"frameworks/hardware/interfaces/"
"frameworks/libs/modules-utils/"
"frameworks/libs/net/"
"hardware/interfaces/"
"libcore/"
"packages/services/Car/"
"platform_testing/"
"prebuilts/abi-dumps/ndk/"
"prebuilts/abi-dumps/platform/"
"prebuilts/abi-dumps/vndk/"
"system/hardware/interfaces/"
"system/tools/aidl/"
"tools/platform-compat"
"device/generic/car"
"development"
)
for project in "${projects[@]}"
do
local git_path="$top/$project"
echo "Reverting: $git_path"
baselineHash="$(git -C $git_path log --format=%H --no-merges --max-count=1 --grep ^FINALIZATION_STEP_1_BASELINE_COMMIT)" ;
if [[ $baselineHash ]]; then
previousHash="$(git log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT $baselineHash..HEAD | tr \n \040)" ;\
previousHash="$(git -C $git_path log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT $baselineHash..HEAD | tr \n \040)" ;
else
previousHash="$(git log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT | tr \n \040)" ;\
fi ; \
if [[ $previousHash ]]; then git revert --no-commit --strategy=ort --strategy-option=ours $previousHash ; fi ;'
previousHash="$(git -C $git_path log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT | tr \n \040)" ;
fi ;
if [[ $previousHash ]]; then git -C $git_path revert --no-commit --strategy=ort --strategy-option=ours $previousHash ; fi ;
done
}
function finalize_step_1_main() {
@ -22,8 +47,6 @@ function finalize_step_1_main() {
revert_to_unfinalized_state
set -ex
# vndk etc finalization
source $top/build/make/finalize-aidl-vndk-sdk-resources.sh

48
finalize-step-2.sh Executable file
View file

@ -0,0 +1,48 @@
#!/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_to_unfinalized_state() {
repo forall -c '\
git checkout . ; git revert --abort ; git clean -fdx ;\
git checkout @ ; git branch fina-step2 -D ; git reset --hard; \
repo start fina-step2 ; git checkout @ ; git b fina-step2 -D ;\
baselineHash="$(git log --format=%H --no-merges --max-count=1 --grep ^FINALIZATION_STEP_2_BASELINE_COMMIT)" ;\
if [[ $baselineHash ]]; then
previousHash="$(git log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_2_SCRIPT_COMMIT $baselineHash..HEAD | tr \n \040)" ;\
else
previousHash="$(git log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_2_SCRIPT_COMMIT | tr \n \040)" ;\
fi ; \
if [[ $previousHash ]]; then git revert --no-commit --strategy=ort --strategy-option=ours $previousHash ; fi ;'
}
function commit_changes() {
repo forall -c '\
if [[ $(git status --short) ]]; then
repo start fina-step1 ;
git add -A . ;
git commit -m FINALIZATION_STEP_2_SCRIPT_COMMIT -m WILL_BE_AUTOMATICALLY_REVERTED ;
repo upload --cbr --no-verify -t -y . ;
git clean -fdx ; git reset --hard ;
fi'
}
function finalize_step_2_main() {
local top="$(dirname "$0")"/../..
repo selfupdate
revert_to_unfinalized_state
# vndk etc finalization
source $top/build/make/finalize-aidl-vndk-sdk-resources.sh
# move all changes to fina-step1 branch and commit with a robot message
commit_changes
}
finalize_step_2_main