]>
git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/blob - scripts/send-pull-request
3 # Copyright (c) 2010-2011, Intel Corporation.
5 # SPDX-License-Identifier: GPL-2.0-or-later
9 # This script is intended to be used to send a patch series prepared by the
10 # create-pull-request script to Open Embedded and The Yocto Project, as well
11 # as to related projects and layers.
16 GITSOBCC
="--suppress-cc=all"
18 # Prevent environment leakage to these vars.
27 Usage: $(basename $0) [-h] [-a] [-c] [[-t email]...] -p pull-dir
28 -a Send the cover letter to every recipient listed in Cc and
29 Signed-off-by lines found in the cover letter and the patches.
30 This option implies -c.
31 -c Expand the Cc list for the individual patches using the Cc and
32 Signed-off-by lines from the same patch.
33 -C Add extra CC to each email sent.
34 -p pull-dir Directory containing summary and patch files
35 -t email Explicitly add email to the recipients
39 # Collect addresses from a patch into AUTO_CC
45 for REGX
in "^[Cc][Cc]: *" "^[Ss]igned-[Oo]ff-[Bb]y: *"; do
46 for EMAIL
in $
(sed '/^---$/q' $PATCH |
grep -e "$REGX" |
sed "s/$REGX//"); do
47 if [ "${AUTO_CC/$EMAIL/}" == "$AUTO_CC" ] && [ -n "$EMAIL" ]; then
48 if [ -z "$AUTO_CC" ]; then
51 AUTO_CC
="$AUTO_CC,$EMAIL";
59 # Parse and verify arguments
60 while getopts "acC:hp:t:" OPT
; do
64 GITSOBCC
="--signed-off-by-cc"
69 GITSOBCC
="--signed-off-by-cc"
80 if [ ! -d $PDIR ]; then
81 echo "ERROR: pull-dir \"$PDIR\" does not exist."
96 if [ -z "$PDIR" ]; then
97 echo "ERROR: you must specify a pull-dir."
103 # Verify the cover letter is complete and free of tokens
104 if [ -e $PDIR/0000-cover-letter.
patch ]; then
105 CL
="$PDIR/0000-cover-letter.patch"
106 for TOKEN
in SUBJECT BLURB
; do
107 grep -q "*** $TOKEN HERE ***" "$CL"
108 if [ $?
-eq 0 ]; then
109 echo "ERROR: Please edit $CL and try again (Look for '*** $TOKEN HERE ***')."
114 echo "WARNING: No cover letter will be sent."
117 # Harvest emails from the generated patches and populate AUTO_CC.
118 if [ $AUTO_CL -eq 1 ]; then
119 for PATCH
in $PDIR/*.
patch; do
120 harvest_recipients
$PATCH
124 AUTO_TO
="$(git config sendemail.to)"
125 if [ -n "$AUTO_TO" ]; then
126 if [ -n "$TO" ]; then
133 if [ -z "$TO" ] && [ -z "$AUTO_CC" ]; then
134 echo "ERROR: you have not specified any recipients."
140 # Convert the collected addresses into git-send-email argument strings
142 GIT_TO
=$
(for R
in $TO; do echo -n "--to='$R' "; done)
143 GIT_CC
=$
(for R
in $AUTO_CC; do echo -n "--cc='$R' "; done)
144 GIT_EXTRA_CC
=$
(for R
in $EXTRA_CC; do echo -n "--cc='$R' "; done)
147 # Handoff to git-send-email. It will perform the send confirmation.
148 # Mail threading was already handled by git-format-patch in
149 # create-pull-request, so we must not allow git-send-email to
150 # add In-Reply-To and References headers again.
151 PATCHES
=$
(echo $PDIR/*.
patch)
152 if [ $AUTO_CL -eq 1 ]; then
153 # Send the cover letter to every recipient, both specified as well as
154 # harvested. Then remove it from the patches list.
155 # --no-thread is redundant here (only sending a single message) and
156 # merely added for the sake of consistency.
157 eval "git send-email $GIT_TO $GIT_CC $GIT_EXTRA_CC --confirm=always --no-thread --suppress-cc=all $CL"
158 if [ $?
-eq 1 ]; then
159 echo "ERROR: failed to send cover-letter with automatic recipients."
162 PATCHES
=${PATCHES/"$CL"/}
165 # Send the patch to the specified recipients and, if -c was specified, those git
166 # finds in this specific patch.
167 eval "git send-email $GIT_TO $GIT_EXTRA_CC --confirm=always --no-thread $GITSOBCC $PATCHES"
168 if [ $?
-eq 1 ]; then
169 echo "ERROR: failed to send patches."