man-pages/man3/Dpkg::Changelog.3perl.html
2021-03-31 01:06:50 +01:00

373 lines
9.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Dpkg::Changelog</TITLE>
</HEAD><BODY>
<H1>Dpkg::Changelog</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">&nbsp;</A>
<H2>NAME</H2>
Dpkg::Changelog - base class to implement a changelog parser
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>
Dpkg::Changelog is a class representing a changelog file
as an array of changelog entries (Dpkg::Changelog::Entry).
By deriving this object and implementing its parse method, you
add the ability to fill this object with changelog entries.
<A NAME="lbAD">&nbsp;</A>
<H2>METHODS</H2>
<DL COMPACT>
<DT id="1">$c = Dpkg::Changelog-&gt;new(%options)<DD>
Creates a new changelog object.
<DT id="2">$c-&gt;set_options(%opts)<DD>
Change the value of some options. ``verbose'' (defaults to 1) defines
whether parse errors are displayed as warnings by default. ``reportfile''
is a string to use instead of the name of the file parsed, in particular
in error messages. ``range'' defines the range of entries that we want to
parse, the parser will stop as soon as it has parsed enough data to
satisfy <TT>$c</TT>-&gt;get_range($opts{range}).
<DT id="3">$c-&gt;<B>reset_parse_errors()</B><DD>
Can be used to delete all information about errors occurred during
previous parse runs.
<DT id="4">$c-&gt;parse_error($file, $line_nr, $error, [$line])<DD>
Record a new parse error in <TT>$file</TT> at line <TT>$line_nr</TT>. The error message is
specified with <TT>$error</TT> and a copy of the line can be recorded in <TT>$line</TT>.
<DT id="5">$c-&gt;<B>get_parse_errors()</B><DD>
Returns all error messages from the last parse run.
If called in scalar context returns a human readable
string representation. If called in list context returns
an array of arrays. Each of these arrays contains
<DL COMPACT><DT id="6"><DD>
<DL COMPACT>
<DT id="7">1.<DD>
a string describing the origin of the data (a filename usually). If the
reportfile configuration option was given, its value will be used instead.
<DT id="8">2.<DD>
the line number where the error occurred
<DT id="9">3.<DD>
an error description
<DT id="10">4.<DD>
the original line
</DL>
</DL>
<DL COMPACT><DT id="11"><DD>
</DL>
<DT id="12">$c-&gt;set_unparsed_tail($tail)<DD>
Add a string representing unparsed lines after the changelog entries.
Use undef as <TT>$tail</TT> to remove the unparsed lines currently set.
<DT id="13">$c-&gt;<B>get_unparsed_tail()</B><DD>
Return a string representing the unparsed lines after the changelog
entries. Returns undef if there's no such thing.
<DT id="14">@{$c}<DD>
Returns all the Dpkg::Changelog::Entry objects contained in this changelog
in the order in which they have been parsed.
<DT id="15">$c-&gt;get_range($range)<DD>
Returns an array (if called in list context) or a reference to an array of
Dpkg::Changelog::Entry objects which each represent one entry of the
changelog. <TT>$range</TT> is a hash reference describing the range of entries
to return. See section ``<FONT SIZE="-1">RANGE SELECTION''</FONT>.
<DT id="16">$c-&gt;<B>abort_early()</B><DD>
Returns true if enough data have been parsed to be able to return all
entries selected by the range set at creation (or with set_options).
<DT id="17">$str = $c-&gt;<B>output()</B><DD>
<DT id="18">&quot;$c&quot;<DD>
Returns a string representation of the changelog (it's a concatenation of
the string representation of the individual changelog entries).
<DT id="19">$c-&gt;output($fh)<DD>
Output the changelog to the given filehandle.
<DT id="20">$c-&gt;save($filename)<DD>
Save the changelog in the given file.
<DT id="21">$control = $c-&gt;format_range($format, $range)<DD>
Formats the changelog into Dpkg::Control::Changelog objects representing the
entries selected by the optional range specifier (see ``<FONT SIZE="-1">RANGE SELECTION''</FONT>
for details). In scalar context returns a Dpkg::Index object containing the
selected entries, in list context returns an array of Dpkg::Control::Changelog
objects.
<P>
With format <B>dpkg</B> the returned Dpkg::Control::Changelog object is coalesced
from the entries in the changelog that are part of the range requested,
with the fields described below, but considering that ``selected entry''
means the first entry of the selected range.
<P>
With format <B>rfc822</B> each returned Dpkg::Control::Changelog objects
represents one entry in the changelog that is part of the range requested,
with the fields described below, but considering that ``selected entry''
means for each entry.
<P>
The different formats return undef if no entries are matched. The following
fields are contained in the object(s) returned:
<DL COMPACT><DT id="22"><DD>
<DL COMPACT>
<DT id="23">Source<DD>
package name (selected entry)
<DT id="24">Version<DD>
packages' version (selected entry)
<DT id="25">Distribution<DD>
target distribution (selected entry)
<DT id="26">Urgency<DD>
urgency (highest of all entries in range)
<DT id="27">Maintainer<DD>
person that created the (selected) entry
<DT id="28">Date<DD>
date of the (selected) entry
<DT id="29">Timestamp<DD>
date of the (selected) entry as a timestamp in seconds since the epoch
<DT id="30">Closes<DD>
bugs closed by the (selected) entry/entries, sorted by bug number
<DT id="31">Changes<DD>
content of the (selected) entry/entries
</DL>
</DL>
<DL COMPACT><DT id="32"><DD>
</DL>
<DT id="33">$control = $c-&gt;dpkg($range)<DD>
This is a deprecated alias for <TT>$c</TT>-&gt;format_range('dpkg', <TT>$range</TT>).
<DT id="34">@controls = $c-&gt;rfc822($range)<DD>
This is a deprecated alias for <TT>&quot;scalar c-&quot;</TT>format_range('rfc822', <TT>$range</TT>)&gt;.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>RANGE SELECTION</H2>
A range selection is described by a hash reference where
the allowed keys and values are described below.
<P>
The following options take a version number as value.
<DL COMPACT>
<DT id="35">since<DD>
Causes changelog information from all versions strictly
later than <B>version</B> to be used.
<DT id="36">until<DD>
Causes changelog information from all versions strictly
earlier than <B>version</B> to be used.
<DT id="37">from<DD>
Similar to <TT>&quot;since&quot;</TT> but also includes the information for the
specified <B>version</B> itself.
<DT id="38">to<DD>
Similar to <TT>&quot;until&quot;</TT> but also includes the information for the
specified <B>version</B> itself.
</DL>
<P>
The following options don't take version numbers as values:
<DL COMPACT>
<DT id="39">all<DD>
If set to a true value, all entries of the changelog are returned,
this overrides all other options.
<DT id="40">count<DD>
Expects a signed integer as value. Returns <TT>&quot;value&quot;</TT> entries from the
top of the changelog if set to a positive integer, and <TT>&quot;abs(value)&quot;</TT>
entries from the tail if set to a negative integer.
<DT id="41">offset<DD>
Expects a signed integer as value. Changes the starting point for
<TT>&quot;count&quot;</TT>, either counted from the top (positive integer) or from
the tail (negative integer). <TT>&quot;offset&quot;</TT> has no effect if <TT>&quot;count&quot;</TT>
wasn't given as well.
</DL>
<P>
Some examples for the above options. Imagine an example changelog with
entries for the versions 1.2, 1.3, 2.0, 2.1, 2.2, 3.0 and 3.1.
<P>
<PRE>
Range Included entries
----- ----------------
since =&gt; '2.0' 3.1, 3.0, 2.2
until =&gt; '2.0' 1.3, 1.2
from =&gt; '2.0' 3.1, 3.0, 2.2, 2.1, 2.0
to =&gt; '2.0' 2.0, 1.3, 1.2
count =&gt; 2 3.1, 3.0
count =&gt; -2 1.3, 1.2
count =&gt; 3, offset =&gt; 2 2.2, 2.1, 2.0
count =&gt; 2, offset =&gt; -3 2.0, 1.3
count =&gt; -2, offset =&gt; 3 3.0, 2.2
count =&gt; -2, offset =&gt; -3 2.2, 2.1
</PRE>
<P>
Any combination of one option of <TT>&quot;since&quot;</TT> and <TT>&quot;from&quot;</TT> and one of
<TT>&quot;until&quot;</TT> and <TT>&quot;to&quot;</TT> returns the intersection of the two results
with only one of the options specified.
<A NAME="lbAF">&nbsp;</A>
<H2>CHANGES</H2>
<A NAME="lbAG">&nbsp;</A>
<H3>Version 1.01 (dpkg 1.18.8)</H3>
New method: <TT>$c</TT>-&gt;<B>format_range()</B>.
<P>
Deprecated methods: <TT>$c</TT>-&gt;<B>dpkg()</B>, <TT>$c</TT>-&gt;<B>rfc822()</B>.
<P>
New field Timestamp in output formats.
<A NAME="lbAH">&nbsp;</A>
<H3>Version 1.00 (dpkg 1.15.6)</H3>
Mark the module as public.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="42"><A HREF="#lbAB">NAME</A><DD>
<DT id="43"><A HREF="#lbAC">DESCRIPTION</A><DD>
<DT id="44"><A HREF="#lbAD">METHODS</A><DD>
<DT id="45"><A HREF="#lbAE">RANGE SELECTION</A><DD>
<DT id="46"><A HREF="#lbAF">CHANGES</A><DD>
<DL>
<DT id="47"><A HREF="#lbAG">Version 1.01 (dpkg 1.18.8)</A><DD>
<DT id="48"><A HREF="#lbAH">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:38 GMT, March 31, 2021
</BODY>
</HTML>