blob: 65f40732667a7dd693c0725e3436231452bbb532 [file] [log] [blame]
Ray Essick1ca25222020-05-26 14:20:40 -07001#!/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 Essick2e0df9c2024-09-03 09:03:48 -050019# as of 2024/5, things are all on the same branch
Ray Essick2f936012024-01-09 11:59:21 -060020DEV_BRANCH=main
Ray Essick2e0df9c2024-09-03 09:03:48 -050021MAINLINE_BRANCH=main
Ray Essick1ca25222020-05-26 14:20:40 -070022
23###
24RED=$(tput setaf 1)
25NORMAL=$(tput sgr0)
26
27## check the active branch:
28## * b131183694 d198c6a [goog/master] Fix to handle missing checks on error returned
29##
Ray Essickbe5e36b2021-02-10 09:56:45 -080030current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/\].*$//'|sed -e 's/:.*$//'| sed -e 's/^goog\///'`
Ray Essick1ca25222020-05-26 14:20:40 -070031if [ "${current}" = "" ] ; then
32 current=unknown
33fi
34
Ray Essickbe5e36b2021-02-10 09:56:45 -080035# simple reminder that it should also land in mainline branch
36#
37if [ "${current}" != "${MAINLINE_BRANCH}" ] ; then
38 # simple reminder to ensure it hits mainline
39 cat - <<EOF
40You are uploading repo ${RED}${REPO_PATH}${NORMAL} to branch ${RED}${current}${NORMAL}.
41The mainline branch for ${RED}${REPO_PATH}${NORMAL} is branch ${RED}${MAINLINE_BRANCH}${NORMAL}.
42
43Ensure an appropriate cherry pick or equivalent lands in branch ${RED}${MAINLINE_BRANCH}${NORMAL}.
44Security bulletin timing or unreleased functionality may determine when that can be landed.
45
46EOF
Ray Essick1ca25222020-05-26 14:20:40 -070047fi
48
Ray Essickbe5e36b2021-02-10 09:56:45 -080049# exit 0 is "all good, no output passed along to user"
50# exit 77 is "all ok, but output is passed along to the user"
51#
52exit 77
Ray Essick1ca25222020-05-26 14:20:40 -070053