Accessing the Lintian Lab on lintian.debian.org

The Lintian Perl libraries are available on lintian.d.o and can be used to access to the Lintian laboratory. This page aims to describe how to access the laboratory via these libraries.

Last update was for Lintian 2.5.10.2; note methods/modules listed here do not necessarily have a stable API. If you want a stable API, then keep an eye on 359059.

Using access-lintian-lab

By using ~nthykier/bin/access-lintian-lab it is as simple as:

   1 use strict;
   2 use warnings;
   3 
   4 sub visit {
   5     my ($entry) = @_;
   6     my $pkg_type = $entry->pkg_type; # One of "binary", "udeb", "source"
   7     # This is a Lintian::Collect obj (i.e. one of Lintian::Collect::{Binary,Source})
   8     my $info = $entry->info;
   9     if ($pkg_type eq 'source') {
  10         # Do something with $info, which is a Lintian::Collect::Source
  11     } elsif ($pkg_type eq 'binary' or $pkg_type eq 'udeb') {
  12         # Do something with $info, which is a Lintian::Collect::Binary
  13     }
  14 }
  15 1;

More information is available via:

 $ ~nthykier/bin/access-lintian-lab --manpage 2>&1 | less
 $ ls ~nthykier/lintian-utils/examples/access-lintian-lab/

The minimal setup - by hand

A minimal "do it yourself" sample looks something like:

   1 #!/usr/bin/perl
   2 use strict;
   3 use warnings;
   4 
   5 use lib "$ENV{'LINTIAN_ROOT'}";
   6 use Lintian::Lab;
   7 
   8 my $lab = Lintian::Lab->new ($ENV{'LINTIAN_LAB');
   9 $lab->open;
  10 
  11 eval {
  12     $lab->visit_packages (\&visit);
  13 };
  14 
  15 $lab->close;
  16 
  17 sub visit {
  18     my ($entry, $pkg_name, $pkg_version, $pkg_arch) = @_;
  19     my $pkg_type = $entry->pkg_type; # One of "binary", "udeb", "source"
  20     # This is a Lintian::Collect obj (i.e. one of Lintian::Collect::{Binary,Source})
  21     my $info = $entry->info;
  22     if ($pkg_type eq 'source') {
  23         # Do something with $info, which is a Lintian::Collect::Source
  24     } elsif ($pkg_type eq 'binary' or $pkg_type eq 'udeb') {
  25         # Do something with $info, which is a Lintian::Collect::Binary
  26     }
  27 }

Where the following environment variables have been set:

   1 LINTIAN_ROOT=/srv/lintian.debian.org/root
   2 LINTIAN_LAB=/srv/lintian.debian.org/laboratory

Caveats

There are a number of caveats of which you should be aware: