[Reproducible-commits] [dpkg] 22/74: Dpkg::Changelog: Add a getter for the Time::Piece object

Mattia Rizzolo mattia at debian.org
Sun Jul 3 22:22:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to annotated tag 1.18.8
in repository dpkg.

commit 4e8550c8e2a4f5aab5b803df0ea77c50e089d2dd
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Apr 2 03:19:17 2016 +0200

    Dpkg::Changelog: Add a getter for the Time::Piece object
    
    Make it possible to retrieve the already parsed Time::Piece object,
    instead of having to reparse it.
---
 debian/changelog                       |  1 +
 scripts/Dpkg/Changelog/Entry.pm        | 16 +++++++++++++++-
 scripts/Dpkg/Changelog/Entry/Debian.pm | 15 +++++++++++++--
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e0e7161..c2d0420 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
     - Add new format_range() method and deprecate dpkg() and rfc822() methods
       in Dpkg::Changelog.
     - Replace changelog program parsers with perl modules.
+    - Add a getter for the Time::Piece object in Dpkg::Changelog.
   * Test suite:
     - Bump perlcritic ValuesAndExpressions::RequireNumberSeparators minimum
       to 99999.
diff --git a/scripts/Dpkg/Changelog/Entry.pm b/scripts/Dpkg/Changelog/Entry.pm
index 2b611bf..c9deb04 100644
--- a/scripts/Dpkg/Changelog/Entry.pm
+++ b/scripts/Dpkg/Changelog/Entry.pm
@@ -18,7 +18,7 @@ package Dpkg::Changelog::Entry;
 use strict;
 use warnings;
 
-our $VERSION = '1.00';
+our $VERSION = '1.01';
 
 use Carp;
 
@@ -281,6 +281,16 @@ sub get_timestamp {
     return;
 }
 
+=item $time = $entry->get_timepiece()
+
+Return the timestamp of the changelog entry as a Time::Piece object.
+
+=cut
+
+sub get_timepiece {
+    return;
+}
+
 =item $str = $entry->get_dpkg_changes()
 
 Returns a string that is suitable for usage in a C<Changes> field
@@ -299,6 +309,10 @@ sub get_dpkg_changes {
 
 =head1 CHANGES
 
+=head2 Version 1.01 (dpkg 1.18.8)
+
+New method: $entry->get_timepiece().
+
 =head2 Version 1.00 (dpkg 1.15.6)
 
 Mark the module as public.
diff --git a/scripts/Dpkg/Changelog/Entry/Debian.pm b/scripts/Dpkg/Changelog/Entry/Debian.pm
index 4e9d510..14f2d07 100644
--- a/scripts/Dpkg/Changelog/Entry/Debian.pm
+++ b/scripts/Dpkg/Changelog/Entry/Debian.pm
@@ -19,7 +19,7 @@ package Dpkg::Changelog::Entry::Debian;
 use strict;
 use warnings;
 
-our $VERSION = '1.02';
+our $VERSION = '1.03';
 our @EXPORT_OK = qw(
     $regex_header
     $regex_trailer
@@ -220,7 +220,8 @@ sub parse_trailer {
 	# Ignore the week day ('%a, '), as we have validated it above.
 	local $ENV{LC_ALL} = 'C';
 	eval {
-	    Time::Piece->strptime($7, '%d %b %Y %T %z');
+	    my $tp = Time::Piece->strptime($7, '%d %b %Y %T %z');
+	    $self->{trailer_timepiece} = $tp;
 	} or do {
 	    # Validate the month. Date::Parse used to accept both abbreviated
 	    # and full months, but Time::Piece strptime() implementation only
@@ -345,6 +346,12 @@ sub get_timestamp {
     return $self->{trailer_timestamp_date};
 }
 
+sub get_timepiece {
+    my $self = shift;
+
+    return $self->{trailer_timepiece};
+}
+
 =back
 
 =head1 UTILITY FUNCTIONS
@@ -403,6 +410,10 @@ sub find_closes {
 
 =head1 CHANGES
 
+=head2 Version 1.03 (dpkg 1.18.8)
+
+New methods: $entry->get_timepiece().
+
 =head2 Version 1.02 (dpkg 1.18.5)
 
 New methods: $entry->parse_header(), $entry->parse_trailer().

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list