aosp-merger: Switch all scripts to argument parsing

Change-Id: I7af863d3952e7ae9de16860404bccd2b582caa20
This commit is contained in:
Michael Bestas
2022-06-19 02:54:34 +03:00
committed by Chirayu Desai
parent f3b9352ed8
commit c44154f25c
8 changed files with 197 additions and 89 deletions

View File

@@ -7,23 +7,27 @@
#
usage() {
echo "Usage ${0} <merge|rebase> <oldaosptag> <newaosptag>"
echo "Usage ${0} -b <branch-suffix>"
}
# Verify argument count
if [ "$#" -ne 3 ]; then
if [ "${#}" -eq 0 ]; then
usage
exit 1
fi
OPERATION="${1}"
OLDTAG="${2}"
NEWTAG="${3}"
if [ "${OPERATION}" != "merge" -a "${OPERATION}" != "rebase" ]; then
usage
exit 1
fi
while [ "${#}" -gt 0 ]; do
case "${1}" in
-b | --branch-suffix )
BRANCHSUFFIX="${2}"; shift
;;
* )
usage
exit 1
;;
esac
shift
done
### CONSTANTS ###
readonly script_path="$(cd "$(dirname "$0")";pwd -P)"
@@ -33,7 +37,7 @@ source "${vars_path}/common"
TOP="${script_path}/../../.."
BRANCH="${lineageos_branch}"
STAGINGBRANCH="staging/${BRANCH}_${OPERATION}-${NEWTAG}"
STAGINGBRANCH="staging/${BRANCHSUFFIX}"
# Source build environment (needed for lineageremote)
source "${TOP}/build/envsetup.sh"