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:
RepositoryPropertiestrait to clean common repository objects
- 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.event_logger module
- class EventLogger
Bases:
objectwrapper for logging events
- event(package_base: str, event: EventType, message: str | None = None) None
log single event. For timed events use context manager
in_event()instead- Parameters:
package_base (str) – package base name
event (EventType) – event type to be logged on success action
message (str | None, optional) – optional message describing the action (Default value = None)
Examples
This method must be used as simple wrapper for
ahriman.core.status.Clientmethods, e.g.:>>> do_something() >>> self.event(package_base, EventType.PackageUpdated)
- in_event(package_base: str, event: EventType, message: str | None = None, failure: EventType | None = None) Iterator[None]
perform action in package context and log event with time elapsed
- Parameters:
Examples
This method must be used to perform action in context with time measurement:
>>> with self.in_event(package_base, EventType.PackageUpdated): >>> do_something()
Additional parameter
failurecan be set in order to emit an event on exception occurred. If none set (default), then no event will be recorded on exception
ahriman.core.repository.executor module
- class Executor(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization)
Bases:
PackageInfo,Cleanertrait for common repository update processes
- 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:
- Returns:
build result
- Return type:
- 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:
ahriman.core.repository.explorer module
- class Explorer
Bases:
objecthelper to read filesystem and find created repositories
- static repositories_extract(configuration: Configuration, repository: str | None = None, architecture: str | None = None) list[RepositoryId]
get known architectures
- Parameters:
configuration (Configuration) – configuration instance
repository (str | None, optional) – predefined repository name if available (Default value = None)
architecture (str | None, optional) – predefined repository architecture if available (Default value = None)
- Returns:
list of repository names and architectures for which tree is created
- Return type:
list[RepositoryId]
ahriman.core.repository.package_info module
- class PackageInfo
Bases:
LazyLogginghandler for the package information
- configuration
configuration instance
- Type:
- paths
repository paths instance
- Type:
- repository_id
repository unique identifier
- Type:
- full_depends(package: Package, packages: Iterable[Package]) list[str]
generate full dependencies list including transitive dependencies
- load_archives(packages: Iterable[Path], *, latest_only: bool = True) list[Package]
load packages from list of archives
- Parameters:
packages (Iterable[Path]) – paths to package archives
latest_only (bool, optional) – filter packages with the same base, keeping only fresh packages installed (Default value = True)
- Returns:
list of read packages
- Return type:
list[Package]
- package_archives(package_base: str) list[Package]
load list of packages known for this package base. This method unlike
ahriman.core.repository.package_info.PackageInfo.load_archives()scans archive directory and loads all versions available for thepackage_base- Parameters:
package_base (str) – package base
- Returns:
list of packages belonging to this base, sorted by version by ascension
- Return type:
list[Package]
- package_archives_lookup(package: Package) list[Path]
check if there is a rebuilt package already
- Parameters:
package (Package) – package to check
- Returns:
list of built packages and signatures if available, empty list otherwise
- Return type:
list[Path]
- package_changes(package: Package, last_commit_sha: str) Changes | None
extract package change for the package since last commit if available
- packages(filter_packages: Iterable[str] | None = None) list[Package]
generate list of repository packages
- Parameters:
filter_packages (Iterable[str] | None, optional) – filter packages list by specified only
- 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]
ahriman.core.repository.repository module
- class Repository(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization)
Bases:
Executor,UpdateHandlerbase 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())
- 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:
EventLogger,LazyLoggingrepository internal objects holder
- configuration
configuration instance
- Type:
- paths
repository paths instance
- Type:
- repository_id
repository unique identifier
- Type:
- triggers
triggers holder
- Type:
- 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
ahriman.core.repository.update_handler module
- class UpdateHandler(repository_id: RepositoryId, configuration: Configuration, database: SQLite, *, report: bool, refresh_pacman_database: PacmanSynchronization)
Bases:
PackageInfo,Cleanertrait to get package update 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) – 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_dependencies(filter_packages: Iterable[str]) list[Package]
check packages which are required to be rebuilt based on dynamic dependencies (e.g. linking, modules paths, etc.)
- Parameters:
filter_packages (Iterable[str]) – do not check every package just specified in the list
- Returns:
list of packages for which there is breaking linking
- Return type:
list[Package]