---
name: "Cupt::Cache"
section: "3pm"
platform: "linux"
package: "libcupt-perl"
version: "1.5.14.1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/Cupt::Cache"
---

# Cupt::Cache(3pm)

store info about available packages

## NAME

Cupt::Cache - store info about available packages

## FLAGS

### o\_memoize

This flag determines whether it worth trade space for time in time-consuming functions. On by default. By now, it affects "get\_satisfying\_versions" method. If it's on, it stores references, so **don't** modify results of these functions, use them in read-only mode. It it's on, these functions are not thread-safe.

## METHODS

### new

creates a new Cupt::Cache object

Parameters:

*config* - reference to Cupt::Config

Next params are treated as hash-style param list:

'-source': read Sources

'-binary': read Packages

'-installed': read dpkg status file

'-allow-reinstall': list of globs of package names which are allowed to reinstall

Example:

```
  my $cache = new Cupt::Cache($config, '-source' => 0, '-binary' => 1);
```

### set\_config

method, sets new Cupt::Config for the cache

Parameters:

*config* - reference to Cupt::Config

### get\_binary\_package\_names

method, returns an array of binary package names

### get\_source\_package\_names

method, returns an array of source package names

### get\_system\_state

method, returns reference to Cupt::System::State

### get\_extended\_info

method, returns info about extended package statuses in format:

```
  {
    'automatically_installed' => { I<package_name> => 1 },
  }
```

### is\_automatically\_installed

method, returns boolean value - is the package automatically installed or not

Parameters:

*package\_name* - package name

### get\_original\_apt\_pin

method, returns pin value for the supplied version as described in [*apt\_preferences*(5)](/apt_preferences/5.md)

Parameters:

*version* - reference to Cupt::Cache::BinaryVersion

### get\_pin

method, returns Cupt pin value for the supplied version

Parameters:

*version* - reference to Cupt::Cache::BinaryVersion

### get\_binary\_package

method, returns reference to appropriate Cupt::Cache::Package for package name. Returns undef if there is no such package in cache.

Parameters:

*package\_name* - package name to find

### get\_source\_package

method, returns reference to appropriate Cupt::Cache::Package for package name. Returns undef if there is no such package in cache.

Parameters:

*package\_name* - package name to find

### get\_sorted\_pinned\_versions

method to get sorted by "candidatness" versions in descending order

Parameters:

*package* - reference to Cupt::Cache::Package

Returns: \[ { 'version' =\> *version*, 'pin' =\> *pin* }... \]

where:

*version* - reference to Cupt::Cache::BinaryVersion

*pin* - pin value

### get\_policy\_version

method, returns reference to Cupt::Cache::BinaryVersion, this is the version of *package*, which to be installed by cupt policy; or undef if there is no valid versions for this package

Parameters:

*package* - reference to Cupt::Cache::Package, package to select versions from

### get\_satisfying\_versions

method, returns reference to array of Cupt::Cache::BinaryVersion that satisfy relation, if no version can satisfy the relation, returns an empty array

Parameters:

*relation\_expression* - see Relation expression in Cupt::Cache::Relation

### get\_index\_entries

method, returns reference to list of "index\_entry"'s

### get\_path\_of\_index\_list

method, returns path of Packages/Sources file for *index\_entry*

Parameters:

"index\_entry"

### get\_download\_entries\_of\_index\_list

method, returns the download entries of Packages/Sources file for *index\_entry*

Parameters:

"index\_entry"

path to accompanying Release file

Returns:

\[ *download\_entry*... \]

where

*download\_entry* is

```
  {
    'uri' => {
               'size' => file size
               'md5sum' => MD5 hash sum
               'sha1sum' => SHA1 hash sum
               'sha256sum' => SHA256 hash sum
             }
  }
```

### get\_path\_of\_release\_list

method, returns path of Release file for *index\_entry*

Parameters:

"index\_entry"

### get\_download\_uri\_of\_release\_list

method, returns the remote URI of Release file for *index\_entry*

Parameters:

"index\_entry"

### get\_download\_entries\_of\_localized\_descriptions

method, returns the remote URIs and corresponding download places of possible Translation files for *index\_entry*

Parameters:

"index\_entry"

Returns:

\[ \[ *download URI*, *local path to place* \]... \]

### get\_path\_of\_extended\_states

returns path of file containing extended states for packages

### get\_binary\_release\_data

method, returns reference to array of available releases of binary packages in form \[ "release\_info" ... \]

### get\_source\_release\_data

method, returns reference to array of available releases of source packages in form \[ "release\_info" ... \]

## FREE SUBROUTINES

### verify\_signature

Checks signature of supplied file via GPG.

Parameters:

*config* - reference to Cupt::Config

*file* - path to file

Returns:

non-zero on success, zero on fail

### verify\_hash\_sums

verifies MD5, SHA1 and SHA256 hash sums of file

Parameters:

*hash sums* - { 'md5sum' =\> `$md5sum`, 'sha1sum' =\> `$sha1sum`', 'sha256sum' =\> `$sha256sum` }

You should specify at least one hash sum in this parameter.

*path* - path to file

Returns: zero on failure, non-zero on success

### get\_path\_of\_debian\_changelog

free subroutine, returns string path of Debian changelog for version when version is installed, undef otherwise

Parameters:

*version* - reference to Cupt::Cache::BinaryVersion

### get\_path\_of\_debian\_copyright

free subroutine, returns string path of Debian copyright for version when version is installed, undef otherwise

Parameters:

*version* - reference to Cupt::Cache::BinaryVersion

## DATA SPECIFICATION

### release\_info

This is a hash:

```
  {
    'signed' => boolean, whether release signed or not
    'version' => version of released distribution (can be undef)
    'description' => description string
    'vendor' => vendor string
    'label' => label string
    'archive' => archive name string
    'codename' => codename string
    'date' => date of release (can be undef)
    'valid-until' => time string when to forget about this release
    'architectures' => reference to array of available architectures
    'base_uri' => base URI (origin), empty string in case of "installed" distribution
        'not_automatic' => true if packages from this release shouldn't be considered for automatic upgrades
  }
```

### index\_entry

This is a hash:

```
  {
    'type' => { 'deb' | 'deb-src' }
    'uri' => URI string
    'distribution' => distribution path
    'component' => component string
  }
```
