Fix #948: a package depending on itself recursed forever (#963)

This commit is contained in:
Oliver Smith 2017-12-02 11:51:43 +00:00 committed by GitHub
parent 30d1a5cada
commit ae97f9d738
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 3 deletions

View file

@ -112,7 +112,8 @@ def test_check_arch(args):
def test_get_depends(monkeypatch):
func = pmb.build._package.get_depends
apkbuild = {"depends": ["a"], "makedepends": ["c", "b"]}
apkbuild = {"pkgname": "test", "depends": ["a"], "makedepends": ["c", "b"],
"subpackages": ["d"]}
# Depends + makedepends
args = args_patched(monkeypatch, ["pmbootstrap", "build", "test"])
@ -124,11 +125,22 @@ def test_get_depends(monkeypatch):
args = args_patched(monkeypatch, ["pmbootstrap", "build", "-i", "test"])
assert func(args, apkbuild) == ["b", "c"]
# Package depends on its own subpackage
apkbuild["makedepends"] = ["d"]
args = args_patched(monkeypatch, ["pmbootstrap", "build", "test"])
assert func(args, apkbuild) == ["a"]
# Package depends on itself
apkbuild["makedepends"] = ["c", "b", "test"]
args = args_patched(monkeypatch, ["pmbootstrap", "build", "test"])
assert func(args, apkbuild) == ["a", "b", "c"]
def test_build_depends(args, monkeypatch):
# Shortcut and fake apkbuild
func = pmb.build._package.build_depends
apkbuild = {"pkgname": "test", "depends": ["a"], "makedepends": ["b"]}
apkbuild = {"pkgname": "test", "depends": ["a"], "makedepends": ["b"],
"subpackages": ["d"]}
# No depends built (first makedepends + depends, then only makedepends)
monkeypatch.setattr(pmb.build._package, "package", return_none)