skip architecture list patching in case if any architecture is set

This commit is contained in:
Evgenii Alekseev 2022-09-17 04:04:28 +03:00
parent 4f6bd29ff4
commit 664b6369bb
2 changed files with 14 additions and 0 deletions

View File

@ -57,6 +57,8 @@ class Sources(LazyLogging):
return
architectures = Package.supported_architectures(sources_dir)
if "any" in architectures: # makepkg does not like when there is any other arch except for any
return
architectures.add(architecture)
patch = PkgbuildPatch("arch", list(architectures))
patch.write(pkgbuild_path)

View File

@ -23,6 +23,18 @@ def test_extend_architectures(mocker: MockerFixture) -> None:
write_mock.assert_called_once_with(Path("local") / "PKGBUILD")
def test_extend_architectures_any(mocker: MockerFixture) -> None:
"""
must skip architecture patching in case if there is any architecture
"""
mocker.patch("pathlib.Path.is_file", return_value=True)
mocker.patch("ahriman.models.package.Package.supported_architectures", return_value={"any"})
write_mock = mocker.patch("ahriman.models.pkgbuild_patch.PkgbuildPatch.write")
Sources.extend_architectures(Path("local"), "i686")
write_mock.assert_not_called()
def test_extend_architectures_skip(mocker: MockerFixture) -> None:
"""
must skip extending list of the architectures in case if no PKGBUILD file found