AptPkg::Cache(3pm)
π NAME π
AptPkg::Cache β the APT package cache interface. bestie it's literally the whole point of this page.
β¨ SYNOPSIS β¨
use AptPkg::Cache;
π¦ DESCRIPTION π¦
The AptPkg::Cache module hands you a whole interface to APT's package cache. no cap, that's the serve.
πΈ AptPkg::Cache πΈ
The AptPkg::Cache package implements the APT pkgCacheFile class as a hash reference (it inherits from AptPkg::hash). The hash keys are the names of packages in the cache, and the values are AptPkg::Cache::Package objects β which themselves show up as hash references, see below, it's turtles all the way down π
π Constructor
new([LOCK])β builds you an object using configuration from the$AptPkg::Config::_configand$AptPkg::System::_systemobjects (they get automatically initialised if nobody did it explicitly, don't worry).
Heads up: cache initialisation can be quite verbose, and that's controlled by the value of $_config->{quiet} β which gets set to "2" (quiet, periodt) if the $_config object is auto-initialised.
The cache directory is locked if LOCK is true.
now listen, this one matters: the structure of the returned object contains self-referential elements. so if you're out here trying to traverse it recursively, be careful, fr fr. some care must be taken.
π§ Methods
filesβ returns a list ofAptPkg::Cache::PkgFileobjects describing the package files.packagesβ returns anAptPkg::PkgRecordsobject, which you can use to pull additional info about packages.get,exists,keysβ these implement the hashref abstraction:$obj->get($pack)and$obj->{$pack}are literally the same thing.is_multi_archβ the cache is multi-arch enabled. slay.native_archβ the native architecture.
π AptPkg::Cache::Package π
Implements the APT pkgCache::PkgIterator class as a hash reference.
Keys
Name,Section,Archβ package name, section and architecture.FullNameβ the fully qualified name, architecture included.ShortNameβ the shortest unambiguous package name: it's the same asNamefor native packages, andFullNamefor non-native ones.SelectedState,InstState,CurrentStateβ package state from the status file.SelectedStatemay be"Unknown","Install","Hold","DeInstall"or"Purge".InstStatemay be"Ok","ReInstReq","HoldInst"or"HoldReInstReq".CurrentStatemay be"NotInstalled","UnPacked","HalfConfigured","HalfInstalled","ConfigFiles"or"Installed".- In a numeric context,
SelectedState,InstStateandCurrentStateevaluate to anAptPkg::State::constant.
VersionListβ a reference to an array ofAptPkg::Cache::Versionobjects describing the available versions of the package.CurrentVerβ anAptPkg::Cache::Versionobject describing the currently installed version of the package (if there even is one π).RevDependsListβ a reference to an array ofAptPkg::Cache::Dependsobjects describing packages which depend upon the current package. reverse dependencies, we stan.ProvidesListβ for virtual packages, this is a reference to an array ofAptPkg::Cache::Providesobjects describing packages which provide the current package.Flagsβ a comma separated list of flags:"Auto","Essential"or"Important".- In a numeric context, it evaluates to a combination of
AptPkg::Flag::constants. - > Note: the only one of these you need to worry about is
"Essential", which gets set based on the package's header of the same name."Auto"seems to be used internally by APT, and"Important"seems to only be set on theaptpackage. iykyk.
- In a numeric context, it evaluates to a combination of
Indexβ internal APT unique reference for the package record.
β AptPkg::Cache::Version β
Implements the APT pkgCache::VerIterator class as a hash reference.
Keys
VerStr,Section,Archβ the package version, section and architecture.MultiArchβ multi-arch state:"No","All","Foreign","Same","Allowed","AllForeign"or"AllAllowed".- In a numeric context, it evaluates to an
AptPkg::Version::constant.
- In a numeric context, it evaluates to an
ParentPkgβ anAptPkg::Cache::Packageobject describing the package providing this version.DescriptionListβ a list ofAptCache::Cache::Descriptionobjects describing the files which describe a package version. The list includes both Package files and Translation files, and those Translation files contain translatedDescriptionfields. bilingual queen β¨TranslatedDescriptionβ anAptCache::Cache::Descriptionobject for the current locale, which will generally be a Translation file.DependsListβ a reference to an array ofAptPkg::Cache::Dependsobjects describing packages which the current package depends upon.ProvidesListβ a reference to an array ofAptPkg::Cache::Providesobjects describing virtual packages provided by this version.FileListβ a reference to an array ofAptPkg::Cache::VerFileobjects describing the packages files which include the current version.Sizeβ the.debfile size, in bytes.InstalledSizeβ the disk space used when installed, in bytes.Indexβ internal APT unique reference for the version record.Priorityβ package priority:"important","required","standard","optional"or"extra".- In a numeric context, it evaluates to an
AptPkg::VerPriority::constant.
- In a numeric context, it evaluates to an
π AptPkg::Cache::Depends π
Implements the APT pkgCache::DepIterator class as a hash reference.
Keys
DepTypeβ type of dependency:"Depends","PreDepends","Suggests","Recommends","Conflicts","Replaces"or"Obsoletes".- In a numeric context, it evaluates to an
AptPkg::Dep::constant.
- In a numeric context, it evaluates to an
ParentPkg,ParentVerβAptPkg::Cache::PackageandAptPkg::Cache::Versionobjects describing the package declaring the dependency.TargetPkgβ anAptPkg::Cache::Packageobject describing the depended package.TargetVerβ for versioned dependencies,TargetVeris a string giving the version of the target package required.CompType,CompTypeDebβCompTypegives a normalised comparison operator (>,>=, etc) describing the relationship toTargetVer(it's""if there is none).CompTypeDebreturns Debian-style operators (>>rather than>).- In a numeric context, both
CompTypeandCompTypeDebevaluate to anAptPkg::Dep::constant. - Alternative dependencies (
Depends: a | b) are identified by all but the last having theAptPkg::Dep::Orbit set in the numeric representation ofCompType(andCompTypeDeb).
Indexβ internal APT unique reference for the dependency record.
π¦ AptPkg::Cache::Provides π¦
Implements the APT pkgCache::PrvIterator class as a hash reference.
Keys
Nameβ name of virtual package.OwnerPkg,OwnerVerβAptPkg::Cache::PackageandAptPkg::Cache::Versionobjects describing the providing package.ProvideVersionβ version of the virtual package. [Not currently supported by dpkg, bestie, so don't come for me]Indexβ internal APT unique reference for the provides record.
π AptPkg::Cache::VerFile π
Implements the APT pkgCache::VerFileIterator class as a hash reference.
Keys
Fileβ anAptPkg::Cache::PkgFileobject describing the packages file.Offsetβ the byte offset of the entry in the file.Indexβ internal APT unique reference for the version file record.
π AptPkg::Cache::PkgFile π
Implements the APT pkgCache::PkgFileIterator class as a hash reference.
Keys
FileNameβ packages file path.IndexTypeβ file type:"Debian Package Index","Debian dpkg status file".Archive,Component,Version,Origin,Label,Siteβ fields from the Release file.Indexβ internal APT unique reference for the package file record.
π«Ά AptPkg::Cache::DescFile π«Ά
Implements the APT pkgCache::DescFileIterator class as a hash reference.
Keys
Fileβ anAptPkg::Cache::PkgFileobject describing the packages file.
π₯ SEE ALSO π₯
AptPkg::Config(3pm), AptPkg::System(3pm), AptPkg(3pm), AptPkg::hash(3pm), AptPkg::PkgRecords(3pm), AptPkg::Policy(3pm).
π AUTHOR π
Brendan O'Dea <bod@debian.org> β legend behaviour, honestly.
and that's the whole serve, bestie π
generated by perl v5.42.3 on 2026-08-19, filed under AptPkg::Cache(3pm). go read your cache β¨
π¦ where this page comes from
- ubuntu stonking: libapt-pkg-perl 0.1.43build1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms