---
name: "AptPkg"
section: "3pm"
platform: "linux"
package: "libapt-pkg-perl"
version: "0.1.42"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/AptPkg"
---

# AptPkg(3pm)

interface to libapt-pkg

## NAME

AptPkg - interface to libapt-pkg

## SYNOPSIS

use AptPkg;

## DESCRIPTION

The AptPkg module provides a low-level XS interface to libapt-pkg.

Note that this interface is intended to be internal, and may change, see the AptPkg::Config, AptPkg::System, AptPkg::Version, AptPkg::Cache, Apt::Policy and AptPkg::Source classes for a higher level interface.

### AptPkg

The AptPkg package provides the following functions:

- \_init\_config(*CONF*)

  Initialise a Configuration object (pkgInitConfig).  See the init method in AptPkg::Config.

- \_init\_system(*CONF*)

  Return a pointer to the system object (pkgInitSystem).  See the system method in AptPkg::Config.

- \_parse\_cmdline(*CONF*, *ARG\_DEFS*, ...)

  Constructs a CommandLine instance, invokes the Parse method and returns the remaining arguments.  See the parse\_cmdline method in AptPkg::Config.

### AptPkg::\_config

The AptPkg::\_config package wraps a Perl class around the Configuration class.  It provides an instance of the global \_config object, and exposes the following methods:

```
    Find, FindFile, FindDir, FindB, FindAny, Set, Exists,
    ExistsAny, Tree and Dump.
```

The functions ReadConfigFile and ReadConfigDir are also provided within the package and may be used as methods.

### AptPkg::\_config::item

The AptPkg::\_config::item package wraps a Perl class around the Configuration::Item class.  The AptPkg::\_config Tree method returns an instance of this class.

Methods:

```
    Value, Tag, FullTag, Parent, Child and Next.
```

### AptPkg::System

The AptPkg::System package wraps a Perl class around the pkgSystem class.  It provides an instance of the global \_system object, and exposes the following methods:

```
    Label, VS, Lock and UnLock.
```

### AptPkg::Version

The AptPkg::Version package wraps a Perl class around the pkgVersioningSystem class.  It exposes the following methods:

```
    Label, CmpVersion, CmpReleaseVer, CheckDep and UpstreamVersion.
```

### AptPkg::\_cache

The AptPkg::\_cache package wraps a Perl class around the pkgCacheFile class.  It exposes the following methods:

```
    Open, Close, FindPkg, PkgBegin, FileList, Packages, Policy, MultiArchCache
    and NativeArch.
```

### AptPkg::Cache::\_package

The AptPkg::Cache::\_package package wraps a Perl class around the pkgCache::PkgIterator class.  It exposes the following methods:

```
    Next, Name, FullName, Arch, Section, VersionList, CurrentVer,
    RevDependsList, ProvidesList, Index, SelectedState, InstState,
    CurrentState and Flags.
```

### AptPkg::Cache::\_version

The AptPkg::Cache::\_version package wraps a Perl class around the pkgCache::VerIterator class.  It exposes the following methods:

```
    VerStr, Section, MultiArch, Arch, ParentPkg, DescriptionList,
    TranslatedDescription, DependsList, ProvidesList, FileList, Index
    and Priority.
```

### AptPkg::Cache::\_depends

The AptPkg::Cache::\_depends package wraps a Perl class around the pkgCache::DepIterator class.  It exposes the following methods:

```
    TargetVer, TargetPkg, ParentVer, ParentPkg, Index, CompType and
    DepType.
```

### AptPkg::Cache::\_provides

The AptPkg::Cache::\_provides package wraps a Perl class around the pkgCache::PrvIterator class.  It exposes the following methods:

```
    Name, ProvideVersion, OwnerVer, OwnerPkg and Index.
```

### AptPkg::Cache::\_description

The AptPkg::Cache::\_description package wraps a Perl class around the pkgCache::DescIterator class.  It exposes the following methods:

```
    LanguageCode, md5 and FileList.
```

### AptPkg::Cache::\_pkg\_file

The AptPkg::Cache::\_pkg\_file package wraps a Perl class around the pkgCache::PkgFileIterator class.  It exposes the following methods:

```
    FileName, Archive, Component, Version, Origin, Label, Site,
    IndexType and Index.
```

### AptPkg::Cache::\_ver\_file

The AptPkg::Cache::\_ver\_file package wraps a Perl class around the pkgCache::VerFileIterator class.  It exposes the following methods:

```
    File, Index and Offset.
```

### AptPkg::Cache::\_desc\_file

The AptPkg::Cache::\_desc\_file package wraps a Perl class around the pkgCache::DescFileIterator class.  It exposes the following methods:

```
    File
```

### AptPkg::Cache::\_pkg\_records

The AptPkg::Cache::\_pkg\_records package wraps a Perl class around the pkgRecords class.  It exposes the following methods:

```
    Lookup.
```

### AptPkg::\_policy

The AptPkg::\_policy package wraps a Perl class around the pkgPolicy class.  It exposes the following methods:

```
    GetPriority and GetCandidateVer.
```

### AptPkg::\_source\_list

The AptPkg::\_source\_list package wraps a Perl class around the pkgSourceList class.  Required as an argument to the AptPkg::\_src\_records constructor.

### AptPkg::\_src\_records

The AptPkg::\_src\_records package wraps a Perl class around the pkgSrcRecords class.  It exposes the following methods:

```
    Restart, Find.
```

### Constants

The following **APT** enumerations are included, used by attributes of AptPkg::Cache.

*pkgCache::Version::VerMultiArch*

`"AptPkg::Version::No"`, `"AptPkg::Version::All"`, `"AptPkg::Version::Foreign"`, `"AptPkg::Version::Same"`, `"AptPkg::Version::Allowed"`, `"AptPkg::Version::AllForeign"` and `"AptPkg::Version::AllAllowed"`.

*pkgCache::Dep::DepType*

`"AptPkg::Dep::Depends"`, `"AptPkg::Dep::PreDepends"`, `"AptPkg::Dep::Suggests"`, `"AptPkg::Dep::Recommends"`, `"AptPkg::Dep::Conflicts"`, `"AptPkg::Dep::Replaces"`, `"AptPkg::Dep::Obsoletes"` `"AptPkg::Dep::DpkgBreaks"` and `"AptPkg::Dep::Enhances"`.

*pkgCache::Dep::DepCompareOp*

`"AptPkg::Dep::Or"`, `"AptPkg::Dep::NoOp"`, `"AptPkg::Dep::LessEq"`, `"AptPkg::Dep::GreaterEq"`, `"AptPkg::Dep::Less"`, `"AptPkg::Dep::Greater"`, `"AptPkg::Dep::Equals"` and `"AptPkg::Dep::NotEquals"`.

*pkgCache::State::VerPriority*

`"AptPkg::State::Important"`, `"AptPkg::State::Required"`, `"AptPkg::State::Standard"`, `"AptPkg::State::Optional"` and `"AptPkg::State::Extra"`.

*pkgCache::State::PkgSelectedState*

`"AptPkg::State::Unknown"`, `"AptPkg::State::Install"`, `"AptPkg::State::Hold"`, `"AptPkg::State::DeInstall"` and `"AptPkg::State::Purge"`.

*pkgCache::State::PkgInstState*

`"AptPkg::State::Ok"`, `"AptPkg::State::ReInstReq"`, `"AptPkg::State::HoldInst"` and `"AptPkg::State::HoldReInstReq"`.

*pkgCache::State::PkgCurrentState*

`"AptPkg::State::NotInstalled"`, `"AptPkg::State::UnPacked"`, `"AptPkg::State::HalfConfigured"`, `"AptPkg::State::HalfInstalled"`, `"AptPkg::State::ConfigFiles"`, `"AptPkg::State::Installed"`, `"AptPkg::State::TriggersAwaited"` and `"AptPkg::State::TriggersPending"`.

*pkgCache::Flag::PkgFlags*

`"AptPkg::Flag::Auto"`, `"AptPkg::Flag::Essential"` and `"AptPkg::Flag::Important"`.

## SEE ALSO

[**AptPkg::Config**(3pm)](/AptPkg::Config/3pm.md), [**AptPkg::System**(3pm)](/AptPkg::System/3pm.md), [**AptPkg::Version**(3pm)](/AptPkg::Version/3pm.md), [**AptPkg::Cache**(3pm)](/AptPkg::Cache/3pm.md), [**AptPkg::Source**(3pm)](/AptPkg::Source/3pm.md).

## AUTHOR

Brendan O'Dea \<bod@debian.org\>
