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'); }
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 @{BIN,SRC,CHG}_QUERY lists below. The fields may (and generally do) differ between package types.
The known types are:
* binary
* changes
* source
* udeb
* GROUP
If TYPE is GROUP, then GROUPING should be omitted.
On success, this will clear the ``dirty'' flag and on error it will croak.
On success, this will clear the ``dirty'' flag and on error it will croak.
On error, the contents of FILE are undefined.
The VISITOR is called as:
VISITOR->(ENTRY, KEYS)
where ENTRY is the entry and KEYS are 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')
Otherwise, the keys are (in general and in order):
Note: The interesting fields from ENTRY are copied, so later changes to ENTRY will not affect the data in the manifest.
By default all entries are persistent.
# 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 KEYS is 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.
This instance is considered the ``original'' and MANIFEST is ``new'' version of the manifest. (See the olist and nlist methods of Lintian::Lab::ManifestDiff for more information.