r69313 - in /trunk/libdpkg-log-perl: ./ debian/ examples/ lib/DPKG/ lib/DPKG/Log/ lib/DPKG/Log/Analyse/ t/ test_data/ test_data/multi/ tools/

schoenfeld at users.alioth.debian.org schoenfeld at users.alioth.debian.org
Tue Feb 22 09:32:18 UTC 2011


Author: schoenfeld
Date: Tue Feb 22 09:31:58 2011
New Revision: 69313

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=69313
Log:
New upstream release

Added:
    trunk/libdpkg-log-perl/examples/
      - copied from r69312, branches/upstream/libdpkg-log-perl/current/examples/
    trunk/libdpkg-log-perl/lib/DPKG/Log/Analyse/
      - copied from r69312, branches/upstream/libdpkg-log-perl/current/lib/DPKG/Log/Analyse/
    trunk/libdpkg-log-perl/t/dpkg-log-analyse-package.t
      - copied unchanged from r69312, branches/upstream/libdpkg-log-perl/current/t/dpkg-log-analyse-package.t
    trunk/libdpkg-log-perl/t/dpkg-log-analyse.t
      - copied unchanged from r69312, branches/upstream/libdpkg-log-perl/current/t/dpkg-log-analyse.t
    trunk/libdpkg-log-perl/t/pod.t
      - copied unchanged from r69312, branches/upstream/libdpkg-log-perl/current/t/pod.t
    trunk/libdpkg-log-perl/t/timing.t
      - copied unchanged from r69312, branches/upstream/libdpkg-log-perl/current/t/timing.t
    trunk/libdpkg-log-perl/test_data/big.log
      - copied unchanged from r69312, branches/upstream/libdpkg-log-perl/current/test_data/big.log
    trunk/libdpkg-log-perl/test_data/multi/
      - copied from r69312, branches/upstream/libdpkg-log-perl/current/test_data/multi/
Removed:
    trunk/libdpkg-log-perl/tools/
Modified:
    trunk/libdpkg-log-perl/Changes
    trunk/libdpkg-log-perl/MANIFEST
    trunk/libdpkg-log-perl/debian/   (props changed)
    trunk/libdpkg-log-perl/debian/changelog
    trunk/libdpkg-log-perl/lib/DPKG/Log.pm
    trunk/libdpkg-log-perl/lib/DPKG/Log/Analyse.pm
    trunk/libdpkg-log-perl/lib/DPKG/Log/Entry.pm
    trunk/libdpkg-log-perl/t/dpkg-log-entry.t
    trunk/libdpkg-log-perl/t/dpkg-log.t

Modified: trunk/libdpkg-log-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdpkg-log-perl/Changes?rev=69313&op=diff
==============================================================================
--- trunk/libdpkg-log-perl/Changes (original)
+++ trunk/libdpkg-log-perl/Changes Tue Feb 22 09:31:58 2011
@@ -1,4 +1,19 @@
 Revision history for Perl extension DPKG::Log.
 
-1.00  Fri Feb 18 10:00:00 2010
+1.10  Fri Feb 18 14:35:00 2011
+    - Bugfix in DPKG::Log::Entry: available_version did not return
+      a value.
+    - Bugfix in DPKG::Log: Handle parse param properly
+    - Fixed some perlcritic critics
+    - Fixed various POD problems
+    - Use test_data/dpkg.log in t/dpkg-log.t
+    - Make it possible to initialize new objects from existing
+      references
+    - Extend tests
+    - Add support to DPKG::Log::Analyse to specify an existing
+      DPKG::Log object as log_handle
+    - Add support to DPKG::Log to specify time_zone as
+      DateTime::TimeZone objects
+    - Add missing file (DPKG/Log/Analyse/Package.pm) to tarball
+1.00  Fri Feb 18 10:00:00 2011
 	- Initial version

Modified: trunk/libdpkg-log-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdpkg-log-perl/MANIFEST?rev=69313&op=diff
==============================================================================
--- trunk/libdpkg-log-perl/MANIFEST (original)
+++ trunk/libdpkg-log-perl/MANIFEST Tue Feb 22 09:31:58 2011
@@ -1,6 +1,7 @@
 Changes
 lib/DPKG/Log.pm
 lib/DPKG/Log/Analyse.pm
+lib/DPKG/Log/Analyse/Package.pm
 lib/DPKG/Log/Entry.pm
 Makefile
 Makefile.PL
@@ -12,8 +13,15 @@
 t/dpkg-log-entry.t
 t/dpkg-log.t
 t/from_to.t
+t/pod.t
+t/timing.t
+t/dpkg-log-analyse-package.t
+t/dpkg-log-analyse.t
 test_data/dpkg.log
 test_data/from_to.log
 test_data/install.log
-tools/dpkg-report
-tools/dpkg-report.tt2
+test_data/big.log
+test_data/multi/test1.dpkg.log
+test_data/multi/test2.dpkg.log
+examples/dpkg-report
+examples/dpkg-report.tt2

Propchange: trunk/libdpkg-log-perl/debian/
------------------------------------------------------------------------------
--- svn-bp:tagsUrl (original)
+++ svn-bp:tagsUrl Tue Feb 22 09:31:58 2011
@@ -1,1 +1,1 @@
-svn+ssh://svn.debian.org/svn/pkg-perl/tags/.
+svn+ssh://svn.debian.org/svn/pkg-perl/tags/libdpkg-log-perl

Propchange: trunk/libdpkg-log-perl/debian/
------------------------------------------------------------------------------
--- svn-bp:trunkUrl (original)
+++ svn-bp:trunkUrl Tue Feb 22 09:31:58 2011
@@ -1,1 +1,1 @@
-svn+ssh://svn.debian.org/svn/pkg-perl/trunk/.
+svn+ssh://svn.debian.org/svn/pkg-perl/trunk/libdpkg-log-perl

Propchange: trunk/libdpkg-log-perl/debian/
------------------------------------------------------------------------------
--- svn-bp:upsCurrentUrl (original)
+++ svn-bp:upsCurrentUrl Tue Feb 22 09:31:58 2011
@@ -1,1 +1,1 @@
-svn+ssh://svn.debian.org/svn/pkg-perl/branches/upstream/./current
+svn+ssh://svn.debian.org/svn/pkg-perl/branches/upstream/libdpkg-log-perl/current

Propchange: trunk/libdpkg-log-perl/debian/
------------------------------------------------------------------------------
--- svn-bp:upsTagUrl (original)
+++ svn-bp:upsTagUrl Tue Feb 22 09:31:58 2011
@@ -1,1 +1,1 @@
-svn+ssh://svn.debian.org/svn/pkg-perl/branches/upstream/.
+svn+ssh://svn.debian.org/svn/pkg-perl/branches/upstream/libdpkg-log-perl

Modified: trunk/libdpkg-log-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdpkg-log-perl/debian/changelog?rev=69313&op=diff
==============================================================================
--- trunk/libdpkg-log-perl/debian/changelog (original)
+++ trunk/libdpkg-log-perl/debian/changelog Tue Feb 22 09:31:58 2011
@@ -1,3 +1,9 @@
+libdpkg-log-perl (1.10-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Patrick Schoenfeld <schoenfeld at debian.org>  Tue, 22 Feb 2011 10:29:37 +0100
+
 libdpkg-log-perl (1.00-1) unstable; urgency=low
 
   * Initial Release.

Modified: trunk/libdpkg-log-perl/lib/DPKG/Log.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdpkg-log-perl/lib/DPKG/Log.pm?rev=69313&op=diff
==============================================================================
--- trunk/libdpkg-log-perl/lib/DPKG/Log.pm (original)
+++ trunk/libdpkg-log-perl/lib/DPKG/Log.pm Tue Feb 22 09:31:58 2011
@@ -25,7 +25,7 @@
 use warnings;
 use 5.010;
 
-our $VERSION = "1.00";
+our $VERSION = "1.10";
 
 use Carp;
 use DPKG::Log::Entry;
@@ -54,13 +54,15 @@
 
 By default the module will assume that those timestamps are in the local timezone
 as determined by DateTime::TimeZone. This can be overriden by giving the
-argument B<time_zone> which takes a timezone string (e.g. 'Europe/Berlin').
+argument B<time_zone> which takes a timezone string (e.g. 'Europe/Berlin')
+or a DateTime::TimeZone object.
 Additionally its possible to override the timestamp_pattern by specifying
 B<timestamp_format>. This has to be a valid pattern for DateTime::Format::Strptime.
 
 =cut
 sub new {
     my $package = shift;
+    $package = ref($package) if ref($package);
 
     my %params = validate(@_,
         {
@@ -84,6 +86,9 @@
     };
 
     bless($self, $package);
+    
+    $self->parse if $params{'parse'};
+
     return $self;
 }
 
@@ -108,12 +113,14 @@
 
 =item $dpkg_log->parse('time_zone' => 'Europe/Berlin')
 
+=item $dpkg_log->parse('time_zone' => $dt_tz )
+
 Call the parser.
 
 The B<time_zone> parameter is optional and specifies in which time zone
-the dpkg log timestamps are.  If its ommitted it will use the default
+the dpkg log timestamps are.  If its omitted it will use the default
 local time zone.
-
+Its possible to specify either a DateTime::TimeZone object or a string.
 =cut
 sub parse {
     my $self = shift;
@@ -130,7 +137,14 @@
     );
 
     # Determine system timezone
-    my $tz =  DateTime::TimeZone->new( 'name' => $params{time_zone} );
+    my $tz;
+    if (ref($params{time_zone}) and (ref($params{time_zone}) eq "DateTime::TimeZone")) {
+        $tz = $params{time_zone};
+    } elsif (ref($params{time_zone})) {
+        croak "time_zone argument has to be a string or a DateTime::TimeZone object";
+    } else {
+        $tz =  DateTime::TimeZone->new( 'name' => $params{time_zone} );
+    }
     my $ts_parser = DateTime::Format::Strptime->new( 
         pattern => $params{timestamp_pattern},
         time_zone => $params{time_zone}
@@ -228,7 +242,7 @@
 
 =item @entries = $dpkg_log->entries;
 
-=item @entries = $dpkg_log->entries('from' => '2010-01-01 00:00:00', to => '2010-01-02 24:00:00')
+=item @entries = $dpkg_log->entries('from' => '2010-01-01.10:00:00', to => '2010-01-02 24:00:00')
 
 Return all entries or all entries in a given timerange.
 
@@ -311,7 +325,7 @@
 values set during object initialisation.
 
 =cut
-sub get_datetime_info() {
+sub get_datetime_info {
     my $self = shift;
 
     my $from;
@@ -369,6 +383,7 @@
 
     $self->{from} = $from;
     $self->{to} = $to;
+    return;
 }
 
 

Modified: trunk/libdpkg-log-perl/lib/DPKG/Log/Analyse.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdpkg-log-perl/lib/DPKG/Log/Analyse.pm?rev=69313&op=diff
==============================================================================
--- trunk/libdpkg-log-perl/lib/DPKG/Log/Analyse.pm (original)
+++ trunk/libdpkg-log-perl/lib/DPKG/Log/Analyse.pm Tue Feb 22 09:31:58 2011
@@ -1,7 +1,7 @@
 package DPKG::Log::Analyse;
 
 
-=head1 NMAE
+=head1 NAME
 
 DPKG::Log::Analyse - Analyse a dpkg log
 
@@ -22,29 +22,36 @@
 
 =cut
 
-our $VERSION = "1.00";
-
-use 5.010;
 use strict;
 use warnings;
+use 5.010;
+
+our $VERSION = "1.10";
 
 use Carp;
 use DPKG::Log;
 use DPKG::Log::Analyse::Package;
 use Params::Validate qw(:all);
 
-=item $dpkg_log = DPKG::Log->new('filename' => 'dpkg.log')
+=item $analser = DPKG::Log::Analyse->new('filename' => 'dpkg.log')
+
+=item $analyser = DPKG::Log::Analyse->new('log_handle' => \$dpkg_log)
 
 Returns a new DPKG::Log::Analyse object.
 Filename parameter can be ommitted, it defaults to /var/log/dpkg.log.
 
+Its possible to specify an existing DPKG::Log object instead of a filename.
+This will be used and overrides any filename setting.
+
 =cut
 sub new {
     my $package = shift;
+    $package = ref($package) if ref($package);
 
     my %params = validate(
         @_, {
                 'filename' => { 'type' => SCALAR, 'default' => '/var/log/dpkg.log' },
+                'log_handle' => { isa => 'DPKG::Log', default => undef } 
             }
     );
     
@@ -56,12 +63,18 @@
         upgraded_packages => {},
         halfinstalled_packages => {},
         halfconfigured_packages => {},
+        unpacked_packages => {},
+        installed_and_removed_packages => {},
     };
 
     if ($params{'filename'}) {
         $self->{'filename'} = $params{'filename'};
     }
-    $self->{dpkg_log} = DPKG::Log->new('filename' => $self->{'filename'});
+    if ($params{'log_handle'}) {
+        $self->{dpkg_log} = $params{'log_handle'};
+    } else {
+        $self->{dpkg_log} = DPKG::Log->new('filename' => $self->{'filename'});
+    }
     $self->{dpkg_log}->parse;
 
     bless($self, $package);
@@ -82,9 +95,12 @@
     $self->{from} = $dpkg_log->{from};
     $self->{to} = $dpkg_log->{to};
 
+    my $analysed_entries=0;
     foreach my $entry ($dpkg_log->entries) {
         next if not $entry->associated_package;
-        
+       
+        $analysed_entries++;
+
         # Initialize data structure if this is a package
         my $package = $entry->associated_package;
         if (not defined $self->{packages}->{$package}) {
@@ -132,6 +148,8 @@
 
     # Forget about the log object once analysis is done
     $self->{dpkg_log} = undef;
+
+    return 1;
 }
 
 =item $analyser->newly_installed_packages

Modified: trunk/libdpkg-log-perl/lib/DPKG/Log/Entry.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdpkg-log-perl/lib/DPKG/Log/Entry.pm?rev=69313&op=diff
==============================================================================
--- trunk/libdpkg-log-perl/lib/DPKG/Log/Entry.pm (original)
+++ trunk/libdpkg-log-perl/lib/DPKG/Log/Entry.pm Tue Feb 22 09:31:58 2011
@@ -51,7 +51,7 @@
 our @ISA = qw(Exporter);
 our @EXPORT = qw( $valid_types $valid_actions );
 
-our $VERSION = '1.00';
+our $VERSION = '1.10';
 our $valid_types = {
     status => 1,
     action => 1,
@@ -85,6 +85,8 @@
 =cut
 sub new {
     my $package = shift;
+    $package = ref($package) if ref($package);
+
     my %params = validate( 
         @_, { 
                 'line' => { 'type' => SCALAR },
@@ -274,6 +276,7 @@
     } else {
         $available_version = $self->{available_version};
     }
+    return $available_version;
 }
 
 =item $dpkg_log_entry->conffile() / conffile
@@ -305,6 +308,7 @@
 }
 
 =back
+
 =head1 SEE ALSO
 
 L<DateTime>

Modified: trunk/libdpkg-log-perl/t/dpkg-log-entry.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdpkg-log-perl/t/dpkg-log-entry.t?rev=69313&op=diff
==============================================================================
--- trunk/libdpkg-log-perl/t/dpkg-log-entry.t (original)
+++ trunk/libdpkg-log-perl/t/dpkg-log-entry.t Tue Feb 22 09:31:58 2011
@@ -1,6 +1,20 @@
-use Test::More tests => 63;
+use Test::More tests => 76;
 use lib 'lib';
 use DPKG::Log;
+use DPKG::Log::Entry;
+
+can_ok('DPKG::Log::Entry', 'line');
+can_ok('DPKG::Log::Entry', 'lineno');
+can_ok('DPKG::Log::Entry', 'timestamp');
+can_ok('DPKG::Log::Entry', 'type');
+can_ok('DPKG::Log::Entry', 'associated_package');
+can_ok('DPKG::Log::Entry', 'action');
+can_ok('DPKG::Log::Entry', 'status');
+can_ok('DPKG::Log::Entry', 'subject');
+can_ok('DPKG::Log::Entry', 'installed_version');
+can_ok('DPKG::Log::Entry', 'available_version');
+can_ok('DPKG::Log::Entry', 'conffile');
+can_ok('DPKG::Log::Entry', 'decision');
 
 my $dpkg_log_entry;
 ok($dpkg_log_entry = DPKG::Log::Entry->new(
@@ -99,3 +113,4 @@
 is($entry->subject, "package", "entry $entry_no has correct subject");
 is($entry->associated_package, "libdatetime-format-strptime-perl", "entry $entry_no has correct package");
 is($entry->installed_version, "1.5000-1", "entry $entry_no has correct installed_version");
+ok($entry->new(line => "2011-02-02 11:15:33 startup archives unpack", lineno => 1), "init DPKG::Log::Entry from existing ref");

Modified: trunk/libdpkg-log-perl/t/dpkg-log.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdpkg-log-perl/t/dpkg-log.t?rev=69313&op=diff
==============================================================================
--- trunk/libdpkg-log-perl/t/dpkg-log.t (original)
+++ trunk/libdpkg-log-perl/t/dpkg-log.t Tue Feb 22 09:31:58 2011
@@ -1,10 +1,14 @@
-use Test::More tests => 9;
+use Test::More tests => 16;
 use lib 'lib';
 use DPKG::Log;
 
 my $dpkg_log;
 my $filename;
-ok($dpkg_log = DPKG::Log->new(), "initialize DPKG::Log object");
+can_ok('DPKG::Log', 'entries');
+can_ok('DPKG::Log', 'next_entry');
+can_ok('DPKG::Log', 'filter_by_time');
+can_ok('DPKG::Log', 'get_datetime_info');
+ok($dpkg_log = DPKG::Log->new(filename => 'test_data/dpkg.log'), "initialize DPKG::Log object");
 ok($filename = $dpkg_log->filename, "filename() returns filename");
 ok($dpkg_log->filename("test.log"), "filename('test.log')");
 is($dpkg_log->filename, "test.log", "filename() returns 'test.log'");
@@ -13,5 +17,8 @@
 is(scalar(@{$dpkg_log->{invalid_lines}}), 0, "0 invalid lines" );
 ok($entry = $dpkg_log->next_entry, "next entry returns an entry" );
 isa_ok($entry, "DPKG::Log::Entry", "entry");
-
 ok( my ($from, $to) = $dpkg_log->get_datetime_info(), "get_datetime_info returns report period info");
+ok( $dpkg_log = DPKG::Log->new(filename => 'test_data/dpkg.log', parse => 1),
+    'initialize DPKG::Log object with parse = 1');
+ok ( eval { $dpkg_log->entries >= 0 } , "object stores entries");
+ok ($dpkg_log = $dpkg_log->new(filename => 'test_data/dpkg.log'), 'initialize object from existing ref');




More information about the Pkg-perl-cvs-commits mailing list