blob: cb5fc44cd57f30b1ee4ede2c0f667efd00f04905 [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 Essickbe5e36b2021-02-10 09:56:45 -080019DEV_BRANCH=master
Ray Essick0a6eb002021-04-30 11:33:43 -070020MAINLINE_BRANCH=sc-mainline-prod
Ray Essick1ca25222020-05-26 14:20:40 -070021
22###
23RED=$(tput setaf 1)
24NORMAL=$(tput sgr0)
25
26## check the active branch:
27## * b131183694 d198c6a [goog/master] Fix to handle missing checks on error returned
28##
Ray Essickbe5e36b2021-02-10 09:56:45 -080029current=`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 -070030if [ "${current}" = "" ] ; then
31 current=unknown
32fi
33
Ray Essickbe5e36b2021-02-10 09:56:45 -080034# simple reminder that it should also land in mainline branch
35#
36if [ "${current}" != "${MAINLINE_BRANCH}" ] ; then
37 # simple reminder to ensure it hits mainline
38 cat - <<EOF
39You are uploading repo ${RED}${REPO_PATH}${NORMAL} to branch ${RED}${current}${NORMAL}.
40The mainline branch for ${RED}${REPO_PATH}${NORMAL} is branch ${RED}${MAINLINE_BRANCH}${NORMAL}.
41
42Ensure an appropriate cherry pick or equivalent lands in branch ${RED}${MAINLINE_BRANCH}${NORMAL}.
43Security bulletin timing or unreleased functionality may determine when that can be landed.
44
45EOF
Ray Essick1ca25222020-05-26 14:20:40 -070046fi
47
Ray Essickbe5e36b2021-02-10 09:56:45 -080048# 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#
51exit 77
Ray Essick1ca25222020-05-26 14:20:40 -070052