---
name: "Cupt::System::Worker"
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::System::Worker"
---

# Cupt::System::Worker(3pm)

system modifier for Cupt

## NAME

Cupt::System::Worker - system modifier for Cupt

## METHODS

### new

creates new Cupt::System::Worker object

Parameters:

*config* - reference to Cupt::Config

*cache* - reference to Cupt::Cache

### set\_desired\_state

method, sets desired state of the system

Parameters:

*desired\_state* - the desired state after the actions, hash reference:

```
  { I<package_name> =>
    {
      'version' => I<version>,
      'manually_selected' => boolean
      'reasons' => [ I<reason>... ]
    }
  }
```

where:

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

TODO: reason description

### get\_actions\_preview

method, returns actions to be done to achieve desired state of the system (*desired\_state*)

Returns:

```
  {
    'install' => I<packages>,
    'remove' => I<packages>,
    'purge' => I<packages>,
    'upgrade' => I<packages>,
    'downgrade' => I<packages>,
    'configure' => I<packages>,
    'deconfigure' => I<packages>,
    'markauto' => [ $package_name ... ]
    'unmarkauto' => [ $package_name ... ]
  }
```

where:

*packages* = \[\
                 {\
                   'package\_name' =\> `$package_name`,\
                   'version' =\> *version*,\
 				  'reasons' =\> \[ *reason*... \]\
                 }...\
               \]

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

### get\_download\_sizes\_preview

Parameters:

*ref\_actions\_preview* - supply result of "get\_actions\_preview" here

Returns (*total\_bytes*, *need\_bytes*);

*total\_bytes* - total byte count needed for action, *need\_bytes* - byte count, needed to download, \<= *total\_bytes*

### get\_unpacked\_sizes\_preview

returns changes in unpacked sizes after whole operation for each package

Parameters:

*ref\_actions\_preview* - supply result of "get\_actions\_preview" here

Returns: { `$package_name` =\> `$size_change` }

### mark\_as\_automatically\_installed

method, marks group of packages as automatically/manually installed

Parameters:

*value* - boolean value: true - mark as automatically installed, false - mark as manually installed

*package\_name*... - array of of package names to mark

### change\_system

member function, performes planned actions

Returns true if successful, false otherwise

Parameters:

*download\_progress* - reference to subclass of Cupt::Download::Progress

### update\_release\_and\_index\_data

member function, performes update of APT/Cupt indexes

Returns true if successful, false otherwise

Parameters:

*download\_progress* - reference to subclass of Cupt::Download::Progress

### clean\_archives

method, cleans archives directory.

Parameters:

*sub\_callback* - reference to callback subroutine which will be called for each deletion with one argument - file path

*leave\_available* - whether to leave .debs that are available from package indexes or not

### save\_system\_snapshot

method, saves system snapthot under specified name

Parameters:

*snapshots* - Cupt::System::Snapshots

*name* - name of the snapshot

### remove\_system\_snapshot

method, removes the system snapshot, identified by name

Parameters:

*snapshots* - Cupt::System::Snapshots

*name* - a name of the snapshot

### rename\_system\_snapshot

method, renames the system snapshot

Parameters:

*snapshots* - Cupt::System::Snapshots

*previous\_name* - previous name of the snapshot

*new\_name* - new name of the snapshot
