All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saul Wold <sgw@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 21/30] send-pull-request: remove local mta support
Date: Wed, 18 May 2011 15:26:50 -0700	[thread overview]
Message-ID: <183a273ff59e4bb908c0a4b9ae670bdab414f39c.1305756950.git.sgw@linux.intel.com> (raw)
In-Reply-To: <fc7402495a8a30b203d5535e73383bc4412e2a1f.1305756950.git.sgw@linux.intel.com>
In-Reply-To: <cover.1305756950.git.sgw@linux.intel.com>

From: Darren Hart <dvhart@linux.intel.com>

There is no real value in supporting sendmail directly when git
can be configured to use it. The script used to generate the
pull request mails relies heavily on git, so doing so here does
not impose any additional dependencies and it greatly reduces the
complexity of this script.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
Cc: Otavio Salvador <otavio@ossystems.com.br>
---
 scripts/send-pull-request |  108 +++++++++------------------------------------
 1 files changed, 21 insertions(+), 87 deletions(-)

diff --git a/scripts/send-pull-request b/scripts/send-pull-request
index 76dd7a2d..d265c47 100755
--- a/scripts/send-pull-request
+++ b/scripts/send-pull-request
@@ -1,15 +1,9 @@
 #!/bin/bash
 AUTO=0
 
-# Check env for any default settings, command line options will override these.
-if [ -z "$PULL_MTA" ]; then
-    PULL_MTA="sendmail"
-fi
-
 # Prevent environment leakage to these vars.
 unset TO
 unset CC
-# allow the user to set FROM in the environment
 
 usage()
 {
@@ -18,10 +12,6 @@ Usage: $(basename $0) [-h] [-a] [[-t email]...] -p pull-dir
   -t email     Explicitly add email to the recipients
   -a           Automatically harvest recipients from "*-by: email" lines
                in the patches in the pull-dir
-  -f           Specify a FROM address, you can also use the FROM environment
-               variable. If you do not specify one, it will try to use the one
-               from your git config. This is ignored if -g is used.
-  -g           Use git-send-email to send mail instead of sendmail
   -p pull-dir  Directory containing summary and patch files
 EOM
 }
@@ -49,17 +39,11 @@ harvest_recipients()
 
 
 # Parse and verify arguments
-while getopts "af:ghp:t:" OPT; do
+while getopts "ahp:t:" OPT; do
 	case $OPT in
 	a)
 		AUTO=1
 		;;
-	f)
-		FROM="$OPTARG"
-		;;
-	g)
-		PULL_MTA="git"
-		;;
 	h)
 		usage
 		exit 0
@@ -109,29 +93,14 @@ if [ $AUTO -eq 1 ]; then
 	harvest_recipients CC "^.*-[Bb][Yy]: *"
 fi
 
-case "$PULL_MTA" in
-git)
-	FROM="$(git config sendemail.from)"
-	AUTO_TO="$(git config sendemail.to)"
-	if [ -n "$AUTO_TO" ]; then
-		if [ -n "$TO" ]; then
-			TO="$TO,$AUTO_TO"
-		else
-			TO="$AUTO_TO"
-		fi
+AUTO_TO="$(git config sendemail.to)"
+if [ -n "$AUTO_TO" ]; then
+	if [ -n "$TO" ]; then
+		TO="$TO,$AUTO_TO"
+	else
+		TO="$AUTO_TO"
 	fi
-	;;
-sendmail)
-	if [ -z "$FROM" ]; then
-		FROM="$(git config user.name) <$(git config user.email)>"
-		if [ -z "$FROM" ]; then
-			echo "ERROR: unable to determine a FROM address"
-			usage
-			exit 1
-		fi
-	fi
-	;;
-esac
+fi
 
 if [ -z "$TO" ] && [ -z "$CC" ]; then
 	echo "ERROR: you have not specified any recipients."
@@ -145,10 +114,7 @@ cat <<EOM
 The following patches:
 $(for PATCH in $PDIR/*.patch; do echo "    $PATCH"; done)
 
-will be sent with the following headers:
-  From: $FROM
-    To: $TO
-    CC: $CC
+will now be sent via the git send-email command.
 
 EOM
 echo "Continue? [y/N] "
@@ -156,52 +122,20 @@ read cont
 
 if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then
 	ERROR=0
-	case "$PULL_MTA" in
-	git)
-		export IFS=$','
-		GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done)
-		GIT_CC=$(for R in $CC; do echo -n "--cc='$R' "; done)
-		unset IFS
-		for PATCH in $PDIR/*patch; do
-			# We harvest the emails manually, so force git not to.
-			eval "git send-email $GIT_TO $GIT_CC --no-chain-reply-to --suppress-cc=all $PATCH"
-			if [ $? -eq 1 ]; then
-				ERROR=1
-			fi
-		done
-		;;
-	sendmail)
-		for PATCH in $PDIR/*patch; do
-			# Insert To and CC headers via formail to keep them separate and
-			# appending them to the sendmail command as -- $TO $CC has
-			# proven to be an exercise in futility.
-			#
-			# Clear the From header, leaving it up to sendmail to insert an
-			# appropriate one. Insert the original sender (per git) into the
-			# body of the message.
-			#
-			# Use tail to remove the email envelope from git or formail as
-			# msmtp (sendmail) would choke on them.
-			#
-			# Modify the patch date for sequential delivery, but retain the
-			# original date as "Old-Date".
-			DATE=$(date +"%a, %d %b %Y %k:%M:%S %z")
-			GIT_FROM=$(cat $PATCH | formail -X "From:")
-			cat $PATCH | formail -I "To: $TO" -I "CC: $CC" -I "From: $FROM" -i "Date: $DATE" | sed "0,/^$/s/^$/\n$GIT_FROM\n/" | tail -n +2 | sendmail -t
-			if [ $? -eq 1 ]; then
-				ERROR=1
-			fi
-		done
-		;;
-	*)
-		echo "ERROR: unknown MTA: $PULL_MTA"
-		usage
-		exit 1
-		;;
-	esac
+	export IFS=$','
+	GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done)
+	GIT_CC=$(for R in $CC; do echo -n "--cc='$R' "; done)
+	unset IFS
+	for PATCH in $PDIR/*patch; do
+		# We harvest the emails manually, so force git not to.
+		eval "git send-email $GIT_TO $GIT_CC --no-chain-reply-to --suppress-cc=all $PATCH"
+		if [ $? -eq 1 ]; then
+			ERROR=1
+		fi
+	done
 
 	if [ $ERROR -eq 1 ]; then
-		echo "ERROR: Failed to send one or more messages. Check your MTA log for details."
+		echo "ERROR: Failed to send one or more messages."
 	fi
 else
 	echo "Send aborted."
-- 
1.7.3.4




  parent reply	other threads:[~2011-05-18 22:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-18 22:26 [PATCH 00/30] 18-May-2011 Consolidated Pull Saul Wold
2011-05-18 22:26 ` [PATCH 01/30] diffutils: fix libc overrides Saul Wold
2011-05-18 22:26 ` [PATCH 02/30] findutils: " Saul Wold
2011-05-18 22:26 ` [PATCH 03/30] lsof: " Saul Wold
2011-05-18 22:26 ` [PATCH 04/30] sysstat: " Saul Wold
2011-05-18 22:26 ` [PATCH 05/30] tcp-wrappers: " Saul Wold
2011-05-18 22:26 ` [PATCH 06/30] linux-yocto: fix gcc 4.6.0 compilation failures Saul Wold
2011-05-18 22:26 ` [PATCH 07/30] lsbsetup: Rename this file and add a link for lsb test Saul Wold
2011-05-18 22:26 ` [PATCH 08/30] package-index.bb: add support for deb and rpm Saul Wold
2011-05-19 22:33   ` Richard Purdie
2011-05-20  1:13     ` Cui, Dexuan
2011-05-18 22:26 ` [PATCH 09/30] extract bitbake config setting into data_define, use more variables replacing hardcoded values Saul Wold
2011-05-18 22:26 ` [PATCH 10/30] Add adt repo checking Saul Wold
2011-05-18 22:26 ` [PATCH 11/30] utils.bbclass: modify create_wrapper to correctly follow symlinks Saul Wold
2011-05-19 19:26   ` Koen Kooi
2011-05-18 22:26 ` [PATCH 12/30] mklibs-native: Update to 0.1.33 Saul Wold
2011-05-18 22:26 ` [PATCH 13/30] usbutils: Update to 0.91 Saul Wold
2011-05-18 22:26 ` [PATCH 14/30] qt4-tools-native: Fix the patch location Saul Wold
2011-05-18 22:26 ` [PATCH 15/30] create-pull-request: alphabetize arguments Saul Wold
2011-05-18 22:26 ` [PATCH 16/30] create-pull-request: whitespace cleanup Saul Wold
2011-05-18 22:26 ` [PATCH 17/30] create-pull-request: use git request-pull and arbitrary remotes Saul Wold
2011-05-18 22:26 ` [PATCH 18/30] create-pull-request: rewrite known private URLs to public URLs Saul Wold
2011-05-18 22:26 ` [PATCH 19/30] create-pull-request: provide an RFC mode via -c argument Saul Wold
2011-05-18 22:26 ` [PATCH 20/30] send-pull-request: whitespace cleanup Saul Wold
2011-05-18 22:26 ` Saul Wold [this message]
2011-05-18 22:26 ` [PATCH 22/30] send-pull-request: fix greedy auto-cc regex Saul Wold
2011-05-18 22:26 ` [PATCH 23/30] send-pull-request: don't send all patches to everyone even with -a Saul Wold
2011-05-18 22:26 ` [PATCH 24/30] send-pull-request: verify git sendemail config Saul Wold
2011-05-18 22:26 ` [PATCH 25/30] create-pull-request: do not check certificate Saul Wold
2011-05-18 22:26 ` [PATCH 26/30] create-pull-request: add GitHub remote support Saul Wold
2011-05-18 22:26 ` [PATCH 27/30] create-pull-request: add untested oe repository support Saul Wold
2011-05-18 22:26 ` [PATCH 28/30] send-pull-request: streamline git-send-email usage Saul Wold
2011-05-18 22:26 ` [PATCH 29/30] *pull-request: add copyright, license, and descriptions Saul Wold
2011-05-18 22:26 ` [PATCH 30/30] u-boot: update SRCREV to 2011.03 Saul Wold
2011-05-19 22:42 ` [PATCH 00/30] 18-May-2011 Consolidated Pull Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=183a273ff59e4bb908c0a4b9ae670bdab414f39c.1305756950.git.sgw@linux.intel.com \
    --to=sgw@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.