fix: force dry run build on task initialization for VCS packages

Previously if package is VCS and version in PKGBUILD doesn't match to
AUR one, then makepkg will update pkgbuild ignoring all previous pkgrel
patches

With this change during task init dry ryn process is always run for vcs
packages
This commit is contained in:
2025-01-27 15:46:41 +02:00
parent a07b20bf50
commit a9505386c2
4 changed files with 20 additions and 7 deletions

View File

@ -117,6 +117,21 @@ def test_init(task_ahriman: Task, mocker: MockerFixture) -> None:
load_mock.assert_called_once_with(Path("ahriman"), task_ahriman.package, patches, task_ahriman.paths)
def test_init_vcs(task_ahriman: Task, mocker: MockerFixture) -> None:
"""
must copy tree instead of fetch
"""
task_ahriman.package.base += "-git"
mocker.patch("ahriman.models.package.Package.from_build", return_value=task_ahriman.package)
load_mock = mocker.patch("ahriman.core.build_tools.sources.Sources.load", return_value="sha")
build_mock = mocker.patch("ahriman.core.build_tools.task.Task.build")
local = Path("ahriman")
assert task_ahriman.init(local, [], None) == "sha"
load_mock.assert_called_once_with(local, task_ahriman.package, [], task_ahriman.paths)
build_mock.assert_called_once_with(local, dry_run=True)
def test_init_bump_pkgrel(task_ahriman: Task, mocker: MockerFixture) -> None:
"""
must bump pkgrel if it is same as provided

View File

@ -359,13 +359,10 @@ def test_actual_version_vcs(package_tpacpi_bat_git: Package, configuration: Conf
mocker.patch("ahriman.models.pkgbuild.Pkgbuild.from_file", return_value=Pkgbuild.from_file(pkgbuild))
mocker.patch("pathlib.Path.glob", return_value=[Path("local")])
init_mock = mocker.patch("ahriman.core.build_tools.task.Task.init")
build_mock = mocker.patch("ahriman.core.build_tools.task.Task.build")
unlink_mock = mocker.patch("pathlib.Path.unlink")
assert package_tpacpi_bat_git.actual_version(configuration) == "3.1.r13.g4959b52-1"
init_mock.assert_called_once_with(configuration.repository_paths.cache_for(package_tpacpi_bat_git.base), [], None)
build_mock.assert_called_once_with(configuration.repository_paths.cache_for(package_tpacpi_bat_git.base),
dry_run=True)
unlink_mock.assert_called_once_with()