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

[SCM] Debian package checker branch, master, updated. 2.5.3-219-g1bf4f89



The following commit has been merged in the master branch:
commit 1bf4f89cd55676206da554a3d1414f83a7c98547
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Nov 17 16:09:21 2011 +0100

    Created Lintian::Collect::Group to handle group data
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/circular-deps b/checks/circular-deps
index b8e26a6..eb0591d 100644
--- a/checks/circular-deps
+++ b/checks/circular-deps
@@ -43,21 +43,16 @@ my $group = shift;
 my @nodes = ();
 my %edges = ();
 my $sccs;
+my $ginfo = $group->info;
 
 foreach my $proc ($group->get_processables('binary')) {
-    my $pname = $proc->pkg_name;
-    my $relation = $proc->info->relation('strong');
-    my $deps = [];
-    foreach my $oproc ($group->get_processables('binary')) {
-        my $opname = $oproc->pkg_name;
-        next if $opname eq $pname;
-        push @$deps, $opname if $relation->implies($opname);
-    }
+    my $deps = $ginfo->direct_dependencies ($proc);
     if (scalar @$deps > 0) {
         # it depends on another package - it can cause
         # a circular dependency
+        my $pname = $proc->pkg_name;
         push @nodes, $pname;
-        $edges{$pname} = $deps;
+        $edges{$pname} = [map { $_->pkg_name } @$deps];
     }
 }
 
diff --git a/checks/manpages b/checks/manpages
index d80a27f..59d1757 100644
--- a/checks/manpages
+++ b/checks/manpages
@@ -36,13 +36,12 @@ my $info = shift;
 my $proc = shift;
 my $group = shift;
 
-
+my $ginfo = $group->info;
 my %binary;
 my %link;
 # my %sect_by_binary;
 # my %sect_by_manpage;
 my %manpage;
-my $relation;
 
 # Read package contents...
 foreach my $file (@{$info->sorted_index}) {
@@ -335,32 +334,27 @@ foreach my $file (@{$info->sorted_index}) {
 }
 
 # Check our dependencies:
-$relation = $info->relation('strong');
-foreach my $depproc ($group->get_processables('binary')){
-    if ($relation->implies($depproc->pkg_name())){
-        # Find the manpages in our related dependencies
-        my $depinfo = $depproc->info();
-        foreach my $file (@{ $depinfo->sorted_index() }){
-            next if $file eq '';
-            my $index_info = $depinfo->index->{$file};
-            my $perm = $index_info->{type};
-            my ($fname, $path, $suffix) = fileparse($file, qr,\..+$,o);
-            my $lang = '';
-            next unless ($perm =~ m,^[\-lh],o) and
-                (($path =~ m,^usr/man/\S+,o)
-                 or ($path =~ m,^usr/X11R6/man/\S+,o)
-                 or ($path =~ m,^usr/share/man/\S+,o) );
-            next unless ($path =~ m,man\d/$,o);
-            $manpage{$fname} = [] unless exists $manpage{$fname};
-            $lang = $1 if $path =~ m,/([^/]+)/man\d/$,o;
-            $lang = '' if $lang eq 'man';
-            push @{$manpage{$fname}}, {file => $file, lang => $lang};
-        }
+foreach my $depproc (@{ $ginfo->direct_dependencies ($proc) }) {
+    # Find the manpages in our related dependencies
+    my $depinfo = $depproc->info();
+    foreach my $file (@{ $depinfo->sorted_index() }){
+        next if $file eq '';
+        my $index_info = $depinfo->index->{$file};
+        my $perm = $index_info->{type};
+        my ($fname, $path, $suffix) = fileparse($file, qr,\..+$,o);
+        my $lang = '';
+        next unless ($perm =~ m,^[\-lh],o) and
+            (($path =~ m,^usr/man/\S+,o)
+             or ($path =~ m,^usr/X11R6/man/\S+,o)
+             or ($path =~ m,^usr/share/man/\S+,o) );
+        next unless ($path =~ m,man\d/$,o);
+        $manpage{$fname} = [] unless exists $manpage{$fname};
+        $lang = $1 if $path =~ m,/([^/]+)/man\d/$,o;
+        $lang = '' if $lang eq 'man';
+        push @{$manpage{$fname}}, {file => $file, lang => $lang};
     }
 }
 
-
-
 for my $f (sort keys %binary) {
     if (exists $manpage{$f}) {
         # X11 binary?  This shouldn't happen any more; these are no longer
diff --git a/checks/symlinks b/checks/symlinks
index c5ae056..8671b75 100644
--- a/checks/symlinks
+++ b/checks/symlinks
@@ -23,7 +23,6 @@ use strict;
 use warnings;
 
 use File::Basename qw(dirname);
-use Lintian::Relation ();
 use Lintian::Tags qw(tag);
 use Util;
 
@@ -35,10 +34,10 @@ my $info = shift;
 my $proc = shift;
 my $group = shift;
 
+my $ginfo = $group->info;
 my $index = $info->index;
 my @brokenlinks;
 my @dindexes;
-my $relation;
 
 foreach my $file (@{$info->sorted_index}) {
     my $index_info = $index->{$file};
@@ -78,11 +77,8 @@ foreach my $file (@{$info->sorted_index}) {
 return unless @brokenlinks;
 
 # Check our dependencies:
-$relation = $info->relation('strong');
-foreach my $depproc ($group->get_processables($type)){
-    if ($relation->implies($depproc->pkg_name())){
-        push @dindexes, $depproc->info->index;
-    }
+foreach my $depproc (@{ $ginfo->direct_dependencies ($proc)}) {
+    push @dindexes, $depproc->info->index;
 }
 
 BLINK:
diff --git a/debian/changelog b/debian/changelog
index cbb2977..381e5c6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ lintian (2.5.4) UNRELEASED; urgency=low
   * checks/*:
     + [JW] Replace common_data.pm with Lintian::Check.
     + [NT] Remove some unused "use lib <expr>" from various checks.
+    + [NT] Use Lintian::Collect::Group to find direct dependencies.
   * checks/binaries:
     + [JW] Allow binaries to use "/usr/lib/$srcpkg/" in RPATHs.
       (Closes: #642092)
@@ -148,6 +149,8 @@ lintian (2.5.4) UNRELEASED; urgency=low
     + [NT] Removed, replaced by Lintian::Package{,::Entry}.
   * lib/Lintian/Check.pm:
     + [JW] Merged with common_data.pm.
+  * lib/Lintian/Collect/Group.pm:
+    + [NT] New file - Collect like API for group data.
   * lib/Lintian/Data.pm:
     + [NT] Fixed a file descriptor leak.
   * lib/Lintian/Collect/Source.pm:
diff --git a/lib/Lintian/ProcessableGroup.pm b/lib/Lintian/ProcessableGroup.pm
index 49486ea..5fe3199 100644
--- a/lib/Lintian/ProcessableGroup.pm
+++ b/lib/Lintian/ProcessableGroup.pm
@@ -23,7 +23,9 @@ use strict;
 use warnings;
 
 use Util;
+use Lintian::Collect::Group;
 use Lintian::Processable;
+
 =head1 NAME
 
 Lintian::ProcessableGroup -- A group of objects that Lintian can process
@@ -292,6 +294,33 @@ sub get_binary_processables {
 }
 
 
+=item $group->info
+
+Returns L<Lintian::Collect::Group|$info> element for this group.
+
+=cut
+
+sub info {
+    my ($self) = @_;
+    my $info = $self->{info};
+    if (! defined $info) {
+        $info = Lintian::Collect::Group->new ($self);
+    }
+    return $info;
+}
+
+=item $group->clear_cache
+
+Discard the info element, so the memory used by it can be reclaimed.
+Mostly useful when checking a lot of packages (e.g. on lintian.d.o).
+
+=cut
+
+sub clear_cache {
+    my ($self) = @_;
+    delete $self->{info};
+}
+
 =back
 
 =head1 AUTHOR

-- 
Debian package checker


Reply to: