[lintian] 01/05: Use UTC time & add 'timestamp' method to L::Path
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit fa7371152629910bec5579e88c152263552b7b6d
Author: Tomasz Buchert <tomasz@debian.org>
Date: Thu May 14 11:32:18 2015 +0200
Use UTC time & add 'timestamp' method to L::Path
Signed-off-by: Niels Thykier <niels@thykier.net>
---
collection/unpacked | 13 ++++++++++---
lib/Lintian/Path.pm | 17 ++++++++++++++++-
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/collection/unpacked b/collection/unpacked
index fdb9736..928aa04 100755
--- a/collection/unpacked
+++ b/collection/unpacked
@@ -174,7 +174,10 @@ sub extract_and_index_deb {
push(
@jobs,
{
- '_pipeline' => [['tar', '-tvf', '-'], '|', @sort_gzip, '&'],
+ '_pipeline' => [
+ ['tar', '--utc', '--full-time', '-tvf', '-'], '|',
+ @sort_gzip, '&'
+ ],
'fail' => 'error',
'pipe_in' => FileHandle->new,
'out' => "$dir/index.gz",
@@ -184,8 +187,12 @@ sub extract_and_index_deb {
push(
@jobs,
{
- '_pipeline' =>
- [['tar', '--numeric-owner', '-tvf', '-'], '|',@sort_gzip, '&'],
+ '_pipeline' =>[
+ ['tar', '--utc', '--full-time', '--numeric-owner', '-tvf','-'],
+ '|',
+ @sort_gzip,
+ '&'
+ ],
'fail' => 'error',
'pipe_in' => FileHandle->new,
'out' => "$dir/index-owner-id.gz",
diff --git a/lib/Lintian/Path.pm b/lib/Lintian/Path.pm
index 48de275..a6ed5fd 100644
--- a/lib/Lintian/Path.pm
+++ b/lib/Lintian/Path.pm
@@ -33,6 +33,7 @@ use overload (
'fallback' => 0,
);
+use Date::Parse qw(str2time);
use Carp qw(croak confess);
use Scalar::Util qw(weaken);
@@ -195,7 +196,7 @@ NB: Returns the empty string for the "root" dir.
Lintian::Path->mk_ro_accessors(
qw(name owner group link type uid gid
- size date operm parent_dir dirname basename
+ size date time operm parent_dir dirname basename
));
=item children
@@ -212,6 +213,20 @@ sub children {
return @{$self->{'_sorted_children'} };
}
+=item timestamp
+
+Returns a Unix timestamp for the given path. This is a number of
+seconds since the start of Unix epoch in UTC.
+
+=cut
+
+sub timestamp {
+ my ($self) = @_;
+ my $date = $self->{'date'};
+ my $time = $self->{'time'};
+ return str2time("$date $time", 'GMT');
+}
+
=item child(BASENAME)
Returns the child named BASENAME if it is a child of this directory.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: