From 45eba6a6e3172c33e977e61704f4e91e73f8b5d1 Mon Sep 17 00:00:00 2001 From: Evgenii Alekseev Date: Thu, 19 Oct 2023 23:54:24 +0300 Subject: [PATCH] fix: do not automatically add unknown local packages Instead of automatic package addition now it is required to add package manually after clone. Less magic, plus would allow to use caches for multi-repo setup (see #109) --- src/ahriman/core/build_tools/task.py | 6 ++++-- src/ahriman/core/repository/update_handler.py | 10 +++++----- tests/ahriman/core/repository/test_update_handler.py | 4 +--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ahriman/core/build_tools/task.py b/src/ahriman/core/build_tools/task.py index 3827395f..bc06c50b 100644 --- a/src/ahriman/core/build_tools/task.py +++ b/src/ahriman/core/build_tools/task.py @@ -96,14 +96,16 @@ class Task(LazyLogging): cwd=sources_dir, logger=self.logger, user=self.uid, - environment=environment) + environment=environment, + ) # well it is not actually correct, but we can deal with it packages = Task._check_output( "makepkg", "--packagelist", exception=BuildError.from_process(self.package.base), cwd=sources_dir, - logger=self.logger + logger=self.logger, + environment=environment, ).splitlines() return [Path(package) for package in packages] diff --git a/src/ahriman/core/repository/update_handler.py b/src/ahriman/core/repository/update_handler.py index c0c44a04..12b08730 100644 --- a/src/ahriman/core/repository/update_handler.py +++ b/src/ahriman/core/repository/update_handler.py @@ -123,11 +123,11 @@ class UpdateHandler(Cleaner): local = packages.get(remote.base) if local is None: - self.reporter.set_unknown(remote) - result.append(remote) - elif local.is_outdated(remote, self.paths, - vcs_allowed_age=self.vcs_allowed_age, - calculate_version=vcs): + continue # we don't add packages automatically + + if local.is_outdated(remote, self.paths, + vcs_allowed_age=self.vcs_allowed_age, + calculate_version=vcs): self.reporter.set_pending(local.base) result.append(remote) except Exception: diff --git a/tests/ahriman/core/repository/test_update_handler.py b/tests/ahriman/core/repository/test_update_handler.py index bda41426..5c942156 100644 --- a/tests/ahriman/core/repository/test_update_handler.py +++ b/tests/ahriman/core/repository/test_update_handler.py @@ -199,10 +199,8 @@ def test_updates_local_unknown(update_handler: UpdateHandler, package_ahriman: P mocker.patch("ahriman.models.package.Package.is_outdated", return_value=True) mocker.patch("ahriman.core.build_tools.sources.Sources.fetch") mocker.patch("ahriman.models.package.Package.from_build", return_value=package_ahriman) - status_client_mock = mocker.patch("ahriman.core.status.client.Client.set_unknown") - assert update_handler.updates_local(vcs=True) == [package_ahriman] - status_client_mock.assert_called_once_with(package_ahriman) + assert update_handler.updates_local(vcs=True) == [] def test_updates_local_with_failures(update_handler: UpdateHandler, package_ahriman: Package,