Lintian::CheckScript (3) - Linux Manuals

Lintian::CheckScript: Check script meta data

NAME

Lintian::CheckScript - Check script meta data

SYNOPSIS

 use Lintian::CheckScript;
 
 my $cs = Lintian::CheckScript->new ("$ENV{'LINTIAN_ROOT'}/checks/",
                                     'files');
 my $name = $cs->name;
 foreach my $tag ($cs->tags) {
    # $ti is an instance of Lintian::Tag::Info
    my $ti = $cs->get_tag ($tag);
    print "$tag is a part of the check $name\n";
    # Do something with $ti / $tag
 }
 foreach my $needs ($cs->needs_info) {
    print "$name needs $needs\n";
 }
 if ($cs->is_check_type ('binary') && $cs->is_check_type ('source')) {
    # Check applies to binary pkgs AND source pkgs
 }

DESCRIPTION

Instances of this class represents the data in the check ``.desc'' files. It allows access to the tags (as Lintian::Tag::Info) and the common meta data of the check (such as Needs-Info).

CLASS METHODS

Lintian::CheckScript->new($basedir, $checkname)
Parses the $file as a check desc file.
$cs->name
Returns the ``name'' of the check script. This is the value in the Check-Script field in the file.
$cs->type
Returns the value stored in the ``Type'' field of the file. For the purpose of testing if the check applies to a given package type, the ``is_check_type'' method can be used instead.

Note in rare cases this may return undef. This is the case for the lintian.desc, where this field is simply not present.

$cs->abbrev
Returns the value of the Abbrev field from the desc file.
$cs->script_path
Returns the (expected) path to the script implementing this check.
needs_info
Returns a list of all items listed in the Needs-Info field. Neither the list nor its contents should be modified.
$cs->is_check_type ($type)
Returns a truth value if this check can be applied to a $type package.

Note if $cs->type return undef, this will return a truth value for all inputs.

$cs->get_tag ($tagname)
Return the tag or undef (if the tag is not in this check).
$cs->tags
Returns the list of tag names in the check. The list nor its contents should be modified.
$cs->load_check
Attempts to load the check. On failure, the load error will be propagated to the caller. On success it returns normally.
$cs->run_check ($proc, $group)
Run the check on $proc, which is in the group $group. $proc should be a lab entry and must have the proper collections run on it prior to calling this method (See Lintian::Unpacker).

The method may error out if loading the check failed or if the check itself calls die/croak/fail/etc.

Returns normally on success; the return value has no semantic meaning and is currently "undef".

NB: load_check can be used to determine if the check itself is loadable.

AUTHOR

Originally written by Niels Thykier <niels [at] thykier.net> for Lintian.