aosp-merger: Add a tiny script that does the merging based on variables

Change-Id: I58bb25255293495bcb07667da1769f47640fdf4b
This commit is contained in:
Chirayu Desai
2022-01-10 02:54:55 +05:30
parent 551da8082b
commit 134fd8ad0a

73
aosp-merger/aosp-merger.sh Executable file
View File

@@ -0,0 +1,73 @@
#!/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}"
}
# 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
echo "TODO: Implement gerrit upload"
echo "Don't forget to update the manifest!"
}
### RUN PROGRAM ###
main "${@}"
##