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:
Caveats
There are a number of caveats of which you should be aware:
- There is no locking; if your script intersects with Lintian's run, your script will almost certainly break. "Full runs" take up to 3 days, in which your script will may or may not work at all.
The package files themselves are on a local mirror. Lintian only prunes "dead" entries during its run (i.e. entries where the package is no longer on the mirror). In practise, it means any attempt to access to underlying package or any of the fields in the "control" file may fail if the package is no longer available. $info->field and anything (in)directly using that may stop working...
"unpacked" (i.e. $info->unpacked) is not available.
