[lintian] 03/04: L::Path: Merge date and time fields
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit f1a7826c6a7b9cc394962a3f60e1e5867c43247d
Author: Niels Thykier <niels@thykier.net>
Date: Mon Jul 20 18:52:36 2015 +0200
L::Path: Merge date and time fields
Reduces memory consumption by another 0.36MB for lintian processing
lintian.
Signed-off-by: Niels Thykier <niels@thykier.net>
---
debian/changelog | 5 ++---
lib/Lintian/Collect/Package.pm | 8 ++++----
lib/Lintian/Path.pm | 15 +++++++++------
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 03b76d4..2623dc6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,9 +30,8 @@ lintian (2.5.34) UNRELEASED; urgency=medium
* lib/Lintian/Path.pm:
+ [NT] Rework some implementation details to reduce memory
consumption slightly.
- + [NT] The undocumented "type" method has been removed from
- the API. It was an implementation detail that has now
- changed.
+ + [NT] The undocumented "type" and "time" methods have been
+ removed from the API.
+ [NT] The "uid" and "gid" methods now return 0 rather than
undef when numeric ownership is not collected.
diff --git a/lib/Lintian/Collect/Package.pm b/lib/Lintian/Collect/Package.pm
index b4e85b9..1658faa 100644
--- a/lib/Lintian/Collect/Package.pm
+++ b/lib/Lintian/Collect/Package.pm
@@ -59,8 +59,7 @@ my %INDEX_FAUX_DIR_TEMPLATE = (
'_path_info' => $FILE_CODE2LPATH_TYPE{'d'} | 0755,
# Pick a "random" (but fixed) date
# - hint, it's a good read. :)
- 'date' => '1998-01-25',
- 'time' => '22:55:34',
+ 'date_time' => '1998-01-25 22:55:34',
'faux' => 1,
);
@@ -435,9 +434,10 @@ sub _fetch_index_data {
chomp($line);
my (%file, $perm, $operm, $ownership, $name, $raw_type, $size);
- ($perm,$ownership,$size,$file{date},$file{time},$name)
- =split(' ', $line, 6);
+ my ($date, $time);
+ ($perm,$ownership,$size,$date,$time,$name)=split(' ', $line, 6);
+ $file{'date_time'} = "${date} ${time}";
$raw_type = substr($perm, 0, 1);
# Only set size if it is non-zero and even then, only for
diff --git a/lib/Lintian/Path.pm b/lib/Lintian/Path.pm
index e0119b8..5dd0d18 100644
--- a/lib/Lintian/Path.pm
+++ b/lib/Lintian/Path.pm
@@ -213,6 +213,13 @@ sub size {
Return the modification date as YYYY-MM-DD.
+=cut
+
+sub date {
+ my ($self) = @_;
+ return (split(' ', $self->{'date_time'}, 2))[0];
+}
+
=item parent_dir
Returns the parent directory entry of this entry as a
@@ -269,9 +276,7 @@ happen if a package does not include all intermediate directories.
=cut
-Lintian::Path->mk_ro_accessors(
- qw(name link date time parent_dir faux
- ));
+Lintian::Path->mk_ro_accessors(qw(name link parent_dir faux));
=item operm
@@ -311,9 +316,7 @@ seconds since the start of Unix epoch in UTC.
sub timestamp {
my ($self) = @_;
- my $date = $self->{'date'};
- my $time = $self->{'time'};
- return str2time("$date $time", 'GMT');
+ return str2time($self->{'date_time'}, 'GMT');
}
=item child(BASENAME)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: