Lintian::Processable(3) An (abstract) object that Lintian can process


use Lintian::Processable::Package;

# Instantiate via Lintian::Processable::Package
my $proc = Lintian::Processable::Package->new ('lintian_2.5.0_all.deb');
my $pkg_name = $proc->pkg_name;
my $pkg_version = $proc->pkg_version;
# etc.


Instances of this perl class are objects that Lintian can process (e.g. deb files). Multiple objects can then be combined into groups, which Lintian will process together.


new_from_metadata (TYPE, PARAGRAPH[, BASEPATH])
Returns a Lintian::Processable from a PARAGRAPH in a Sources or a Packages file with the following exception.

If the PARAGRAPH has a field named ``pkg_path'', then that is used instead of creating the path from BASEPATH path concatenated with the TYPE specific field(s). Hench BASEPATH is optional if and only if, the paragraph has a field called ``pkg_path''.

The TYPE parameter determines the type of the processable and is required.

NB: Optional fields (e.g. ``Source'' for binaries) may be omitted in PARAGRAPH as usual. In this case, the respective values are computed from the required fields according to the Policy Manual.


Returns the package name.
Returns the version of the package.
Returns the path to the packaged version of actual package. This path is used in case the data needs to be extracted from the package.

Note: This may return the path to a symlink to the package.

Returns the type of package (e.g. binary, source, udeb ...)
Returns the architecture(s) of the package. May return multiple values from changes processables. For source processables it is ``source''.
Returns the name of the source package.
Returns the version of the source package.
Returns a truth value if one or more fields in this Processable is tainted. On a best effort basis tainted fields will be sanitized to less dangerous (but possibly invalid) values.
Produces an identifier for this processable. The identifier is based on the type, name, version and architecture of the package.
Returns the group $proc is in, if any. If the processable is not in a group, this returns "undef".

Can also be used to set the group of this processable.

Returns $info element for this processable.

Note: This method must be implemented by sub-classes unless they provide an ``info'' field.

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).

Note: By default this does nothing, but it may (and should) be overridden by sub-classes.

$proc->get_field ($field[, $def])
Optional method to access a field in the underlying data set.

Returns $def if the field is not present or the implementation does not have (or want to expose) it. This method is not guaranteed to return the same value as ``$proc->info->field ($field, $def)''.

If $def is omitted is defaults to "undef".

Default implementation accesses them via the hashref stored in ``extra-fields'' if present. If the field is present, but not defined $def is returned instead.

NB: This is mostly an optimization used by Lintian::Lab to avoid (re-)reading the underlying package data.


Originally written by Niels Thykier <[email protected]> for Lintian.