tags 31634 - pending
tags 31634 patch
thanks

Hi.

I've prepared a patch to replace 822-date with a simple wrapper around
date -R for backwards compatibility. I think it would be good to apply
that since 822-date is just an unessecary duplication of code in my
view. The RFC 2822 which defines the format outputted by date -R seems
mainly to have deprecated stuff from RFC 822 (regarding times and dates
at least) that we didn't used anyway. date -R also doesn't seem to use
any optional parts of the format given in RFC 2822, so it is mostly
identical with the current output of 822-date (In fact the only
difference I could find was that date -R does '0' padding for
day-of-month whereas 822-date does not.

In case we decide to apply this patch we should also notify users of
822-date that they should just use date -R directly (except if we would
decide to implement 822-date as wrapper but do not deprecate it to
retain some control over the date format used in Debian packages).

Current users of 822-date includes e.g.
 - devscripts
 - dh-make
 - equivs
 - sbuild
 - debmake

Gruesse,
-- 
Frank Lichtenheld <[EMAIL PROTECTED]>
www: http://www.djpig.de/
Index: debian/changelog
===================================================================
--- debian/changelog    (Revision 308)
+++ debian/changelog    (Arbeitskopie)
@@ -1,6 +1,9 @@
 dpkg (1.13.20~) UNRELEASED; urgency=low
 
   [ Frank Lichtenheld ]
+  * Convert 822-date to be a simple wrapper around `date -R'.
+    822-date is now deprecated and should not be used anymore.
+    It might be removed sometime in the future. Closes: #31634
   * Add gettext support for the Perl scripts. Based on a patch by
     Nicolas François. Closes: #165843
   * Only print usage information of dpkg-scanpackages on stdout
Index: ChangeLog
===================================================================
--- ChangeLog   (Revision 308)
+++ ChangeLog   (Arbeitskopie)
@@ -1,5 +1,10 @@
 2006-05-12  Frank Lichtenheld  <[EMAIL PROTECTED]>
 
+       * scripts/822-date.pl: Convert the script to be
+       a simple wrapper around `date -R'.
+       * scripts/dpkg-genchanges.pl: Don't use 822-date
+       anymore, use `date -R'.
+
        * scripts/dpkg-scanpackages.pl: Print usage
        information on stderr instead of stdout in
        case of error. Only print it on stdout if
Index: scripts/822-date.pl
===================================================================
--- scripts/822-date.pl (Revision 308)
+++ scripts/822-date.pl (Arbeitskopie)
@@ -1,56 +1,14 @@
 #!/usr/bin/perl --
-# I hereby place this in the public domain - Ian Jackson, 1995.
-# Changes by Klee Dienes also placed in public domain (1997). 
 
-# time structure:
-# [ sec min hour mday mon year wday yday isdst ]
+my $dpkglibdir= "."; # This line modified by Makefile
+push(@INC,$dpkglibdir);
+require 'dpkg-gettext.pl';
+textdomain("dpkg-dev");
 
[EMAIL PROTECTED] && die "usage: 822-date\n";
+require 'controllib.pl';
 
-$curtime = time;
[EMAIL PROTECTED] = localtime ($curtime);
-$localtms = localtime ($curtime);
[EMAIL PROTECTED] = gmtime ($curtime);
-$gmttms = gmtime ($curtime);
[EMAIL PROTECTED] && die _g("usage: 822-date")."\n";
 
-if ($localtm[0] != $gmttm[0]) {
-    die (sprintf ("local timezone differs from GMT by a non-minute interval\n"
-                . "local time: %s\n"
-                . "GMT time: %s\n", $localtms, $gmttms));
-}
+&warn(_g("Using this program is deprecated. Please use `date -R' instead."));
 
-$localmin = $localtm[1] + $localtm[2] * 60;
-$gmtmin = $gmttm[1] + $gmttm[2] * 60;
-
-if ((($gmttm[6] + 1) % 7) == $localtm[6]) {
-    $localmin += 1440;
-} elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) {
-    $localmin -= 1440;
-} elsif ($gmttm[6] == $localtm[6]) {
-    1;
-} else {
-    die ("822-date: local time offset greater than or equal to 24 hours\n");
-}
-
-$offset = $localmin - $gmtmin;
-$offhour = $offset / 60;
-$offmin = abs ($offset % 60);
-
-if (abs ($offhour) >= 24) { 
-    die ("822-date: local time offset greater than or equal to 24 hours\n");
-}
-
-printf 
-    (
-     "%s, %2d %s %d %02d:%02d:%02d %s%02d%02d\n",
-     (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$localtm[6]], # day of week
-     $localtm[3],              # day of month
-     (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$localtm[4]], # month
-     $localtm[5]+1900,         # year
-     $localtm[2],              # hour
-     $localtm[1],              # minute
-     $localtm[0],              # sec
-     ($offset >= 0) ? '+' : '-',# TZ offset direction
-     abs ($offhour),           # TZ offset hour
-     $offmin,                  # TZ offset minute
-     ) || die "822-date: output error: $!\n";
+print `date -R`;
Index: scripts/Makefile.am
===================================================================
--- scripts/Makefile.am (Revision 308)
+++ scripts/Makefile.am (Arbeitskopie)
@@ -1,6 +1,8 @@
 ## Process this file with automake to produce Makefile.in
 
+SUBDIRS = po
+
 bin_SCRIPTS = \
        822-date \
        dpkg-architecture \
Index: man/C/822-date.1
===================================================================
--- man/C/822-date.1    (Revision 308)
+++ man/C/822-date.1    (Arbeitskopie)
@@ -1,35 +1,34 @@
 .\" Hey, Emacs!  This is an -*- nroff -*- source file.
-.\" Authors: Ian Jackson
-.TH 822\-date 1 "2008-02-28" "Debian Project" "dpkg utilities"
+.TH 822\-date 1 "2006-05-10" "Debian Project" "dpkg utilities"
 .SH NAME
-822\-date \- Print date and time in RFC822 format
+822\-date \- Print date and time in RFC2822 format
 .
 .SH SYNOPSIS
 .B 822\-date
 .
 .SH DESCRIPTION
 .B 822\-date
-displays the current date and time in the format described in RFC822,
-using a numeric timezone offset as recommended in RFC1123.
-.
+displays the current date and time in the format described in RFC2822.
+It does so by simply calling
+.BR date (1)
+with the \fB\-R\fP option.
+.PP
+.B Using 822-date is deprecated since
+.BR date (1)
+provides the same functionality when called with the \fB\-R\fP.
 .SH OPTIONS
 .B 822\-date
 does not take any arguments or options.
 .
-.SH BUGS
-This facility really ought to be part of
-.BR date (1).
-.
 .SH SEE ALSO
-.I Standard for the Format of ARPA Internet Text Messages
-(RFC822),
-.br
-.I Requirements for Internet Hosts -- Application and Support
-(RFC1123) section 5.2.14,
-.br
+.I Internet Message Format
+(RFC2822)
 .BR date (1).
 .
 .SH AUTHOR
-.B 822\-date
-and this manpage were written by Ian Jackson. They are hereby placed
-by him into the public domain.
+822-date is a really simple wrapper around
+.BR date (1).
+By its simplicity, the code is probably not copyrightable and
+should be considered to be in the public domain. This man page
+was written by Frank Lichtenheld based on an earlier version
+by Ian Jackson and was also put in the public domain.
Index: man/ChangeLog
===================================================================
--- man/ChangeLog       (Revision 308)
+++ man/ChangeLog       (Arbeitskopie)
@@ -1,3 +1,8 @@
+2006-05-12  Frank Lichtenheld  <[EMAIL PROTECTED]>
+
+       * C/822-date.1: 822-date is now deprecated. Document
+       this fact in the man page.
+
 2006-05-11  Frank Lichtenheld  <[EMAIL PROTECTED]>
 
        * C/po/*.pot: Update.
  • Bug#31634: Patch Frank Lichtenheld

Reply via email to