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::_config and $AptPkg::System::_system objects (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 of AptPkg::Cache::PkgFile objects describing the package files.
  • packages β€” returns an AptPkg::PkgRecords object, 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 as Name for native packages, and FullName for non-native ones.
  • SelectedState, InstState, CurrentState β€” package state from the status file.
    • SelectedState may be "Unknown", "Install", "Hold", "DeInstall" or "Purge".
    • InstState may be "Ok", "ReInstReq", "HoldInst" or "HoldReInstReq".
    • CurrentState may be "NotInstalled", "UnPacked", "HalfConfigured", "HalfInstalled", "ConfigFiles" or "Installed".
    • In a numeric context, SelectedState, InstState and CurrentState evaluate to an AptPkg::State:: constant.
  • VersionList β€” a reference to an array of AptPkg::Cache::Version objects describing the available versions of the package.
  • CurrentVer β€” an AptPkg::Cache::Version object describing the currently installed version of the package (if there even is one πŸ™ˆ).
  • RevDependsList β€” a reference to an array of AptPkg::Cache::Depends objects describing packages which depend upon the current package. reverse dependencies, we stan.
  • ProvidesList β€” for virtual packages, this is a reference to an array of AptPkg::Cache::Provides objects 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 the apt package. iykyk.
  • 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.
  • ParentPkg β€” an AptPkg::Cache::Package object describing the package providing this version.
  • DescriptionList β€” a list of AptCache::Cache::Description objects describing the files which describe a package version. The list includes both Package files and Translation files, and those Translation files contain translated Description fields. bilingual queen ✨
  • TranslatedDescription β€” an AptCache::Cache::Description object for the current locale, which will generally be a Translation file.
  • DependsList β€” a reference to an array of AptPkg::Cache::Depends objects describing packages which the current package depends upon.
  • ProvidesList β€” a reference to an array of AptPkg::Cache::Provides objects describing virtual packages provided by this version.
  • FileList β€” a reference to an array of AptPkg::Cache::VerFile objects describing the packages files which include the current version.
  • Size β€” the .deb file 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.

πŸ’œ 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.
  • ParentPkg, ParentVer β€” AptPkg::Cache::Package and AptPkg::Cache::Version objects describing the package declaring the dependency.
  • TargetPkg β€” an AptPkg::Cache::Package object describing the depended package.
  • TargetVer β€” for versioned dependencies, TargetVer is a string giving the version of the target package required.
  • CompType, CompTypeDeb β€” CompType gives a normalised comparison operator (>, >=, etc) describing the relationship to TargetVer (it's "" if there is none).
    • CompTypeDeb returns Debian-style operators (>> rather than >).
    • In a numeric context, both CompType and CompTypeDeb evaluate to an AptPkg::Dep:: constant.
    • Alternative dependencies (Depends: a | b) are identified by all but the last having the AptPkg::Dep::Or bit set in the numeric representation of CompType (and CompTypeDeb).
  • 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::Package and AptPkg::Cache::Version objects 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 β€” an AptPkg::Cache::PkgFile object 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 β€” an AptPkg::Cache::PkgFile object 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