[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.10-115-g41c093b



The following commit has been merged in the master branch:
commit 41c093bce9596aa93f07438dc8027b91b932b0dd
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Aug 11 09:25:20 2012 +0200

    L::Tags: Use processables rather than "FILE" as argument
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/frontend/lintian b/frontend/lintian
index 21bf354..545e8dd 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -978,10 +978,7 @@ if($action eq 'remove'){
     foreach my $group ($pool->get_groups()){
         foreach my $proc ($group->get_processables()){
             my $pkg_name = $proc->pkg_name();
-            my $pkg_ver  = $proc->pkg_version();
             my $pkg_type = $proc->pkg_type();
-            my $pkg_path = $proc->pkg_path();
-            my $pkg_arch = $proc->pkg_arch();
             my $lpkg = _get_lpkg ($proc);
 
             if (!defined $lpkg){
@@ -991,8 +988,7 @@ if($action eq 'remove'){
                 $exit_code = 2;
                 next;
             }
-            $TAGS->file_start($pkg_path, $pkg_name, $pkg_ver,
-                              $pkg_arch, $pkg_type);
+            $TAGS->file_start ($lpkg);
             debug_msg(1, 'Removing package in lab ...');
             unless ($lpkg->remove){
                 warning("cannot remove entry for $pkg_name: $!");
@@ -1189,10 +1185,10 @@ sub auto_clean_package {
 }
 
 sub post_pkg_process_overrides{
-    my ($pkg_path) = @_;
+    my ($lpkg) = @_;
     # report unused overrides
     if (not $opt{'no-override'}) {
-        my $overrides = $TAGS->overrides($pkg_path);
+        my $overrides = $TAGS->overrides ($lpkg);
 
         for my $tag (sort keys %$overrides) {
             next if $TAGS->suppressed($tag);
@@ -1208,7 +1204,7 @@ sub post_pkg_process_overrides{
 
     # Report override statistics.
     if (not $opt{'no-override'} and not $opt{'show-overrides'}) {
-        my $stats = $TAGS->statistics($pkg_path);
+        my $stats = $TAGS->statistics ($lpkg);
         my $errors = $stats->{overrides}{types}{E} || 0;
         my $warnings = $stats->{overrides}{types}{W} || 0;
         my $info = $stats->{overrides}{types}{I} || 0;
@@ -1359,14 +1355,11 @@ sub process_group {
   PROC:
     foreach my $proc ($group->get_processables()){
         my $pkg_name = $proc->pkg_name();
-        my $pkg_ver  = $proc->pkg_version();
         my $pkg_type = $proc->pkg_type();
-        my $pkg_path = $proc->pkg_path();
-        my $pkg_arch = $proc->pkg_arch();
         my $lpkg = $proc->lab_pkg();
         my $base = $lpkg->base_dir();
 
-        $TAGS->file_start($pkg_path, $pkg_name, $pkg_ver, $pkg_arch, $pkg_type);
+        $TAGS->file_start ($lpkg);
 
         debug_msg(1, "Base directory in lab: $base");
 
@@ -1403,14 +1396,14 @@ sub process_group {
         }
 
         unless ($exit_code) {
-            my $stats = $TAGS->statistics($pkg_path);
+            my $stats = $TAGS->statistics ($lpkg);
             if ($stats->{types}{E}) {
                 $exit_code = 1;
             } elsif ($opt{'fail-on-warnings'} && $stats->{types}{W}) {
                 $exit_code = 1;
             }
         }
-        post_pkg_process_overrides($pkg_path);
+        post_pkg_process_overrides ($lpkg);
     } # end foreach my $proc ($group->get_processable())
 
     if (!$keep_lab) {
diff --git a/lib/Lintian/Tags.pm b/lib/Lintian/Tags.pm
index 2317047..4dd64d9 100644
--- a/lib/Lintian/Tags.pm
+++ b/lib/Lintian/Tags.pm
@@ -434,9 +434,9 @@ sub profile {
 
 =over 4
 
-=item file_start(FILE, PACKAGE, VERSION, ARCH, TYPE)
+=item file_start(PROC)
 
-Adds a new file with the given metadata, initializes the data structures
+Adds a new file from a processable, initializes the data structures
 used for statistics and overrides, and makes it the default file for which
 tags will be issued.  Also call Lintian::Output::print_end_pkg() to end
 the previous file, if any, and Lintian::Output::print_start_pkg() to start
@@ -448,16 +448,18 @@ earlier.
 =cut
 
 sub file_start {
-    my ($self, $file, $pkg, $version, $arch, $type) = @_;
+    my ($self, $proc) = @_;
+    my $file = $proc->pkg_path;
     if (exists $self->{info}{$file}) {
         die "duplicate of file $file added to Lintian::Tags object";
     }
     $self->{info}{$file} = {
         file              => $file,
-        package           => $pkg,
-        version           => $version,
-        arch              => $arch,
-        type              => $type,
+        package           => $proc->pkg_name,
+        version           => $proc->pkg_version,
+        arch              => $proc->pkg_arch,
+        type              => $proc->pkg_type,
+        processable       => $proc,
         overrides         => {},
         'overrides-data'  => {},
     };
@@ -617,9 +619,9 @@ sub file_end {
 
 =over 4
 
-=item overrides(FILE)
+=item overrides(PROC)
 
-Returns a reference to the overrides hash for the given file.  The keys of
+Returns a reference to the overrides hash for the given processable.  The keys of
 this hash are the tags for which are overrides.  The value for each key is
 another hash, whose keys are the extra data matched by that override and
 whose values are the counts of tags that matched that override.  Overrides
@@ -635,17 +637,17 @@ tag some-tag, regardless of what extra data was associated with it.
 =cut
 
 sub overrides {
-    my ($self, $file) = @_;
-    if ($self->{info}{$file}) {
-        return $self->{info}{$file}{overrides};
+    my ($self, $proc) = @_;
+    if ($proc and $self->{info}{$proc->pkg_path}) {
+        return $self->{info}{$proc->pkg_path}{overrides};
     } else {
         return;
     }
 }
 
-=item statistics([FILE])
+=item statistics([PROC])
 
-Returns a reference to the statistics hash for the given file or, if FILE
+Returns a reference to the statistics hash for the given proccessable or, if PROC
 is omitted, a reference to the full statistics hash for all files.  In the
 latter case, the returned hash reference has as keys the file names and as
 values the per-file statistics.
@@ -660,8 +662,8 @@ regular counts).
 =cut
 
 sub statistics {
-    my ($self, $file) = @_;
-    return $self->{statistics}{$file} if $file;
+    my ($self, $proc) = @_;
+    return $self->{statistics}{$proc->pkg_path} if $proc;
     return $self->{statistics};
 }
 

-- 
Debian package checker


Reply to: