ahriman.core.repository package

Submodules

ahriman.core.repository.cleaner module

class Cleaner(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization)

Bases: RepositoryProperties

trait to clean common repository objects

default constructor

Parameters:
  • repository_id (RepositoryId) – repository unique identifier

  • configuration (Configuration) – configuration instance

  • database (SQLite) – database instance

  • report (bool) – force enable or disable reporting

  • refresh_pacman_database (PacmanSynchronization) – pacman database synchronization level

clear_cache() None

clear cache directory

clear_chroot() None

clear cache directory. Warning: this method is architecture independent and will clear every chroot

clear_packages() None

clear directory with built packages (NOT repository itself)

clear_pacman() None

clear directory with pacman databases

clear_queue() None

clear packages which were queued for the update

packages_built() list[Path]

get list of files in built packages directory

Returns:

list of filenames from the directory

Return type:

list[Path]

Raises:

NotImplementedError – not implemented method

ahriman.core.repository.executor module

class Executor(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization)

Bases: PackageInfo, Cleaner

trait for common repository update processes

default constructor

Parameters:
  • repository_id (RepositoryId) – repository unique identifier

  • configuration (Configuration) – configuration instance

  • database (SQLite) – database instance

  • report (bool) – force enable or disable reporting

  • refresh_pacman_database (PacmanSynchronization) – pacman database synchronization level

process_build(updates: Iterable[Package], packagers: Packagers | None = None, *, bump_pkgrel: bool = False) Result

build packages

Parameters:
  • updates (Iterable[Package]) – list of packages properties to build

  • packagers (Packagers | None, optional) – optional override of username for build process (Default value = None)

  • bump_pkgrel (bool, optional) – bump pkgrel in case of local version conflict (Default value = False)

Returns:

build result

Return type:

Result

process_remove(packages: Iterable[str]) Result

remove packages from list

Parameters:

packages (Iterable[str]) – list of package names or bases to remove

Returns:

remove result

Return type:

Result

process_update(packages: Iterable[Path], packagers: Packagers | None = None) Result

sign packages, add them to repository and update repository database

Parameters:
  • packages (Iterable[Path]) – list of filenames to run

  • packagers (Packagers | None, optional) – optional override of username for build process (Default value = None)

Returns:

path to repository database

Return type:

Result

ahriman.core.repository.package_info module

class PackageInfo(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization)

Bases: RepositoryProperties

handler for the package information

default constructor

Parameters:
  • repository_id (RepositoryId) – repository unique identifier

  • configuration (Configuration) – configuration instance

  • database (SQLite) – database instance

  • report (bool) – force enable or disable reporting

  • refresh_pacman_database (PacmanSynchronization) – pacman database synchronization level

load_archives(packages: Iterable[Path]) list[Package]

load packages from list of archives

Parameters:

packages (Iterable[Path]) – paths to package archives

Returns:

list of read packages

Return type:

list[Package]

package_changes(package: Package, last_commit_sha: str | None) Changes

extract package change for the package since last commit if available

Parameters:
  • package (Package) – package properties

  • last_commit_sha (str | None) – last known commit hash

Returns:

changes if available

Return type:

Changes

packages() list[Package]

generate list of repository packages

Returns:

list of packages properties

Return type:

list[Package]

packages_built() list[Path]

get list of files in built packages directory

Returns:

list of filenames from the directory

Return type:

list[Path]

packages_depend_on(packages: list[Package], depends_on: Iterable[str] | None) list[Package]

extract list of packages which depends on specified package

Parameters:
  • packages (list[Package]) – list of packages to be filtered

  • depends_on (Iterable[str] | None) – dependencies of the packages

Returns:

list of repository packages which depend on specified packages

Return type:

list[Package]

ahriman.core.repository.repository module

class Repository(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization)

Bases: Executor, UpdateHandler

base repository control class

Examples

This class along with traits provides access to local repository actions, e.g. remove packages, update packages, sync local repository to remote, generate report, etc.:

>>> from ahriman.core.configuration import Configuration
>>> from ahriman.core.database import SQLite
>>>
>>> configuration = Configuration()
>>> database = SQLite.load(configuration)
>>> repository = Repository.load(RepositoryId("x86_64", "x86_64"), configuration, database, report=True)
>>> known_packages = repository.packages()
>>>
>>> build_result = repository.process_build(known_packages)
>>> built_packages = repository.packages_built()
>>> update_result = repository.process_update(built_packages)
>>>
>>> repository.triggers.on_result(update_result, repository.packages())

default constructor

Parameters:
  • repository_id (RepositoryId) – repository unique identifier

  • configuration (Configuration) – configuration instance

  • database (SQLite) – database instance

  • report (bool) – force enable or disable reporting

  • refresh_pacman_database (PacmanSynchronization) – pacman database synchronization level

classmethod load(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization = PacmanSynchronization.Disabled) Self

load instance from argument list

Parameters:
  • repository_id (RepositoryId) – repository unique identifier

  • configuration (Configuration) – configuration instance

  • database (SQLite) – database instance

  • report (bool) – force enable or disable reporting

  • refresh_pacman_database (PacmanSynchronization, optional) – pacman database synchronization level (Default value = PacmanSynchronization.Disabled)

Returns:

fully loaded repository class instance

Return type:

Self

ahriman.core.repository.repository_properties module

class RepositoryProperties(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization)

Bases: LazyLogging

repository internal objects holder

configuration

configuration instance

Type:

Configuration

database

database instance

Type:

SQLite

ignore_list

package bases which will be ignored during auto updates

Type:

list[str]

pacman

alpm wrapper instance

Type:

Pacman

paths

repository paths instance

Type:

RepositoryPaths

repo

repo commands wrapper instance

Type:

Repo

reporter

build status reporter instance

Type:

Client

repository_id

repository unique identifier

Type:

RepositoryId

sign

GPG wrapper instance

Type:

GPG

triggers

triggers holder

Type:

TriggerLoader

vcs_allowed_age

maximal age of the VCS packages before they will be checked

Type:

int

default constructor

Parameters:
  • repository_id (RepositoryId) – repository unique identifier

  • configuration (Configuration) – configuration instance

  • database (SQLite) – database instance

  • report (bool) – force enable or disable reporting

  • refresh_pacman_database (PacmanSynchronization) – pacman database synchronization level

packager(packagers: Packagers, package_base: str) User

extract packager from configuration having username

Parameters:
  • packagers (Packagers) – packagers override holder

  • package_base (str) – package base to lookup

Returns:

user found in database if any and empty object otherwise

Return type:

User | None

property architecture: str

repository architecture for backward compatibility

Returns:

repository architecture

Return type:

str

property name: str

repository name for backward compatibility

Returns:

repository name

Return type:

str

ahriman.core.repository.update_handler module

class UpdateHandler(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization)

Bases: PackageInfo, Cleaner

trait to get package update list

default constructor

Parameters:
  • repository_id (RepositoryId) – repository unique identifier

  • configuration (Configuration) – configuration instance

  • database (SQLite) – database instance

  • report (bool) – force enable or disable reporting

  • refresh_pacman_database (PacmanSynchronization) – pacman database synchronization level

updates_aur(filter_packages: Iterable[str], *, vcs: bool) list[Package]

check AUR for updates

Parameters:
  • filter_packages (Iterable[str]) – do not check every package just specified in the list

  • vcs (bool) – enable or disable checking of VCS packages

Returns:

list of packages which are out-of-dated

Return type:

list[Package]

updates_local(*, vcs: bool) list[Package]

check local packages for updates

Parameters:

vcs (bool) – enable or disable checking of VCS packages

Returns:

list of local packages which are out-of-dated

Return type:

list[Package]

updates_manual() list[Package]

check for packages for which manual update has been requested

Returns:

list of packages which are out-of-dated

Return type:

list[Package]

Module contents