diff --git a/src/ahriman/core/database/migrations/m016_archive.py b/src/ahriman/core/database/migrations/m016_archive.py index 26670e98..e2a5503d 100644 --- a/src/ahriman/core/database/migrations/m016_archive.py +++ b/src/ahriman/core/database/migrations/m016_archive.py @@ -79,7 +79,7 @@ def move_packages(repository_paths: RepositoryPaths, pacman: Pacman) -> None: artifacts.append(signature) for source in artifacts: - target = repository_paths.ensure_exists(repository_paths.archive_for, package.base) / source.name + target = repository_paths.ensure_exists(repository_paths.archive_for(package.base)) / source.name # move package to the archive directory atomic_move(source, target) # create symlink to the archive diff --git a/src/ahriman/core/repository/executor.py b/src/ahriman/core/repository/executor.py index 98715903..ddd45893 100644 --- a/src/ahriman/core/repository/executor.py +++ b/src/ahriman/core/repository/executor.py @@ -171,7 +171,7 @@ class Executor(PackageInfo, Cleaner): files = self.sign.process_sign_package(full_path, packager_key) for src in files: - dst = self.paths.ensure_exists(self.paths.archive_for, package_base) / src.name + dst = self.paths.ensure_exists(self.paths.archive_for(package_base)) / src.name atomic_move(src, dst) # move package to archive directory if not (symlink := self.paths.repository / dst.name).exists(): symlink_relative(symlink, dst) # create link to archive diff --git a/src/ahriman/models/repository_paths.py b/src/ahriman/models/repository_paths.py index 31dea43c..b3029ee7 100644 --- a/src/ahriman/models/repository_paths.py +++ b/src/ahriman/models/repository_paths.py @@ -21,7 +21,7 @@ import contextlib import os import shutil -from collections.abc import Callable, Iterator +from collections.abc import Iterator from dataclasses import dataclass, field from functools import cached_property from pathlib import Path @@ -246,15 +246,12 @@ class RepositoryPaths(LazyLogging): """ return self.cache / package_base - def ensure_exists(self, directory: Callable[Params, Path] | Path, *args: Params.args, - **kwargs: Params.kwargs) -> Path: + def ensure_exists(self, directory: Path) -> Path: """ get path based on ``directory`` callable provided and ensure it exists Args: - directory(Callable[Params, Path] | Path): either directory extractor or path to directory to check - args(Params.args): positional arguments for directory call - kwargs(Params.kwargs): keyword arguments for directory call + directory(Path): path to directory to check Returns: Path: original path based on extractor provided. Directory will always exist @@ -262,11 +259,8 @@ class RepositoryPaths(LazyLogging): Examples: This method calls directory accessor and then checks if there is a directory and - otherwise - creates it:: - >>> paths.ensure_exists(paths.archive_for, package_base) + >>> paths.ensure_exists(paths.archive_for(package_base)) """ - if callable(directory): - directory = directory(*args, **kwargs) - if not directory.is_dir(): with self.preserve_owner(): directory.mkdir(mode=0o755, parents=True)