Transactions

Author:Chris Warrick <chris@chriswarrick.com>
Copyright:© 2011-2023, Chris Warrick.
License:BSD (see /LICENSE or Appendix B.)
Date:2023-01-30
Version:4.3.2

New in version 4.1.0.

To install built packages, PKGBUILDer uses transactions. A transaction stores:

  • package names (as requested by user), used for the validation step
  • package file names, moved to pacman cache and installed through pacman -U
  • signature file names, moved to pacman cache
  • options for running the transaction
  • a reference to the transaction file name (if any; .tx files are autosaved when status changes occur)

Package installation transactions.

New in version 4.1.0.

Copyright:© 2011-2023, Chris Warrick.
License:BSD (see /LICENSE).
pkgbuilder.transaction.generate_filename(absolute=True)[source]

Generate a filename for the transaction.

class pkgbuilder.transaction.Transaction(pkgnames, pkgpaths, sigpaths, asdeps=True, uopt='', filename=None, delete=False, status=None, pacmanreturn=-1, invalid=-1)[source]

A package transaction.

exitcode

Provide the most appropriate exit code.

classmethod fromjson(jsondata)[source]

Create a transaction from JSON data.

The following fields exist:

  • __PBTX__ — PKGBUILDer version
  • pkgnames — names of packages to install
  • pkgpaths — paths to packages to install
  • sigpaths — paths to attached signature files
  • asdeps — whether or not this is a dependency install
  • uopt — special (local) options to pacman -U
  • status — status code of the transaction
  • pacmanreturn — pacman return code
  • invalid — number of invalid packages
install(sudo_tested=False, quiet=False)[source]

Install packages through pacman -U.

Parameters:
  • sudo_tested (bool) – if sudo was tested (password prompt)
  • quiet (bool) – suppress messages
Returns:

pacman return code

Return type:

int

classmethod load(filename)[source]

Load a transaction file.

move(sudo_tested=False, quiet=False)[source]

Move package and signature files to pacman cache.

Parameters:
  • sudo_tested (bool) – if sudo was tested (password prompt)
  • quiet (bool) – suppress messages
Returns:

0 on success, +mv return, -failed files

Return type:

int

pacman_pkgpaths

Return package paths, augmented for pacman.

run(standalone=True, quiet=False, validate=True)[source]

Run a transaction.

save(filename=None)[source]

Save a transaction file.

tojson()[source]

Serialize a transaction to JSON.

validate(quiet)[source]

Check if packages were installed.

Parameters:quiet (bool) – suppress messages
Returns:number of packages that were not installed
Return type:int
class pkgbuilder.transaction.TransactionStatus[source]

Transaction status.