Package: devscripts Version: 2.23.6 Severity: wishlist Tags: patch Please add a --date option to the debchange command to allow the invoker to specify the date to be used in newly created trailers.
Use case: The Qt/KDE team adds mostly identical changelog entries to many different packages every time they do a release. They use debchange to add changelog entries to all of the packages, and the trailers on those entries end up with slightly different timestamps because the script takes more than a second to update all of the changelogs. As a result, apt-listchanges can't consolidate these changelog entries since they're not recognized as identical, and the user sees many tends of changelog entries with identical contents. If the script the QT/KDE team is using to invoke debchange could specify the date to use in their script that calls dch, then these changelog entries could all have he same timestamp. Patch attached. N.B. Patch uses Date::Parse. It works well enough, but perhaps there is a better date parser to use instead?
diff -ur devscripts-2.23.6.orig/scripts/debchange.1 devscripts-2.23.6/scripts/debchange.1 --- devscripts-2.23.6.orig/scripts/debchange.1 2023-10-23 05:22:00.134135000 -0400 +++ devscripts-2.23.6/scripts/debchange.1 2023-10-23 05:41:04.690344359 -0400 @@ -362,6 +362,11 @@ multi-maintainer mode is in use; you will probably wish to check the changelog manually before uploading it in such cases. .TP +\fB\-\-date\fR \fIdate\fR +Specify the date to use in newly created changelog entry trailers. +Accepts any date format recognized by Perl's `\fBDate::Parse\fR` +module. +.TP .BR \-\-controlmaint ", " \-M Use maintainer details from the \fIdebian/control\fR \fBMaintainer\fR field rather than relevant environment variables (\fBDEBFULLNAME\fR, \fBDEBEMAIL\fR, @@ -484,7 +489,8 @@ .BR debclean (1), .BR dput (1), .BR dupload (1), -.BR devscripts.conf (5) +.BR devscripts.conf (5), +.BR Date::Parse (3pm) .SH AUTHOR The original author was Christoph Lameter <[email protected]>. Many substantial changes and improvements were made by Julian Gilbey diff -ur devscripts-2.23.6.orig/scripts/debchange.pl devscripts-2.23.6/scripts/debchange.pl --- devscripts-2.23.6.orig/scripts/debchange.pl 2023-10-23 05:22:00.134135000 -0400 +++ devscripts-2.23.6/scripts/debchange.pl 2023-10-23 05:36:56.651937329 -0400 @@ -34,6 +34,7 @@ use warnings; use open ':utf8'; # changelogs are written with UTF-8 encoding use filetest 'access'; # use access rather than stat for -w +use Date::Parse; # for checking whether user names are valid and making format() behave use Encode qw/decode_utf8 encode_utf8/; use Getopt::Long qw(:config bundling permute no_getopt_compat); @@ -213,6 +214,8 @@ -t, --mainttrailer Don\'t change (maintain) the trailer line in the changelog entry; i.e. maintain the maintainer and date/time details + --date + Specify the date/time to use in new trailer lines. --check-dirname-level N How much to check directory names: N=0 never @@ -268,6 +271,7 @@ my $opt_auto_nmu = 1; my $opt_force_save_on_release = 1; my $opt_vendor = undef; +my $opt_date = ''; # Next, read configuration files and then command line # The next stuff is boilerplate @@ -276,7 +280,9 @@ $modified_conf_msg = " (no configuration files read)"; shift; } else { - my @config_files = ('/etc/devscripts.conf', '~/.devscripts'); + # N.B. double quotes instead of single on the following line make Emacs + # Perl mode happy. + my @config_files = ("/etc/devscripts.conf", "~/.devscripts"); my %config_vars = ( 'DEBCHANGE_PRESERVE' => 'no', 'DEBCHANGE_QUERY_BTS' => 'yes', @@ -408,6 +414,7 @@ "m|maintmaint" => \$opt_m, "M|controlmaint" => \$opt_M, "t|mainttrailer!" => \$opt_t, + "date=s" => \$opt_date, "check-dirname-level=s" => \$check_dirname_level, "check-dirname-regex=s" => \$check_dirname_regex, "noconf" => \$opt_noconf, @@ -1041,7 +1048,16 @@ my $DATE; { local $ENV{TZ} = $opt_tz if $opt_tz; - $DATE = strftime "%a, %d %b %Y %T %z", localtime(); + my $timestamp; + if ($opt_date) { + if (! ($timestamp = str2time($opt_date))) { + die "$progname: bad date \"$opt_date\"\n"; + } + } + else { + $timestamp = localtime(); + } + $DATE = strftime "%a, %d %b %Y %T %z", localtime($timestamp); } if ($opt_news && !$opt_i && !$opt_a) {

