Bug#1058491: add a "Date" control field (for reproducibility)

Stephen Gildea stepheng+debian-bts at gildea.com
Tue Dec 12 16:49:12 GMT 2023


Package: equivs
Version: 2.3.1
Tags: patch

Please accept this enhancement to add a "Date" field to the
equivs-build control file.

If supplied, the Date value will be used instead of the current time
to set the date/time in the generated debian/changelog file.

Sometimes the caller does not need to supply an entire changelog file
but just needs to set the package date.  Setting the date to a
specific time lets equivs-build be part of a reproducible build chain.


--- equivs-2.3.1/usr/bin/equivs-build
+++ equivs/usr/bin/equivs-build
@@ -339,9 +339,14 @@ sub make_changelog {
   my ($version, $suite, $date);
 
   $version = $control->{'Version'} || "1.0";
   $suite = $control->{'Suite'} || "unstable";
-  chomp ($date = qx(date -R));
+  my $date_to_use_arg = "";
+  if (my $control_dateq = $control->{'Date'}) {
+      $control_dateq =~ s/'/'\\\''/g;
+      $date_to_use_arg = "--date='$control_dateq'";
+  }
+  chomp ($date = qx(date -R $date_to_use_arg));
 
   open OUT, '>', "$builddir/debian/changelog" or
     die "Couldn't write changelog: $!\n";
   print OUT <<EOINPUT;
--- equivs-2.3.1/equivs-build.pod
+++ equivs/equivs-build.pod
@@ -30,11 +30,19 @@ There are several additional fields that can be used:
 =item Changelog: 
 
-File to be used as the changelog
+File to be used as the F<changelog>.  If not specified, B<equivs-build>
+will generate one.  Some parts of the generated F<changelog> can be
+controlled; see the Version and Date fields.
 
 =item Version: 
 
 If you don't use a local changelog, equivs will create a
 dummy one. As the version of the package is defined in the
 changelog, equivs will assume the version 1.0. With this
 field, you can set an explicit version.
 
+=item Date:
+
+If B<equivs-build> generates a F<changelog> file, it will use this
+time as the package release date.  The date defaults to the current time.
+The Date string can be anything C<S<date -d>> will accept.
+



More information about the pkg-perl-maintainers mailing list