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

[SCM] Debian package checker branch, master, updated. 2.5.4-66-g3d52617



The following commit has been merged in the master branch:
commit 3d52617c053f2fcb536a7f0c315a1e355451a59d
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Dec 22 11:02:46 2011 +0100

    frontend/lintian: Support GROUP lab queries
    
    GROUP lab queries can be used to select all the packages in a given
    source package.  This makes it easier to re-run or remove all packages
    in a group.  The latter is useful for re-scheduling a source package
    (and its binaries) via harness's incremental run.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index af6b09d..76a8aa5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -105,6 +105,9 @@ lintian (2.5.5) UNRELEASED; urgency=low
     + [NT] Attempt guess the version number when running in an git
       checkout or unpacked source dir.  Based on patch from Evan
       Broder.  (Closes: #650701)
+    + [NT] Added support for the virtual "GROUP" type in Lab Queries.
+      This will make Lintian select all packages related to a given
+      source (and version).
   * frontend/lintian-info:
     + [NT] Support new lintian.log format.
     + [NT] Support new override file format with -a.
diff --git a/frontend/lintian b/frontend/lintian
index 448c905..e7b6e8a 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -102,6 +102,9 @@ my %opt;                        #hash of some flags from cmd or cfg
 my %conf_opt;                   #names of options set in the cfg file
 my $no_profile = 0;             #whether a profile should be loaded
 
+my %group_cache = ();           # Cache to store groups in case of group
+                                # queries
+
 # The profile search path except LINTIAN_ROOT/profiles
 #  which will be added later (we dont know LINTIAN_ROOT
 #  at this point)
@@ -970,6 +973,10 @@ if ($check_everything) {
     close $fd unless $opt{'packages-from-file'} eq '-';
 }
 
+# Remove the group cache in case there has been group lab queries.  We
+# do not need this cache anymore.
+_clear_group_cache();
+
 # }}}
 
 # {{{ Some silent exit
@@ -1717,6 +1724,17 @@ sub handle_lab_query {
             my @pkgs = $LAB->get_package ($pkg, $t, $version, $arch);
             push @res, @pkgs;
         }
+    } elsif ($type eq 'GROUP') {
+        _build_group_cache() unless %group_cache;
+        if (exists $group_cache{$pkg}) {
+            if (defined $version) {
+                push @res, @{ $group_cache{$pkg}->{$version} };
+            } else {
+                foreach my $v (keys %{ $group_cache{$pkg} }) {
+                    push @res, @{ $group_cache{$pkg}->{$v} };
+                }
+            }
+        }
     } else {
         # specific type requested
         my @pkgs = $LAB->get_package ($pkg, $type, $version, $arch);
@@ -1736,6 +1754,20 @@ sub handle_lab_query {
     }
 }
 
+sub _build_group_cache {
+    # Globals %group_cache and $LAB
+    $LAB->visit_packages (sub {
+        my ($entry) = @_;
+        my $src = $entry->pkg_src;
+        my $src_version = $entry->pkg_src_version;
+        push @{ $group_cache{$src}->{$src_version} }, $entry;
+    });
+}
+
+sub _clear_group_cache {
+    undef %group_cache;
+}
+
 sub _guess_version {
     require File::Basename;
     require Cwd;
diff --git a/man/lintian.pod.in b/man/lintian.pod.in
index 6285e07..4df48f7 100644
--- a/man/lintian.pod.in
+++ b/man/lintian.pod.in
@@ -633,10 +633,16 @@ Where:
 =item type
 
 This is the type of the package and (if present) must be one of "ALL",
-"binary", "udeb", "source" or "changes".  This is case sensitive.
+"GROUP", "binary", "udeb", "source" or "changes".  This is case
+sensitive.
 
 If omitted this defaults to "ALL" unless another default has been
-specified (see B<--binary>, B<--udeb> or B<--source>).
+specified (see B<--binary>, B<--udeb> or B<--source>).  The pseudo
+type "ALL" acts as a wildcard for any real package type.
+
+The special type "GROUP" can be used to match all packages related to
+a given source package.  For more info, please see L<Group query>
+below.
 
 =item package
 
@@ -655,7 +661,7 @@ then any architecture will do.  Otherwise the architecture must match
 exactly.
 
 Note: This is I<completely> ignored when matching against source
-packages.
+packages or when type is "GROUP".
 
 Note: For changes packages, this must match the contents of the
 architecture field in the changes.  This field may contain a space
@@ -663,6 +669,13 @@ architecture field in the changes.  This field may contain a space
 
 =back
 
+=head2 Group query
+
+A group query can be used to (re-)process all packages in a given
+group.  The I<package> and I<version> part will be used to look up one
+or more source packages.  The binaries, udebs and changes files for
+each matching source package will also be activated.
+
 =head1 EXAMPLES
 
 =over 4

-- 
Debian package checker


Reply to: