libalpm
Arch Linux Package Manager Library
Typedefs | Enumerations | Functions
Transaction Functions
Public API

Functions to manipulate libalpm transactions. More...

Collaboration diagram for Transaction Functions:

Typedefs

typedef enum _alpm_transflag_t alpm_transflag_t
 Transaction flags.

Enumerations

enum  _alpm_transflag_t {
  ALPM_TRANS_FLAG_NODEPS = 1, ALPM_TRANS_FLAG_FORCE = (1 << 1), ALPM_TRANS_FLAG_NOSAVE = (1 << 2), ALPM_TRANS_FLAG_NODEPVERSION = (1 << 3),
  ALPM_TRANS_FLAG_CASCADE = (1 << 4), ALPM_TRANS_FLAG_RECURSE = (1 << 5), ALPM_TRANS_FLAG_DBONLY = (1 << 6), ALPM_TRANS_FLAG_ALLDEPS = (1 << 8),
  ALPM_TRANS_FLAG_DOWNLOADONLY = (1 << 9), ALPM_TRANS_FLAG_NOSCRIPTLET = (1 << 10), ALPM_TRANS_FLAG_NOCONFLICTS = (1 << 11), ALPM_TRANS_FLAG_NEEDED = (1 << 13),
  ALPM_TRANS_FLAG_ALLEXPLICIT = (1 << 14), ALPM_TRANS_FLAG_UNNEEDED = (1 << 15), ALPM_TRANS_FLAG_RECURSEALL = (1 << 16), ALPM_TRANS_FLAG_NOLOCK = (1 << 17)
}
 Transaction flags. More...

Functions

alpm_transflag_t alpm_trans_get_flags (alpm_handle_t *handle)
 Returns the bitfield of flags for the current transaction.
alpm_list_talpm_trans_get_add (alpm_handle_t *handle)
 Returns a list of packages added by the transaction.
alpm_list_talpm_trans_get_remove (alpm_handle_t *handle)
 Returns the list of packages removed by the transaction.
int alpm_trans_init (alpm_handle_t *handle, alpm_transflag_t flags)
 Initialize the transaction.
int alpm_trans_prepare (alpm_handle_t *handle, alpm_list_t **data)
 Prepare a transaction.
int alpm_trans_commit (alpm_handle_t *handle, alpm_list_t **data)
 Commit a transaction.
int alpm_trans_interrupt (alpm_handle_t *handle)
 Interrupt a transaction.
int alpm_trans_release (alpm_handle_t *handle)
 Release a transaction.

Detailed Description

Functions to manipulate libalpm transactions.


Typedef Documentation

Transaction flags.


Enumeration Type Documentation

Transaction flags.

Enumerator:
ALPM_TRANS_FLAG_NODEPS 

Ignore dependency checks.

ALPM_TRANS_FLAG_FORCE 

Ignore file conflicts and overwrite files.

ALPM_TRANS_FLAG_NOSAVE 

Delete files even if they are tagged as backup.

ALPM_TRANS_FLAG_NODEPVERSION 

Ignore version numbers when checking dependencies.

ALPM_TRANS_FLAG_CASCADE 

Remove also any packages depending on a package being removed.

ALPM_TRANS_FLAG_RECURSE 

Remove packages and their unneeded deps (not explicitly installed).

ALPM_TRANS_FLAG_DBONLY 

Modify database but do not commit changes to the filesystem.

ALPM_TRANS_FLAG_ALLDEPS 

Use ALPM_PKG_REASON_DEPEND when installing packages.

ALPM_TRANS_FLAG_DOWNLOADONLY 

Only download packages and do not actually install.

ALPM_TRANS_FLAG_NOSCRIPTLET 

Do not execute install scriptlets after installing.

ALPM_TRANS_FLAG_NOCONFLICTS 

Ignore dependency conflicts.

ALPM_TRANS_FLAG_NEEDED 

Do not install a package if it is already installed and up to date.

ALPM_TRANS_FLAG_ALLEXPLICIT 

Use ALPM_PKG_REASON_EXPLICIT when installing packages.

ALPM_TRANS_FLAG_UNNEEDED 

Do not remove a package if it is needed by another one.

ALPM_TRANS_FLAG_RECURSEALL 

Remove also explicitly installed unneeded deps (use with ALPM_TRANS_FLAG_RECURSE).

ALPM_TRANS_FLAG_NOLOCK 

Do not lock the database during the operation.

Definition at line 967 of file alpm.h.


Function Documentation

int alpm_trans_commit ( alpm_handle_t handle,
alpm_list_t **  data 
)

Commit a transaction.

Parameters:
handlethe context handle
datathe address of an alpm_list where detailed description of an error can be dumped (ie. list of conflicting files)
Returns:
0 on success, -1 on error (pm_errno is set accordingly)

Definition at line 143 of file trans.c.

References _alpm_remove_packages(), _alpm_sync_commit(), __alpm_trans_t::add, ALPM_ERR_TRANS_NOT_LOCKED, ALPM_ERR_TRANS_NOT_PREPARED, ALPM_ERR_TRANS_NULL, ALPM_TRANS_FLAG_NOLOCK, ASSERT, CHECK_HANDLE, __alpm_trans_t::flags, __alpm_trans_t::remove, RET_ERR, __alpm_trans_t::state, STATE_COMMITED, STATE_COMMITING, STATE_PREPARED, and __alpm_handle_t::trans.

Referenced by pacman_remove(), and sync_prepare_execute().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns a list of packages added by the transaction.

Parameters:
handlethe context handle
Returns:
a list of alpm_pkg_t structures

Definition at line 372 of file trans.c.

References __alpm_trans_t::add, ALPM_ERR_TRANS_NULL, ASSERT, CHECK_HANDLE, RET_ERR, and __alpm_handle_t::trans.

Referenced by display_targets(), and sync_prepare_execute().

Here is the caller graph for this function:

Returns the bitfield of flags for the current transaction.

Parameters:
handlethe context handle
Returns:
the bitfield of transaction flags

Definition at line 363 of file trans.c.

References ALPM_ERR_TRANS_NULL, ASSERT, CHECK_HANDLE, __alpm_trans_t::flags, RET_ERR, and __alpm_handle_t::trans.

Returns the list of packages removed by the transaction.

Parameters:
handlethe context handle
Returns:
a list of alpm_pkg_t structures

Definition at line 381 of file trans.c.

References ALPM_ERR_TRANS_NULL, ASSERT, CHECK_HANDLE, __alpm_trans_t::remove, RET_ERR, and __alpm_handle_t::trans.

Referenced by display_targets(), and pacman_remove().

Here is the caller graph for this function:

int alpm_trans_init ( alpm_handle_t handle,
alpm_transflag_t  flags 
)

Initialize the transaction.

Parameters:
handlethe context handle
flagsflags of the transaction (like nodeps, etc)
Returns:
0 on success, -1 on error (pm_errno is set accordingly)

Definition at line 49 of file trans.c.

References _alpm_handle_lock(), ALPM_ERR_HANDLE_LOCK, ALPM_ERR_MEMORY, ALPM_ERR_TRANS_NOT_NULL, ALPM_TRANS_FLAG_NOLOCK, ASSERT, CALLOC, CHECK_HANDLE, __alpm_trans_t::flags, RET_ERR, __alpm_trans_t::state, STATE_INITIALIZED, and __alpm_handle_t::trans.

Referenced by trans_init().

Here is the call graph for this function:

Here is the caller graph for this function:

Interrupt a transaction.

Parameters:
handlethe context handle
Returns:
0 on success, -1 on error (pm_errno is set accordingly)

Definition at line 182 of file trans.c.

References ALPM_ERR_TRANS_NULL, ALPM_ERR_TRANS_TYPE, ASSERT, CHECK_HANDLE, RET_ERR, __alpm_trans_t::state, STATE_COMMITING, STATE_INTERRUPTED, and __alpm_handle_t::trans.

int alpm_trans_prepare ( alpm_handle_t handle,
alpm_list_t **  data 
)

Prepare a transaction.

Parameters:
handlethe context handle
datathe address of an alpm_list where a list of alpm_depmissing_t objects is dumped (conflicting packages)
Returns:
0 on success, -1 on error (pm_errno is set accordingly)

Definition at line 99 of file trans.c.

References _alpm_remove_prepare(), _alpm_sync_prepare(), __alpm_trans_t::add, ALPM_ERR_PKG_INVALID_ARCH, ALPM_ERR_TRANS_NOT_INITIALIZED, ALPM_ERR_TRANS_NULL, ALPM_ERR_WRONG_ARGS, ASSERT, CHECK_HANDLE, __alpm_trans_t::remove, RET_ERR, __alpm_trans_t::state, STATE_INITIALIZED, STATE_PREPARED, and __alpm_handle_t::trans.

Referenced by pacman_remove(), and sync_prepare_execute().

Here is the call graph for this function:

Here is the caller graph for this function:

int alpm_trans_release ( alpm_handle_t handle)

Release a transaction.

Parameters:
handlethe context handle
Returns:
0 on success, -1 on error (pm_errno is set accordingly)

Definition at line 200 of file trans.c.

References _, _alpm_handle_unlock(), _alpm_log(), _alpm_trans_free(), ALPM_ERR_TRANS_NULL, ALPM_LOG_WARNING, alpm_logaction(), ALPM_TRANS_FLAG_NOLOCK, ASSERT, CHECK_HANDLE, __alpm_trans_t::flags, __alpm_handle_t::lockfile, RET_ERR, __alpm_trans_t::state, STATE_IDLE, and __alpm_handle_t::trans.

Referenced by trans_release().

Here is the call graph for this function:

Here is the caller graph for this function: