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