ahriman.core.database.operations package
Submodules
ahriman.core.database.operations.auth_operations module
- class AuthOperations(path: Path, repository_id: RepositoryId)
Bases:
Operations
authorization operations
default constructor
- Parameters:
path (Path) – path to the database file
repository_id (RepositoryId) – repository unique identifier
- user_get(username: str) User | None
get user by username
- Parameters:
username (str) – username
- Returns:
user if it was found
- Return type:
User | None
- user_list(username: str | None, access: UserAccess | None) list[User]
get users by filter
- Parameters:
username (str | None) – optional filter by username
access (UserAccess | None) – optional filter by role
- Returns:
list of users who match criteria
- Return type:
list[User]
- user_remove(username: str) None
remove user from storage
- Parameters:
username (str) – username
ahriman.core.database.operations.build_operations module
- class BuildOperations(path: Path, repository_id: RepositoryId)
Bases:
Operations
operations for build queue functions
default constructor
- Parameters:
path (Path) – path to the database file
repository_id (RepositoryId) – repository unique identifier
- build_queue_clear(package_base: str | None, repository_id: RepositoryId | None = None) None
remove packages from build queue
- Parameters:
package_base (str | None) – optional filter by package base
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- build_queue_get(repository_id: RepositoryId | None = None) list[Package]
retrieve packages from build queue
- Parameters:
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- Returns:
list of packages to be built
- Return type:
list[Package]
- build_queue_insert(package: Package, repository_id: RepositoryId | None = None) None
insert packages to build queue
- Parameters:
package (Package) – package to be inserted
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
ahriman.core.database.operations.changes_operations module
- class ChangesOperations(path: Path, repository_id: RepositoryId)
Bases:
Operations
operations for source files changes
default constructor
- Parameters:
path (Path) – path to the database file
repository_id (RepositoryId) – repository unique identifier
- changes_get(package_base: str, repository_id: RepositoryId | None = None) Changes
get changes for the specific package base if available
- Parameters:
package_base (str) – package base to search
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- Returns:
changes for the package base if available
- Return type:
- changes_insert(package_base: str, changes: Changes, repository_id: RepositoryId | None = None) None
insert packages to build queue
- Parameters:
package_base (str) – package base to insert
changes (Changes) – package changes (as in patch format)
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- changes_remove(package_base: str | None, repository_id: RepositoryId | None = None) None
remove packages changes
- Parameters:
package_base (str | None) – optional filter by package base
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- hashes_get(repository_id: RepositoryId | None = None) dict[str, str]
extract last commit hashes if available
- Parameters:
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- Returns:
map of package base to its last commit hash
- Return type:
dict[str, str]
ahriman.core.database.operations.logs_operations module
- class LogsOperations(path: Path, repository_id: RepositoryId)
Bases:
Operations
logs operations
default constructor
- Parameters:
path (Path) – path to the database file
repository_id (RepositoryId) – repository unique identifier
- logs_get(package_base: str, limit: int = -1, offset: int = 0, repository_id: RepositoryId | None = None) list[tuple[float, str]]
extract logs for specified package base
- Parameters:
package_base (str) – package base to extract logs
limit (int, optional) – limit records to the specified count, -1 means unlimited (Default value = -1)
offset (int, optional) – records offset (Default value = 0)
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- Returns:
sorted package log records and their timestamps
- Return type:
list[tuple[float, str]]
- logs_insert(log_record_id: LogRecordId, created: float, record: str, repository_id: RepositoryId | None = None) None
write new log record to database
- Parameters:
log_record_id (LogRecordId) – current log record id
created (float) – log created timestamp from log record attribute
record (str) – log record
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- logs_remove(package_base: str, version: str | None, repository_id: RepositoryId | None = None) None
remove log records for the specified package
- Parameters:
package_base (str) – package base to remove logs
version (str | None) – package version. If set it will remove only logs belonging to another version
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
ahriman.core.database.operations.operations module
- class Operations(path: Path, repository_id: RepositoryId)
Bases:
LazyLogging
base operation class
- path
path to the database file
- Type:
Path
default constructor
- Parameters:
path (Path) – path to the database file
repository_id (RepositoryId) – repository unique identifier
- static factory(cursor: Cursor, row: tuple[Any, ...]) dict[str, Any]
dictionary factory based on official documentation
- Parameters:
cursor (Cursor) – cursor descriptor
row (tuple[Any, ...]) – fetched row
- Returns:
row converted to dictionary
- Return type:
dict[str, Any]
- with_connection(query: Callable[[Connection], T], *, commit: bool = False) T
perform operation in connection
- Parameters:
query (Callable[[Connection], T]) – function to be called with connection
commit (bool, optional) – if True commit() will be called on success (Default value = False)
- Returns:
result of the
query
call- Return type:
T
ahriman.core.database.operations.package_operations module
- class PackageOperations(path: Path, repository_id: RepositoryId)
Bases:
Operations
package operations
default constructor
- Parameters:
path (Path) – path to the database file
repository_id (RepositoryId) – repository unique identifier
- package_base_update(package: Package, repository_id: RepositoryId | None = None) None
update package base only
- Parameters:
package (Package) – package properties
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- package_remove(package_base: str, repository_id: RepositoryId | None = None) None
remove package from database
- Parameters:
package_base (str) – package base name
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- package_update(package: Package, status: BuildStatus, repository_id: RepositoryId | None = None) None
update package status
- Parameters:
package (Package) – package properties
status (BuildStatus) – new build status
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- packages_get(repository_id: RepositoryId | None = None) list[tuple[Package, BuildStatus]]
get package list and their build statuses from database
- Parameters:
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- Returns:
list of package properties and their statuses
- Return type:
list[tuple[Package, BuildStatus]]
- remotes_get(repository_id: RepositoryId | None = None) dict[str, RemoteSource]
get packages remotes based on current settings
- Parameters:
repository_id (RepositoryId, optional) – repository unique identifier override (Default value = None)
- Returns:
map of package base to its remote sources
- Return type:
dict[str, RemoteSource]
ahriman.core.database.operations.patch_operations module
- class PatchOperations(path: Path, repository_id: RepositoryId)
Bases:
Operations
operations for patches
default constructor
- Parameters:
path (Path) – path to the database file
repository_id (RepositoryId) – repository unique identifier
- patches_get(package_base: str) list[PkgbuildPatch]
retrieve patches for the package
- Parameters:
package_base (str) – package base to search for patches
- Returns:
plain text patch for the package
- Return type:
list[PkgbuildPatch]
- patches_insert(package_base: str, patches: list[PkgbuildPatch]) None
insert or update patch in database
- Parameters:
package_base (str) – package base to insert
patches (list[PkgbuildPatch]) – patch content
- patches_list(package_base: str | None, variables: list[str] | None) dict[str, list[PkgbuildPatch]]
extract all patches
- Parameters:
package_base (str | None) – optional filter by package base
variables (list[str] | None) – extract patches only for specified PKGBUILD variables
- Returns:
map of package base to patch content
- Return type:
dict[str, list[PkgbuildPatch]]
- patches_remove(package_base: str, variables: list[str] | None) None
remove patch set
- Parameters:
package_base (str) – package base to clear patches
variables (list[str] | None) – remove patches only for specified PKGBUILD variables