summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2012-02-29 07:29:59 +0100
committerJean Delvare <jdelvare@suse.de>2012-02-29 07:29:59 +0100
commit00f78e8f362ca5c8296db11743c538adb174d09c (patch)
tree512c0857453b347c1fcde094a2341cf25bf3779d
parentccb1e6fd42701b6d2e44a0e592dfd18eacf140f8 (diff)
parent243de652883f2b9c36c0987a1a6e24c55922ed49 (diff)
downloadquilt-00f78e8f362ca5c8296db11743c538adb174d09c.tar.gz
Merge remote branch 'origin/fixes-0.51'
-rw-r--r--configure.ac4
-rw-r--r--quilt/mail.in54
-rw-r--r--quilt/scripts/edmail.in19
3 files changed, 58 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index 54d794f..f0f73fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,9 +31,9 @@ QUILT_COMPAT_PROG_PATH(BASH, bash)
# though the result /could/ be available to us directly as $BASH_VERSION we
# don't want to use, or trust it, incase the user is specifying a different
# bash executable.
-if `$BASH -c '[[ "$BASH_VERSION" \< "2.04" ]]'` ; then
+if `$BASH -c '[[ "$BASH_VERSION" \< "3.0" ]]'` ; then
AC_MSG_ERROR([
-$PACKAGE_NAME requires at least version 2.04 of bash, you can download a current
+$PACKAGE_NAME requires at least version 3.0 of bash, you can download a current
version of bash from ftp.gnu.org
])
fi
diff --git a/quilt/mail.in b/quilt/mail.in
index de23878..fcdc46e 100644
--- a/quilt/mail.in
+++ b/quilt/mail.in
@@ -21,7 +21,7 @@ fi
usage()
{
- printf $"Usage: quilt mail {--mbox file|--send} [-m text] [--prefix prefix] [--sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...] [--reply-to message] [first_patch [last_patch]]\n"
+ printf $"Usage: quilt mail {--mbox file|--send} [-m text] [-M file] [--prefix prefix] [--sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...] [--reply-to message] [first_patch [last_patch]]\n"
if [ x$1 = x-h ]
then
printf $"
@@ -37,6 +37,9 @@ first, and a last patch name of \`-' denotes the last patch in the series.
used, the editor will not be invoked, and the patches will be
processed immediately.
+-M file
+ Like the -m option, but read the introduction from file.
+
--prefix prefix
Use an alternate prefix in the bracketed part of the subjects
generated. Defaults to \`patch'.
@@ -137,11 +140,11 @@ process_mail()
echo ${QUILT_SENDMAIL:-sendmail} \
${QUILT_SENDMAIL_ARGS--f "$opt_sender"} "$@"
$QUILT_DIR/scripts/edmail --charset $opt_charset \
- --remove-header Bcc "$@" < $tmpfile \
+ --remove-header Bcc < $tmpfile \
| ${QUILT_SENDMAIL:-sendmail} \
${QUILT_SENDMAIL_ARGS--f "$opt_sender"} "$@"
else
- local from_date=$(date "+%a %b %e %H:%M:%S %Y")
+ local from_date=$(LC_ALL=POSIX date "+%a %b %e %H:%M:%S %Y")
echo "From $opt_sender_address $from_date"
sed -e 's/^From />From /' $tmpfile
echo
@@ -159,9 +162,10 @@ join_lines() {
'
}
-options=`getopt -o m:h --long from:,to:,cc:,bcc:,subject: \
- --long send,mbox:,charset:,sender: \
- --long prefix:,reply-to:,signature: -- "$@"`
+options=`getopt -o m:M:h \
+ --long from:,to:,cc:,bcc:,subject: \
+ --long send,mbox:,charset:,sender: \
+ --long prefix:,reply-to:,signature: -- "$@"`
if [ $? -ne 0 ]
then
@@ -180,8 +184,21 @@ while true
do
case "$1" in
-m)
+ if [ -n "$opt_message" ]
+ then
+ echo "Introduction message already specified" >&2
+ exit 1
+ fi
opt_message=$2
shift 2 ;;
+ -M)
+ if [ -n "$opt_message" ]
+ then
+ echo "Introduction message already specified" >&2
+ exit 1
+ fi
+ opt_message=$(< "$2")
+ shift 2 ;;
--sender)
opt_sender=$2
shift 2 ;;
@@ -370,14 +387,14 @@ then
# addresses that contain commas and add quotes, e.g.,
# Last, First <email> => "Last, First" <email>
- set -- Signed-off-by Acked-by Suggested-by Reviewed-by Requested-by Reported-by Tested-by
+ set -- Signed-off-by Acked-by Suggested-by Reviewed-by Requested-by Reported-by Tested-by Cc
set -- "$*"
set -- ${*// /\\|}
sed -n -e "/\<${LOGNAME:-$(whoami)}@/d" \
- -e 's/^\(To\|Cc\):/Recipient-\1:/ip' \
- -e 's/^\(\('"$*"'\):[ '$'\t'']*\)\([^"]*\(,[^"]*\)\+[^" '$'\t'']\)\([ '$'\t'']*<.*>\)/\1"\3"\5/i' \
- -e 's/^\('"$*"'\):/Recipient-Cc:/ip' \
+ -e 's/^\(\(To\|'"$*"'\):[ '$'\t'']*\)\([^"]*\(,[^"]*\)\+[^" '$'\t'']\)\([ '$'\t'']*<.*>\)/\1"\3"\5/I' \
+ -e 's/^To:\(.*<.*@.*>\)/Recipient-To:\1/Ip' \
+ -e 's/^\('"$*"'\):\(.*<.*@.*>\)/Recipient-Cc:\2/Ip' \
$tmpdir/header
echo
@@ -575,7 +592,7 @@ for patch in "${patches[@]}"; do
next }
in_header = 0 }
sub(/^Recipient-/, "") { headers[++n] = $0
- options[n] = "--add-recipient"
+ options[n] = "--add-good-recipient"
in_header = 1
next }
sub(/^Replace-/, "") { headers[++n] = $0
@@ -593,7 +610,11 @@ for patch in "${patches[@]}"; do
# echo "$modify" | sed -e 's/^/>> /' >&2
p=${subject_prefix//@num@/$(printf %0*d ${#total} $num)}
p=${p//@total@/$total}
- ( echo "Message-Id: <$(msgid)>"
+
+ # Make pipes fail if any of their commands fail (requires bash 3):
+ set -o pipefail
+
+ ( ( echo "Message-Id: <$(msgid)>"
awk '
/^$/ { exit }
tolower($0) !~ /^(message-id|references|in-reply-to):/ \
@@ -621,9 +642,14 @@ for patch in "${patches[@]}"; do
| sed -e $'s/^\\(Subject:[ \t]\\)/\\1'"$p"'/' \
-e '/^Subject-Prefix:/d' \
| $QUILT_DIR/scripts/edmail --remove-empty-headers \
- | process_mail
+ | process_mail ) 2> $tmpdir/err
- if [ ${PIPESTATUS[1]} -ne 0 ]
+ status=$?
+ if [ -s $tmpdir/err ]
+ then
+ sed -e "s/^/${patch//\//\\/}: /" < $tmpdir/err >&2
+ fi
+ if [ $status -ne 0 ]
then
printf $"Introduction saved as %s\n" "$introduction" >&2
exit 1
diff --git a/quilt/scripts/edmail.in b/quilt/scripts/edmail.in
index 140355b..d0e8ca6 100644
--- a/quilt/scripts/edmail.in
+++ b/quilt/scripts/edmail.in
@@ -36,6 +36,11 @@ sub _($) {
return gettext(shift);
}
+my $special = '()<>\[\]:;@\\,"'; # special characters
+my $special_dot = "$special."; # special characters + dot
+
+sub check_recipient($);
+
my (%append_name, %append_value, $remove_empty_headers, %remove_header,
%extract_recipients_from, %replace_name, %replace_value, $charset);
GetOptions('add-recipient=s%' =>
@@ -43,6 +48,17 @@ GetOptions('add-recipient=s%' =>
$append_name{lc $_[1]} = $_[1];
$append_value{lc $_[1]} .= ",\n " . $_[2];
},
+ 'add-good-recipient=s%' =>
+ sub {
+ eval { check_recipient($_[2]) };
+ if ($@) {
+ chomp $@;
+ print STDERR "$@; skipping\n";
+ } else {
+ $append_name{lc $_[1]} = $_[1];
+ $append_value{lc $_[1]} .= ",\n " . $_[2];
+ }
+ },
'remove-header=s' => sub { $remove_header{lc $_[1]}++ },
'remove-empty-headers' => \$remove_empty_headers,
'replace-header=s%' =>
@@ -61,9 +77,6 @@ sub encode_header($) {
return "=?$charset?q?$word?=";
}
-my $special = '()<>\[\]:;@\\,"'; # special characters
-my $special_dot = "$special."; # special characters + dot
-
# Check for a valid display name
sub check_display_name($) {
my ($display) = @_;