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 19# as of 2024/5, things are all on the same branch 20DEV_BRANCH=main 21MAINLINE_BRANCH=main 22 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## 30current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/\].*$//'|sed -e 's/:.*$//'| sed -e 's/^goog\///'` 31if [ "${current}" = "" ] ; then 32 current=unknown 33fi 34 35# 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 47fi 48 49# 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 53 54