Your message dated Fri, 04 Dec 2015 11:08:52 +0000
with message-id <[email protected]>
and subject line Bug#801621: fixed in perl 5.22.1~rc3-1
has caused the Debian Bug report #801621,
regarding perl: support SOURCE_DATE_EPOCH in Pod::Man
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
801621: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=801621
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: perl
Version: 5.22.0-4
Severity: wishlist
Tags: upstream patch
User: [email protected]
Usertags: timestamps
X-Debbugs-Cc: Russ Allbery <[email protected]>, 
[email protected]

(cc'ing Russ as the podlators upstream author)

Since 5.20.1~rc1-1, Pod::Man has supported the POD_MAN_DATE environment
variable for overriding the page footers, fixing #759405. Since then,
the reproducible builds project has converged on the SOURCE_DATE_EPOCH
specification, which "defines a distribution-agnostic standard for
upstream build processes to consume this timestamp from packaging
systems."

It would be good to have Pod::Man support the SOURCE_DATE_EPOCH
environment variable, either instead of or in addition to POD_MAN_DATE,
which is specific to the podlators modules. This would give distributions
aiming for reproducible builds automatic benefits from standardizing on
SOURCE_DATE_EPOCH, without having to add a special case for Pod::Man.

In the context of Debian, while it's possible to set POD_MAN_DATE
externally based on SOURCE_DATE_EPOCH, it's not clear which layer
should do this. Options include dpkg-buildpackage, where special casing
POD_MAN_DATE looks particularly wrong, and debhelper, where this should
probably go in the v9 based dh_auto_* build systems, perhaps only the
Perl ones (perl_build and perl_makemaker). In particular, packages using
old style debhelper debian/rules do not have a place where POD_MAN_DATE
could be injected centrally in debhelper, which would leave out many
packages that would otherwise profit from this.

The attached patch against the current podlators upstream git
repository implements support for SOURCE_DATE_EPOCH in addition to
POD_MAN_DATE. Russ, please let me know what you think. I see POD_MAN_DATE
support hasn't been released upstream yet, so I suppose even backing
that out altogether would still be a valid option if you want to avoid
duplicating the functionality.
-- 
Niko Tyni   [email protected]
>From a85d0944a90867cd5f2da58b59d31bd7accf80ed Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Mon, 12 Oct 2015 17:39:33 +0300
Subject: [PATCH] Make Pod::Man honor the SOURCE_DATE_EPOCH environment
 variable

See https://reproducible-builds.org/specs/source-date-epoch/ for
the SOURCE_DATE_EPOCH specification.
---
 lib/Pod/Man.pm      | 24 ++++++++++++++++++------
 t/man/devise-date.t | 21 ++++++++++++++++++++-
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm
index 56a067e..2096cbc 100644
--- a/lib/Pod/Man.pm
+++ b/lib/Pod/Man.pm
@@ -894,6 +894,10 @@ sub devise_title {
 # reproducible generation of the same file even if the input file timestamps
 # are unpredictable or the POD coms from standard input.
 #
+# Otherwise, if SOURCE_DATE_EPOCH is set and can be parsed as seconds
+# since the UNIX epoch, base the timestamp on that.
+# See <https://reproducible-builds.org/specs/source-date-epoch/>
+#
 # Otherwise, use the modification date of the input if we can stat it.  Be
 # aware that Pod::Simple returns the stringification of the file handle as
 # source_filename for input from a file handle, so we'll stat some random ref
@@ -910,14 +914,22 @@ sub devise_date {
         return $ENV{POD_MAN_DATE};
     }
 
+    # If SOURCE_DATE_EPOCH is set and can be parsed, use that.
+    my $time;
+    if (defined($ENV{SOURCE_DATE_EPOCH}) &&
+        $ENV{SOURCE_DATE_EPOCH} !~ /\D/) {
+        $time = $ENV{SOURCE_DATE_EPOCH};
+    }
+
     # Otherwise, get the input filename and try to stat it.  If that fails,
     # use the current time.
-    my $input = $self->source_filename;
-    my $time;
-    if ($input) {
-        $time = (stat($input))[9] || time();
-    } else {
-        $time = time();
+    if (!defined $time) {
+        my $input = $self->source_filename;
+        if ($input) {
+            $time = (stat($input))[9] || time();
+        } else {
+            $time = time();
+        }
     }
 
     # Can't use POSIX::strftime(), which uses Fcntl, because MakeMaker uses
diff --git a/t/man/devise-date.t b/t/man/devise-date.t
index 27271d9..5fb08e2 100755
--- a/t/man/devise-date.t
+++ b/t/man/devise-date.t
@@ -12,7 +12,7 @@ use warnings;
 use Pod::Man;
 use POSIX qw(strftime);
 
-use Test::More tests => 3;
+use Test::More tests => 6;
 
 # Check that the results of device_date matches strftime.  There is no input
 # file name, so this will use the current time.
@@ -30,3 +30,22 @@ is($parser->devise_date, '2014-01-01', 'devise_date honors POD_MAN_DATE');
 # Check that an empty environment variable is honored.
 local $ENV{POD_MAN_DATE} = q{};
 is($parser->devise_date, q{}, 'devise_date honors empty POD_MAN_DATE');
+
+# Set another environment variable and ensure that it's honored.
+local $ENV{POD_MAN_DATE};
+local $ENV{SOURCE_DATE_EPOCH} = 1439390140;
+is($parser->devise_date, '2015-08-12', 'devise_date honors SOURCE_DATE_EPOCH');
+
+# Check that POD_MAN_DATE overrides SOURCE_DATE_EPOCH
+local $ENV{POD_MAN_DATE} = '2013-01-01';
+local $ENV{SOURCE_DATE_EPOCH} = 1482676620;
+is($parser->devise_date, '2013-01-01', 'devise_date honors POD_MAN_DATE over SOURCE_DATE_EPOCH');
+
+# Check that an invalid SOURCE_DATE_EPOCH is not accepted
+local $ENV{POD_MAN_DATE};
+local $ENV{SOURCE_DATE_EPOCH} = '1482676620B';
+is(
+    $parser->devise_date,
+    strftime('%Y-%m-%d', gmtime()),
+    'devise_date ignores invalid SOURCE_DATE_EPOCH'
+);
-- 
2.5.1


--- End Message ---
--- Begin Message ---
Source: perl
Source-Version: 5.22.1~rc3-1

We believe that the bug you reported is fixed in the latest version of
perl, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Niko Tyni <[email protected]> (supplier of updated perl package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Fri, 04 Dec 2015 11:42:57 +0200
Source: perl
Binary: perl-base perl-doc perl-debug libperl5.22 libperl-dev perl-modules-5.22 
perl
Architecture: source
Version: 5.22.1~rc3-1
Distribution: experimental
Urgency: low
Maintainer: Niko Tyni <[email protected]>
Changed-By: Niko Tyni <[email protected]>
Description:
 libperl-dev - Perl library: development files
 libperl5.22 - shared Perl library
 perl       - Larry Wall's Practical Extraction and Report Language
 perl-base  - minimal Perl system
 perl-debug - debug-enabled Perl interpreter
 perl-doc   - Perl documentation
 perl-modules-5.22 - Core Perl modules
Closes: 799014 801621
Changes:
 perl (5.22.1~rc3-1) experimental; urgency=low
 .
   * New upstream release candidate.
   * Rename the license of the Sys-Syslog syslog.h file in debian/copyright
     (Closes: #799014)
   * Backport SOURCE_DATE_EPOCH support in Pod::Man from podlators-4.00.
     (Closes: #801621)
   * Remove strcpy usage from debian/patches/debian/mod_paths.diff,
     now policed by t/porting/libperl.t
Checksums-Sha1:
 21a495a3ec2695c8cd45e43856f0252e5019d9e6 2348 perl_5.22.1~rc3-1.dsc
 628c35186d3fc3a6e255b931a4fd7ef124d7e8cc 13704166 perl_5.22.1~rc3.orig.tar.bz2
 d8578fb6d83e63c4ec9625f1ea9bb5ef6ab5fe14 109712 perl_5.22.1~rc3-1.debian.tar.xz
Checksums-Sha256:
 0c50189807445db7ed6895f921f6ec19eaf4ec4cb7ac4847ad4bc0defa29e48c 2348 
perl_5.22.1~rc3-1.dsc
 5803ecea9a82f3fe8e8d5e1003ea1f4d2dd231b4f6af9d5c5e44c0cdbd7ee74b 13704166 
perl_5.22.1~rc3.orig.tar.bz2
 aa3d2bea3c16b8f7f59558efa79d1984cc9fd557ed850d5f9bea35b081aa0061 109712 
perl_5.22.1~rc3-1.debian.tar.xz
Files:
 6f60b1f812475f465660be5fbf72721a 2348 perl standard perl_5.22.1~rc3-1.dsc
 a7d09cafd75dbdb0db96672c9323eaaa 13704166 perl standard 
perl_5.22.1~rc3.orig.tar.bz2
 fd6a44050b67913fa7ece88339474085 109712 perl standard 
perl_5.22.1~rc3-1.debian.tar.xz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJWYW1fAAoJEC7A/7O3MBsfyPMP/3U1pnItnJEpiyc8+68nn87Q
deblBiyf0kg4evJJoIwRH6cXO0GrvON2Yt3Kb9l0FgqU+dNpNg7tboKCpZak1Mmv
RSCmkt9bXJ0rjjWw9wFMAy5pjABrNoHJWYb/lQOK3OBVqlqB77X5ul/VfhOKlzVQ
XrPMJgGf1GYGtO4mrazOPhpkdAWJH+rEKlnVqtgBBL7dyoIYmMekkOmO2emDas6b
fyoRSaU+d4xeCYatsX+eZ+mEnHTQj+Hy4PuSh3+4MB+a8Ah8WxBOlF7ZMBwTmVJ+
CBhTgpDzUgW/nc6TvsoBhtAVxXR7D9vz1dK8F7md/laiNkhw0ghdezL5cK8MQKlr
6WNf7Hd6XxHhf0TQZDg33ZSzHQnZjYbOj1SV8TOvZbB2jjVOSoAq9pNW+B22UeIQ
Oe9G/4uWsIofzHT/vwuCxFr0wqoO52RwFipD7kGd9SVsfv7syWro8hUq4CFfDkqk
3RsqXX1VulIh47g4SNQvrnUd9o1WMOlxggaUJ/Txs6JDm6bJD5WuT0nfC/Qgbgpk
8ZcW5zJ91S7ivgkfu00T1mYDxWbLKzTUIxxNfGGjIOvAa6OAocFusT1465vMuGxt
qt6Mg98XoHaN9lJNdW+B8ECDuR7C/nAyk2EPgSWbISvg5qoDSYFgDOJCk3upthqv
zxA8/IwCUEq27hNpLB0X
=beyK
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to