Files
scripts/aosp-merger/aosp-merger.sh
Michael Bestas e736c1d62e aosp-merger: Add script that pushes the merge to refs/heads
Change-Id: I6d263d8ccc6fc6854b8e9d7301e556b15987a2e7
2023-03-21 04:59:43 +05:30

82 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
#
# SPDX-FileCopyrightText: 2022 The Calyx Institute
#
# SPDX-License-Identifier: Apache-2.0
#
# merge-aosp:
#
# Merge the latest AOSP release based on variables
#
#
##############################################################################
### SET ###
# use bash strict mode
set -euo pipefail
### TRAPS ###
# trap signals for clean exit
trap 'exit $?' EXIT
trap 'error_m interrupted!' SIGINT
### CONSTANTS ###
readonly script_path="$(cd "$(dirname "$0")";pwd -P)"
readonly vars_path="${script_path}/../vars"
source "${vars_path}/common"
## HELP MESSAGE (USAGE INFO)
# TODO
### FUNCTIONS ###
merge_aosp_forks() {
"${script_path}"/merge-aosp-forks.sh merge "${prev_aosp_tag}" "${aosp_tag}"
}
squash_aosp_merge() {
"${script_path}"/squash.sh merge "${prev_aosp_tag}" "${aosp_tag}"
}
upload_squash_to_review() {
"${script_path}"/upload-squash.sh merge "${prev_aosp_tag}" "${aosp_tag}"
}
push_merge() {
"${script_path}"/push-merge.sh merge "${prev_aosp_tag}" "${aosp_tag}"
}
# error message
# ARG1: error message for STDERR
# ARG2: error status
error_m() {
echo "ERROR: ${1:-'failed.'}" 1>&2
return "${2:-1}"
}
# print help message.
help_message() {
echo "${help_message:-'No help available.'}"
}
main() {
merge_aosp_forks
read -p "Waiting for conflict resolution before squashing. Press enter when done."
read -p "Once more, just to be safe"
squash_aosp_merge
upload_squash_to_review
echo "Don't forget to update the manifest!"
}
### RUN PROGRAM ###
main "${@}"
##