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 19DEV_BRANCH=main 20MAINLINE_BRANCH=udc-mainline-prod 21 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## 29current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/\].*$//'|sed -e 's/:.*$//'| sed -e 's/^goog\///'` 30if [ "${current}" = "" ] ; then 31 current=unknown 32fi 33 34# 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 46fi 47 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# 51exit 77 52 53