Lintian::Lab::Manifest (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
Lintian::Lab::Manifest -- Lintian Lab manifestSYNOPSIS
use Lintian::Lab::Manifest; my $plist = Lintian::Lab::Manifest->new ('binary'); # Read the file $plist->read_list('info/binary-packages'); # fetch the entry for lintian (if any) my $entry = $plist->get('lintian', '2.5.2', 'all'); if ( $entry && exits $entry->{'version'} ) { print "Lintian has version $entry->{'version'}\n"; } # delete all lintian entries $plist->delete('lintian'); # Write to file if changed if ($plist->dirty) { $plist->write_list('info/binary-packages'); }
DESCRIPTION
Instances of this class provide access to the packages list used by the lab as caches.The data structure is basically a tree (using hashes). For binaries is looks (something) like:
$self->{'state'}{$name}{$version}{$architecture}
The (order of the) fields used in the tree are listed in the @{
CLASS METHODS
- new (TYPE[, GROUPING])
-
Creates a new packages list for a certain type of packages. This type
defines the format of the files.
The known types are:
* binary
* changes
* source
* udeb
*GROUPIf
TYPEisGROUP,thenGROUPINGshould be omitted.
INSTANCE METHODS
- dirty
- Returns a truth value if the manifest has changed since it was last written.
- type
- Returns the type of packages that this manifest has information about. (one of binary, udeb, source or changes)
- read_list (FILE)
-
Reads a manifest from FILE.Any records already in the manifest will be discarded before reading the contents.
On success, this will clear the ``dirty'' flag and on error it will croak.
- write_list (FILE)
-
Writes the manifest to FILE.
On success, this will clear the ``dirty'' flag and on error it will croak.
On error, the contents of
FILEare undefined. - visit_all (VISITOR[, KEY1, ..., KEYN])
-
Visits entries and passes them to VISITOR.If any keys are passed they are used to reduce the search. See get for a list of (common) keys.
The
VISITORis called as:VISITOR->(ENTRY, KEYS)
where
ENTRYis the entry andKEYSare the keys to be used to look up this entry via get method. So for the lintian 2.5.2 binary the keys would be something like:
('lintian', '2.5.2', 'all') - get (KEYS...)
-
Fetches the entry for KEYS(if any). Returns "undef" if the entry is not known. IfKEYSis exactly one item, it is assumed to be a Lintian::Processable and the correct keys are extracted from it.
Otherwise, the keys are (in general and in order):
-
- package/source
- version
- architecture
- except for source packages
-
- set (ENTRY)
-
Inserts ENTRYinto the manifest. This may replace an existing entry.
Note: The interesting fields from
ENTRYare copied, so later changes toENTRYwill not affect the data in the manifest. - set_transient_marker (TRANSIENT, KEYS...)
-
Set or clear transient flag. Transient entries are not written to the
disk (i.e. They will not appear in the file created/written by
``write_list (FILE)'').KEYSis passed as is passed to ``get (KEYS...)''.
By default all entries are persistent.
- delete (KEYS...)
-
Removes the entry/entries found by KEYS(if any).KEYSmust contain at least one item - if the list of keys cannot uniquely identify a single element, all ``matching'' elements will be removed. Examples:
# Delete the gcc-4.6 entry at version 4.6.1-4 that is also architecture i386 $manifest->delete ('gcc-4.6', '4.6.1-4', 'i386'); # Delete all gcc-4.6 entries at version 4.6.1-4 regardless of their # architecture $manifest->delete ('gcc-4.6', '4.6.1-4'); # Delete all gcc-4.6 entries regardless of version and architecture $manifest->delete ('gcc-4.6')
If
KEYSis exactly one item, it is assumed to be a Lintian::Processable. If so, the proper keys will be extracted from that processable and (if present) that one element will be removed.This will mark the list as dirty if an element was removed. If it returns a truth value, an element was removed - otherwise it will return 0.
See ``get (
KEYS...)'' for the key names. - diff (MANIFEST)
-
Returns a diff between this manifest and
MANIFEST.
This instance is considered the ``original'' and
MANIFESTis ``new'' version of the manifest. (See the olist and nlist methods of Lintian::Lab::ManifestDiff for more information.