Skip to content

Commit

Permalink
bug: do not automatically add unknown local packages
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
arcan1s committed Oct 19, 2023
1 parent 16ad96d commit 158d01a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/ahriman/core/build_tools/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ def build(self, sources_dir: Path, packager: str | None = None) -> list[Path]:
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]

Expand Down
10 changes: 5 additions & 5 deletions src/ahriman/core/repository/update_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ def updates_local(self, *, vcs: bool) -> list[Package]:

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:
Expand Down
4 changes: 1 addition & 3 deletions tests/ahriman/core/repository/test_update_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 158d01a

Please sign in to comment.