Dpkg::Changelog(3perl)
π NAME π
Dpkg::Changelog β bestie, it's the base class you use to implement a changelog parser. That's the whole vibe. π
This page is from libdpkg-perl, and the manual is Dpkg::Changelog(3perl) β iconic, we love a Perl module with main character energy. β¨
π¦ DESCRIPTION π¦
Okay so picture this: Dpkg::Changelog is a class that represents a changelog file as an array of changelog entries (Dpkg::Changelog::Entry). Literally a little changelog aquarium. π
The way you make it actually do stuff is by deriving this class and implementing its parse() method β that's how you add the ability to fill this object with changelog entries. No parser override, no entries. Simple as that, fr fr. π
πΈ METHODS πΈ
$chlog = Dpkg::Changelog->new(%opts)β creates a new changelog object. It accepts the same options as$chlog->set_options(). Fresh object, fresh vibes. π«Ά$chlog->set_options(%opts)β changes the value of some options. The options are:verboseβ defines whether parse errors are displayed as warnings by default. Defaults to1. So yes, by default it's gonna be a little chatty about errors. πreportfileβ a string to use instead of the name of the file parsed, in particular in error messages. Think of it as the name tag the parser wears when it's reporting stuff. π·οΈ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$chlog->get_range($opts{range}). Efficiency queen behavior. π
$count = $chlog->parse($fh, $description)β reads the filehandle and parses a changelog in it. Important: the data in the object is reset before parsing new data, so don't come crying if your old entries ghosted you. π
It returns the number of changelog entries that have been parsed with success.
Heads up bestie: this method needs to be implemented by one of the specialized changelog format subclasses. The base class is not doing this one for you. π
$count = $chlog->load($filename)β parses$filenamecontents for a changelog. Returns the number of changelog entries that have been parsed with success. Same success-count energy. β$chlog->reset_parse_errors()β can be used to delete all information about errors that occurred during previousparse()runs. Clean slate, new era, periodt. π§Ή$chlog->parse_error($file, $line_nr, $error, [$line])β records a new parse error in$fileat line$line_nr. The error message is specified with$error, and a copy of the line can be recorded in$line. Very "dear diary, today the changelog was messy" of it. π@errors = $chlog->get_parse_errors()$errors = $chlog->get_parse_errors()β returns all error messages from the lastparse()run. If called in scalar context it returns a human readable string representation. If called in list context it returns an array of arrays. Each of these arrays contains:- a string describing the origin of the data (a filename usually). If the
reportfileconfiguration option was given, its value will be used instead. - the line number where the error occurred
- an error description
- the original line
- a string describing the origin of the data (a filename usually). If the
$chlog->set_unparsed_tail($tail)β adds a string representing unparsed lines after the changelog entries. Useundefas$tailto remove the unparsed lines currently set. Bye-bye leftover lines. π$string = $chlog->get_unparsed_tail()β returns a string representing the unparsed lines after the changelog entries. Returnsundefif there's no such thing. If it's not there, it's not there, bestie. π«₯@entries = @{$chlog}β returns all theDpkg::Changelog::Entryobjects contained in this changelog, in the order in which they have been parsed. Order matters, we are not chaotic. Well. Not here, anyway. π@entries = $chlog->get_range($range)$entries = $chlog->get_range($range)β returns an array (if called in list context) or a reference to an array ofDpkg::Changelog::Entryobjects which each represent one entry of the changelog.$rangeis a hash reference describing the range of entries to return. See section "RANGE SELECTION". Slay, now go read that section. π$bool = $chlog->abort_early()β returns true if enough data have been parsed to be able to return all entries selected by the range set at creation (or withset_options). It's giving "we can stop early, we already ate." π₯$string = "$chlog"$string = $chlog->output()β returns a string representation of the changelog. It's a concatenation of the string representation of the individual changelog entries. Stringified changelog, cute. π$string = $chlog->output($fh)β outputs the changelog to the given filehandle.$chlog->save($filename)β saves the changelog in the given file. Go little changelog, go be a file. πΎ$ctrl_index = $chlog->format_range($format, $range)@ctrl_list = $chlog->format_range($format, $range)β formats the changelog intoDpkg::Control::Changelogobjects representing the entries selected by the optional range specifier (see "RANGE SELECTION" for details). In scalar context returns aDpkg::Indexobject containing the selected entries; in list context returns an array ofDpkg::Control::Changelogobjects.
With format dpkg 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.
With format rfc822 each returned Dpkg::Control::Changelog object 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.
The different formats return undef if no entries are matched. The following fields are contained in the object(s) returned:
Sourceβ package name (selected entry)Versionβ packages' version (selected entry)Distributionβ target distribution (selected entry)Urgencyβ urgency (highest of all entries in range)Maintainerβ person that created the (selected) entryDateβ date of the (selected) entryTimestampβ date of the (selected) entry as a timestamp in seconds since the epochClosesβ bugs closed by the (selected) entry/entries, sorted by bug numberChangesβ content of the (selected) entry/entries
β¨ RANGE SELECTION β¨
A range selection is described by a hash reference where the allowed keys and values are described below. Okay so this is where you pick which entries you want. Choose wisely, or don't, it's a changelog, not a marriage. π
The following options take a version number as value:
sinceβ causes changelog information from all versions strictly later than version to be used.untilβ causes changelog information from all versions strictly earlier than version to be used.fromβ similar to"since"but also includes the information for the specified version itself.toβ similar to"until"but also includes the information for the specified version itself.
The following options don't take version numbers as values:
allβ if set to a true value, all entries of the changelog are returned; this overrides all other options. It's the "give me everything" option and honestly same. πcountβ expects a signed integer as value. Returns"value"entries from the top of the changelog if set to a positive integer, andabs(value)entries from the tail if set to a negative integer.offsetβ expects a signed integer as value. Changes the starting point for"count", either counted from the top (positive integer) or from the tail (negative integer)."offset"has no effect if"count"wasn't given as well. No count, no offset, that's the rule. π«‘
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. Bestie, visualize the little version lineup. πΈ
Range Included entries
----- ----------------
since => '2.0' 3.1, 3.0, 2.2
until => '2.0' 1.3, 1.2
from => '2.0' 3.1, 3.0, 2.2, 2.1, 2.0
to => '2.0' 2.0, 1.3, 1.2
count => 2 3.1, 3.0
count => -2 1.3, 1.2
count => 3, offset => 2 2.2, 2.1, 2.0
count => 2, offset => -3 2.0, 1.3
count => -2, offset => 3 3.0, 2.2
count => -2, offset => -3 2.2, 2.1
Any combination of one option of "since" and "from" and one of "until" and "to" returns the intersection of the two results with only one of the options specified. Intersection, not union, bestie β do not mix that up. π
π¦ CHANGES π¦
π Version 2.00 (dpkg 1.20.0)
- Remove methods:
$chlog->dpkg(),$chlog->rfc822(). Gone. Ghosted. π«₯
π Version 1.01 (dpkg 1.18.8)
- New method:
$chlog->format_range(). - Deprecated methods:
$chlog->dpkg(),$chlog->rfc822(). - New field
Timestampin output formats. Time is literally a field now. β°
π Version 1.00 (dpkg 1.15.6)
- Mark the module as public. It's officially out there, living its best life. π
Okay that's the whole page, bestie. This was Dpkg::Changelog(3perl) from libdpkg-perl, version 1.23.11-dirty, dated 2026-09-09 β mwah, go parse something cute. πππ¦πΈβ¨
π¦ where this page comes from
- arch rolling: dpkg 1.23.11-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms