forked from Mirror/pmbootstrap
Allow installing Alpine's mesa for x86* arches (!1768)
When a pmaport can not be built for the desired architecture, fall back to the binary package (from postmarketOS or Alpine) if it exists. This allows us to provide an updated version of mesa for arm arches, but using Alpine's mesa package on x86* arches.
This commit is contained in:
parent
c90521a888
commit
d106063fbb
2 changed files with 37 additions and 12 deletions
|
@ -102,7 +102,7 @@ def test_get_apkbuild(args):
|
|||
assert "Could not find" in str(e.value)
|
||||
|
||||
|
||||
def test_check_arch_abort(monkeypatch, args):
|
||||
def test_check_build_for_arch(monkeypatch, args):
|
||||
# Fake APKBUILD data
|
||||
apkbuild = {"pkgname": "testpkgname"}
|
||||
|
||||
|
@ -110,21 +110,28 @@ def test_check_arch_abort(monkeypatch, args):
|
|||
return apkbuild
|
||||
monkeypatch.setattr(pmb.helpers.pmaports, "get", fake_helpers_pmaports_get)
|
||||
|
||||
# Arch is right
|
||||
func = pmb.build._package.check_arch_abort
|
||||
# pmaport with arch exists
|
||||
func = pmb.build._package.check_build_for_arch
|
||||
apkbuild["arch"] = ["armhf"]
|
||||
func(args, "testpkgname", "armhf")
|
||||
assert func(args, "testpkgname", "armhf") is True
|
||||
apkbuild["arch"] = ["noarch"]
|
||||
func(args, "testpkgname", "armhf")
|
||||
assert func(args, "testpkgname", "armhf") is True
|
||||
apkbuild["arch"] = ["all"]
|
||||
func(args, "testpkgname", "armhf")
|
||||
assert func(args, "testpkgname", "armhf") is True
|
||||
|
||||
# Arch is wrong
|
||||
# No binary package exists and can't build it
|
||||
apkbuild["arch"] = ["x86_64"]
|
||||
with pytest.raises(RuntimeError) as e:
|
||||
func(args, "testpkgname", "armhf")
|
||||
assert "Can't build" in str(e.value)
|
||||
|
||||
# pmaport can't be built for x86_64, but binary package exists in Alpine
|
||||
apkbuild = {"pkgname": "mesa",
|
||||
"arch": "armhf",
|
||||
"pkgver": "9999",
|
||||
"pkgrel": "0"}
|
||||
assert func(args, "mesa", "x86_64") is False
|
||||
|
||||
|
||||
def test_get_depends(monkeypatch):
|
||||
func = pmb.build._package.get_depends
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue