Ray Essick | 1ca2522 | 2020-05-26 14:20:40 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #set -x |
| 3 | |
| 4 | # called for repo projects that are part of the media mainline modules |
| 5 | # this is for projects where the entire project is part of mainline. |
| 6 | # we have a separate script for projects where only part of that project gets |
| 7 | # pulled into mainline. |
| 8 | # |
| 9 | # if the project's PREUPLOAD.cfg points to this script, it is by definition a project |
| 10 | # which is entirely within mainline. |
| 11 | # |
| 12 | # example PREUPLOAD.cfg using this script |
| 13 | # [Hook Scripts] |
| 14 | # mainline_hook = ${REPO_ROOT}/frameworks/av/tools/mainline_hook_project.sh |
| 15 | # |
| 16 | |
| 17 | |
| 18 | # tunables |
Ray Essick | be5e36b | 2021-02-10 09:56:45 -0800 | [diff] [blame] | 19 | DEV_BRANCH=master |
Ray Essick | 0a6eb00 | 2021-04-30 11:33:43 -0700 | [diff] [blame^] | 20 | MAINLINE_BRANCH=sc-mainline-prod |
Ray Essick | 1ca2522 | 2020-05-26 14:20:40 -0700 | [diff] [blame] | 21 | |
| 22 | ### |
| 23 | RED=$(tput setaf 1) |
| 24 | NORMAL=$(tput sgr0) |
| 25 | |
| 26 | ## check the active branch: |
| 27 | ## * b131183694 d198c6a [goog/master] Fix to handle missing checks on error returned |
| 28 | ## |
Ray Essick | be5e36b | 2021-02-10 09:56:45 -0800 | [diff] [blame] | 29 | current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/\].*$//'|sed -e 's/:.*$//'| sed -e 's/^goog\///'` |
Ray Essick | 1ca2522 | 2020-05-26 14:20:40 -0700 | [diff] [blame] | 30 | if [ "${current}" = "" ] ; then |
| 31 | current=unknown |
| 32 | fi |
| 33 | |
Ray Essick | be5e36b | 2021-02-10 09:56:45 -0800 | [diff] [blame] | 34 | # simple reminder that it should also land in mainline branch |
| 35 | # |
| 36 | if [ "${current}" != "${MAINLINE_BRANCH}" ] ; then |
| 37 | # simple reminder to ensure it hits mainline |
| 38 | cat - <<EOF |
| 39 | You are uploading repo ${RED}${REPO_PATH}${NORMAL} to branch ${RED}${current}${NORMAL}. |
| 40 | The mainline branch for ${RED}${REPO_PATH}${NORMAL} is branch ${RED}${MAINLINE_BRANCH}${NORMAL}. |
| 41 | |
| 42 | Ensure an appropriate cherry pick or equivalent lands in branch ${RED}${MAINLINE_BRANCH}${NORMAL}. |
| 43 | Security bulletin timing or unreleased functionality may determine when that can be landed. |
| 44 | |
| 45 | EOF |
Ray Essick | 1ca2522 | 2020-05-26 14:20:40 -0700 | [diff] [blame] | 46 | fi |
| 47 | |
Ray Essick | be5e36b | 2021-02-10 09:56:45 -0800 | [diff] [blame] | 48 | # exit 0 is "all good, no output passed along to user" |
| 49 | # exit 77 is "all ok, but output is passed along to the user" |
| 50 | # |
| 51 | exit 77 |
Ray Essick | 1ca2522 | 2020-05-26 14:20:40 -0700 | [diff] [blame] | 52 | |