Debbug...ackages(3pm)

πŸ’– Debbugs::Packages(3pm) πŸ’– (User Contributed Perl Documentation)

okay so bestie, welcome to Debbugs::Packages, the module that knows which binary package came from which source package and vice versa. debbugs binary/source package handling, no cap. let's get into it πŸ¦‹


🌸 NAME 🌸

Debbugs::Packages β€” debbugs binary/source package handling, fr fr


✨ DESCRIPTION ✨

okay so the Debbugs::Packages module hands you support functions that map binary packages to their corresponding source packages and the other way around too, because we're nothing if not bi-directional πŸ’…

and like, quick context: this makes total sense for software distributions, where devs may work on a single source package which produces several binary packages for users to actually install. it just might not make sense in other contexts. iykyk 🌈


πŸŽ€ METHODS πŸŽ€

getpkgsrc

returns a reference to a hash of binary package names ➑️ their corresponding source package names. one-stop shop, obsessed. ✨

getpkgcomponent

returns a reference to a hash of binary package names ➑️ the component of the archive containing those binary packages (like "main", "contrib", "non-free"). know your neighborhood bestie 🏘️

getsrcpkgs

returns a list of the binary packages produced by a given source package. one source, many babies 🫢

binary_to_source

binary_to_source(package => 'foo',
                 version => '1.2.3',
                 arch    => 'i386');

turns a binary package (at optional version, in optional architecture) into a single source package (or a set of them), optionally with associated versions attached. glow-up pipeline πŸ’«

by default, in LIST context, it returns a LIST of array refs of source package / source version pairs corresponding to the binary package(s), arch(s), and version(s) you passed in.

in SCALAR context, only the corresponding source packages come back, concatenated with ', ' if there's more than one. cute little join, slay.

if no source can be found, it returns undef in scalar context, or the empty list in list context. so like, handle that, bestie 😭

  • binary β€” binary package name(s), as a SCALAR or an ARRAYREF
  • version β€” binary package version(s), as a SCALAR or an ARRAYREF; optional, defaults to all versions
  • arch β€” binary package architecture(s), as a SCALAR or an ARRAYREF; optional, defaults to all architectures
  • source_only β€” return only the source name (forced on if you're in SCALAR context), defaults to false
  • scalar_only β€” return a scalar only (forced true if in SCALAR context, and it also causes source_only to be true), defaults to false
  • cache β€” optional HASHREF to be used to cache results of binary_to_source. caching? we love her πŸ“

sourcetobinary

returns a list of references to triplets of binary package names, versions, and architectures corresponding to a given source package name and version.

and here's the plot twist 😳: if the given source package name and version cannot be found in the database, but the source package name is in the unversioned package-to-source map file, then you get back a reference to a binary package name and version pair β€” without the architecture. no arch for you, sorry bestie πŸ™ˆ

getversions

returns versions of the package in a distribution at a specific architecture. short and sweet, we stan a minimal queen πŸ‘‘

get_versions

get_versions(package=>'foopkg',
             dist => 'unstable',
             arch => 'i386',
            );

returns a list of the versions of package in the distributions and architectures listed. and heads up: this routine only returns unique values β€” no duplicates, no repeats, periodt πŸ’…

  • package β€” package to return the list of versions for
  • dist β€” distribution (unstable, stable, testing); can be an arrayref
  • arch β€” architecture (i386, source, ...); can be an arrayref
  • time β€” returns a version=>time hash of the time at which the newest package matching this version was uploaded
  • source β€” returns source/version instead of just versions
  • no_source_arch β€” discards the source architecture when arch is not passed. (used for finding the versions of binary packages only.) defaults to 0, which does not discard the source architecture. ⚠️ and this may change in the future, so if you care, please code accordingly, bestie β€” don't come for me later.
  • return_archs β€” returns a version=>[archs] hash indicating which architectures are at which versions
  • largest_source_version_only β€” if there is more than one source version in a particular distribution, discards all versions but the largest in that distribution. defaults to 1, as this used to be the way that the Debian archive worked. nostalgia core πŸ₯²

when called in scalar context, this function will return hashrefs or arrayrefs as appropriate; in list context, it will return paired lists or unpaired lists as appropriate. pick your fighter πŸ₯Š

makesourceversions

@{$cgi_var{found}} = makesourceversions($cgi_var{package},undef,@{$cgi_var{found}});

canonicalizes versions into source versions, which have an explicitly named source package. this is the move for coping with source packages whose names have changed during their history, and with cases where source version numbers differ from binary version numbers. glow-up with a paper trail πŸ’–

make_source_versions

make_source_versions(package => 'foo',
                     arch    => 'source',
                     versions => '0.1.1',
                     guess_source => 1,
                     warnings => \$warnings,
                    );

an extended version of makesourceversions (which calls this function internally, btw) that allows for multiple packages, multiple architectures, and it outputs warnings and debugging information to the SCALARREFs or HANDLEs you provide. she's flexible πŸ’…

the guess_source option determines whether the source package is guessed at if there is no obviously correct package. things that use this function for non-transient output should set this to false; things that use it for transient output can set this to true.

⚠️ currently it defaults to true, but that is not a sane option. i said what i said, bestie πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

nothing extra listed here bestie, this page is a self-contained queen πŸ‘‘


and that's the whole page!! you're now officially fluent in binary ↔ source package mapping ✨

sign-off cuteness: this lil doc came from perl v5.40.1, dated 2026-04-27, and yes the title bar says Debbugs::Packages(3pm) on both ends because she's consistent like that πŸ’– go forth and map those packages, bestie πŸ«ΆπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from