[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] remove GNU date dependency [Was: quilt mail broken with sed
From: |
Gary V. Vaughan |
Subject: |
[Quilt-dev] remove GNU date dependency [Was: quilt mail broken with sed 3.02] |
Date: |
Tue, 31 Jan 2006 11:48:17 +0000 |
User-agent: |
Thunderbird 1.5 (X11/20051201) |
Salut Jean,
Jean Delvare wrote:
>> Also, I don't know how to produce a RFC822 timestamp with POSIX date; no
>> idea
>> how to produce a timezone offset (e.g., +0100, -0600):
>>
>> $ date --rfc-822
>> Mon, 30 Jan 2006 23:52:43 +0100
>> $ date '+%a, %d %b %Y %H:%M:%S xxxxx'
>> Mon, 30 Jan 2006 23:52:44 xxxxx
>
> There's %z according to the man page, but it's said to be a nonstandard
> extension, so I guess that it won't be there unless --rfc-2822 is there
> too :( No other idea ATM.
Since quilt relies on perl already, we could still remove the dependency on
GNU date with:
@PERL@ -e '
use POSIX qw(strftime);
print strftime("%z", localtime(time()));'
The invocation with --utc is only for the msgid, so I can't see any harm in
removing it, and maybe having some machines generate msgids in local time.
Patch attached.
Alternatively, I suppose a compat/getopt.in style perl script replacement for
date could be written that can handle the --utc and --rfc-822 options so that
systems with GNU date could continue to use it...
Cheers,
Gary.
--
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://tkd.kicks-ass.net
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
configure.ac | 1 -
quilt/mail.in | 15 +++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
Index: quilt-HEAD/configure.ac
===================================================================
--- quilt-HEAD.orig/configure.ac
+++ quilt-HEAD/configure.ac
@@ -69,7 +69,6 @@ You can download GNU fileutils from ftp.
])
fi
-QUILT_COMPAT_PROG_PATH(DATE, date, [gdate date])
QUILT_COMPAT_PROG_PATH(PERL, perl, [perl perl5])
QUILT_COMPAT_PROG_PATH(GREP, grep)
Index: quilt-HEAD/quilt/mail.in
===================================================================
--- quilt-HEAD.orig/quilt/mail.in
+++ quilt-HEAD/quilt/mail.in
@@ -64,7 +64,7 @@ with a template for the introduction. Pl
msgid()
{
- local timestamp=$(date --utc "+%Y%m%d%H%M%S.%N")
+ local timestamp=$(date "+%Y%m%d%H%M%S.%N")
echo "address@hidden@}"
}
@@ -318,12 +318,15 @@ if [ address@hidden -ne 0 ]; then
exit 1
fi
+last_ts=$(date +%s)
introduction="$(gen_tempfile)"
(
cat <<-EOF
Message-Id: <$(msgid)>
User-Agent: quilt/@address@hidden@RELEASE@
- Date: $(date --rfc-822)
+ Date: $(@PERL@ -e '
+ use POSIX qw(strftime);
+ print strftime("+%a, %d %b %Y %H:%M:%S %z", localtime('$last_ts'));')
From: ${opt_from:-$opt_sender}
To: $(IFS=,; echo "${opt_to[*]}")
Cc: $(IFS=,; echo "${opt_cc[*]}")
@@ -385,12 +388,10 @@ if [ -n "$opt_mbox" ]; then
exec 1>> $opt_mbox
fi
-# Remember the timestamp of the last message sent. For each message,
+# last_ts is the timestamp of the last message sent. For each message,
# increment the timestamp by one second and wait with sending until
# that time has arrived. This allows MUAs to show the messages in the
# correct order.
-last_ts=$(date '+%s' -d "$(sed -ne $'s/^Date:[ \t]*//p' $introduction)")
-
num=1
for patch in "address@hidden"; do
body=$tmpdir/$patch
@@ -400,7 +401,9 @@ for patch in "address@hidden"; do
# sleep 1
#done
((last_ts++))
- new_date="$(date --rfc-822 -d "1970/01/01 UTC $last_ts seconds")"
+ new_date=$(@PERL@ -e '
+ use POSIX qw(strftime);
+ print strftime("%a, %d %b %Y %H:%M:%S %z", localtime('$last_ts'));')
modify="$(awk '
sub(/^Recipient-/, "") { r = $0
signature.asc
Description: OpenPGP digital signature
- [Quilt-dev] quilt mail broken with sed 3.02, Jean Delvare, 2006/01/30
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Andreas Gruenbacher, 2006/01/30
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Jean Delvare, 2006/01/30
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Andreas Gruenbacher, 2006/01/30
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Jean Delvare, 2006/01/30
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Andreas Gruenbacher, 2006/01/30
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Andreas Gruenbacher, 2006/01/30
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Jean Delvare, 2006/01/30
- [Quilt-dev] remove GNU date dependency [Was: quilt mail broken with sed 3.02],
Gary V. Vaughan <=
- [Quilt-dev] Re: remove GNU date dependency [Was: quilt mail broken with sed 3.02], Andreas Gruenbacher, 2006/01/31
- [Quilt-dev] Re: remove GNU date dependency [Was: quilt mail broken with sed 3.02], Andreas Gruenbacher, 2006/01/31
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Gary V. Vaughan, 2006/01/31
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Andreas Gruenbacher, 2006/01/31
- Re: [Quilt-dev] quilt mail broken with sed 3.02, John Vandenberg, 2006/01/31
- Re: [Quilt-dev] quilt mail broken with sed 3.02, Andreas Gruenbacher, 2006/01/31