247 lines
6.3 KiB
HTML
247 lines
6.3 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Dpkg::Index</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Dpkg::Index</H1>
|
|
Section: libdpkg-perl (3perl)<BR>Updated: 2020-03-23<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Dpkg::Index - generic index of control information
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
This object represent a set of Dpkg::Control objects.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>METHODS</H2>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">$index = Dpkg::Index->new(%opts)<DD>
|
|
|
|
|
|
|
|
|
|
Creates a new empty index. See <B>set_options()</B> for more details.
|
|
<DT id="2">$index->set_options(%opts)<DD>
|
|
|
|
|
|
|
|
|
|
The ``type'' option is checked first to define default values for other
|
|
options. Here are the relevant options: ``get_key_func'' is a function
|
|
returning a key for the item passed in parameters, ``unique_tuple_key'' is
|
|
a boolean requesting whether the default key should be the unique tuple
|
|
(default to false for backwards compatibility, but it will change to true
|
|
in dpkg 1.20.x). The index can only contain one item with a given key.
|
|
The ``get_key_func'' function used depends on the type:
|
|
<DL COMPACT><DT id="3"><DD>
|
|
<DL COMPACT>
|
|
<DT id="4">•<DD>
|
|
for <FONT SIZE="-1">CTRL_INFO_SRC,</FONT> it is the Source field;
|
|
<DT id="5">•<DD>
|
|
for <FONT SIZE="-1">CTRL_INDEX_SRC</FONT> and <FONT SIZE="-1">CTRL_PKG_SRC</FONT> it is the Package field by default,
|
|
or the Package and Version fields (concatenated with ``_'') when
|
|
``unique_tuple_key'' is true;
|
|
<DT id="6">•<DD>
|
|
for <FONT SIZE="-1">CTRL_INFO_PKG</FONT> it is simply the Package field;
|
|
<DT id="7">•<DD>
|
|
for <FONT SIZE="-1">CTRL_INDEX_PKG</FONT> and <FONT SIZE="-1">CTRL_PKG_DEB</FONT> it is the Package field by default,
|
|
or the Package, Version and Architecture fields (concatenated with ``_'')
|
|
when ``unique_tuple_key'' is true;
|
|
<DT id="8">•<DD>
|
|
for <FONT SIZE="-1">CTRL_CHANGELOG</FONT> it is the Source and the Version fields (concatenated
|
|
with an intermediary ``_'');
|
|
<DT id="9">•<DD>
|
|
for <FONT SIZE="-1">CTRL_TESTS</FONT> is either the Tests or Test-Command fields;
|
|
<DT id="10">•<DD>
|
|
for <FONT SIZE="-1">CTRL_FILE_CHANGES</FONT> it is the Source, Version and Architecture fields
|
|
(concatenated with ``_'');
|
|
<DT id="11">•<DD>
|
|
for <FONT SIZE="-1">CTRL_FILE_VENDOR</FONT> it is the Vendor field;
|
|
<DT id="12">•<DD>
|
|
for <FONT SIZE="-1">CTRL_FILE_STATUS</FONT> it is the Package and Architecture fields (concatenated
|
|
with ``_'');
|
|
<DT id="13">•<DD>
|
|
otherwise it is the Package field by default.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DL COMPACT><DT id="14"><DD>
|
|
</DL>
|
|
|
|
<DT id="15">$index-><B>get_type()</B><DD>
|
|
|
|
|
|
|
|
|
|
Returns the type of control information stored. See the type parameter
|
|
set during <B>new()</B>.
|
|
<DT id="16">$index->add($item, [$key])<DD>
|
|
|
|
|
|
|
|
|
|
Add a new item in the index. If the <TT>$key</TT> parameter is omitted, the key
|
|
will be generated with the get_key_func function (see <B>set_options()</B> for
|
|
details).
|
|
<DT id="17">$index->parse($fh, $desc)<DD>
|
|
|
|
|
|
|
|
|
|
Reads the filehandle and creates all items parsed. When called multiple
|
|
times, the parsed stanzas are accumulated.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Returns the number of items parsed.
|
|
<DT id="18">$index->load($file)<DD>
|
|
|
|
|
|
|
|
|
|
Reads the file and creates all items parsed. Returns the number of items
|
|
parsed. Handles compressed files transparently based on their extensions.
|
|
<DT id="19">$item = $index-><B>new_item()</B><DD>
|
|
|
|
|
|
|
|
|
|
Creates a new item. Mainly useful for derived objects that would want
|
|
to override this method to return something else than a Dpkg::Control
|
|
object.
|
|
<DT id="20">$item = $index->get_by_key($key)<DD>
|
|
|
|
|
|
|
|
|
|
Returns the item identified by <TT>$key</TT> or undef.
|
|
<DT id="21">@keys = $index->get_keys(%criteria)<DD>
|
|
|
|
|
|
|
|
|
|
Returns the keys of items that matches all the criteria. The key of the
|
|
<TT>%criteria</TT> hash is a field name and the value is either a regex that needs
|
|
to match the field value, or a reference to a function that must return
|
|
true and that receives the field value as single parameter, or a scalar
|
|
that must be equal to the field value.
|
|
<DT id="22">@items = $index->get(%criteria)<DD>
|
|
|
|
|
|
|
|
|
|
Returns all the items that matches all the criteria.
|
|
<DT id="23">$index->remove_by_key($key)<DD>
|
|
|
|
|
|
|
|
|
|
Remove the item identified by the given key.
|
|
<DT id="24">@items = $index->remove(%criteria)<DD>
|
|
|
|
|
|
|
|
|
|
Returns and removes all the items that matches all the criteria.
|
|
<DT id="25">$index->merge($other_index, %opts)<DD>
|
|
|
|
|
|
|
|
|
|
Merge the entries of the other index. While merging, the keys of the merged
|
|
index are used, they are not re-computed (unless you have set the options
|
|
``keep_keys'' to ``0''). It's your responsibility to ensure that they have been
|
|
computed with the same function.
|
|
<DT id="26">$index->sort(\&sortfunc)<DD>
|
|
|
|
|
|
|
|
|
|
Sort the index with the given sort function. If no function is given, an
|
|
alphabetic sort is done based on the keys. The sort function receives the
|
|
items themselves as parameters and not the keys.
|
|
<DT id="27">$str = $index->output([$fh])<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="28">"$index"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
Get a string representation of the index. The Dpkg::Control objects are
|
|
output in the order which they have been read or added except if the order
|
|
have been changed with <B>sort()</B>.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Print the string representation of the index to a filehandle if <TT>$fh</TT> has
|
|
been passed.
|
|
<DT id="29">$index->save($file)<DD>
|
|
|
|
|
|
|
|
|
|
Writes the content of the index in a file. Auto-compresses files
|
|
based on their extensions.
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>CHANGES</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Version 1.01 (dpkg 1.19.0)</H3>
|
|
|
|
|
|
|
|
New option: Add new ``unique_tuple_key'' option to <TT>$index</TT>-><B>set_options()</B> to set
|
|
better default ``get_key_func'' options, which will become the default behavior
|
|
in 1.20.x.
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Version 1.00 (dpkg 1.15.6)</H3>
|
|
|
|
|
|
|
|
Mark the module as public.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="30"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="31"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DT id="32"><A HREF="#lbAD">METHODS</A><DD>
|
|
<DT id="33"><A HREF="#lbAE">CHANGES</A><DD>
|
|
<DL>
|
|
<DT id="34"><A HREF="#lbAF">Version 1.01 (dpkg 1.19.0)</A><DD>
|
|
<DT id="35"><A HREF="#lbAG">Version 1.00 (dpkg 1.15.6)</A><DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:39 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|