forked from Mirror/pmbootstrap
pmbootstrap: handle checkdepends (#1533)
This commit is contained in:
parent
30706a07c4
commit
5edabd4d17
3 changed files with 10 additions and 7 deletions
|
@ -97,6 +97,8 @@ def get_depends(args, apkbuild):
|
||||||
"""
|
"""
|
||||||
# Read makedepends and depends
|
# Read makedepends and depends
|
||||||
ret = list(apkbuild["makedepends"])
|
ret = list(apkbuild["makedepends"])
|
||||||
|
if "!check" not in apkbuild["options"]:
|
||||||
|
ret += apkbuild["checkdepends"]
|
||||||
if "ignore_depends" not in args or not args.ignore_depends:
|
if "ignore_depends" not in args or not args.ignore_depends:
|
||||||
ret += apkbuild["depends"]
|
ret += apkbuild["depends"]
|
||||||
ret = sorted(set(ret))
|
ret = sorted(set(ret))
|
||||||
|
|
|
@ -190,6 +190,7 @@ apkbuild_attributes = {
|
||||||
"depends": {"array": True},
|
"depends": {"array": True},
|
||||||
"depends_dev": {"array": True},
|
"depends_dev": {"array": True},
|
||||||
"makedepends": {"array": True},
|
"makedepends": {"array": True},
|
||||||
|
"checkdepends": {"array": True},
|
||||||
"options": {"array": True},
|
"options": {"array": True},
|
||||||
"pkgname": {"array": False},
|
"pkgname": {"array": False},
|
||||||
"pkgdesc": {"array": False},
|
"pkgdesc": {"array": False},
|
||||||
|
|
|
@ -124,34 +124,34 @@ def test_check_arch(args):
|
||||||
def test_get_depends(monkeypatch):
|
def test_get_depends(monkeypatch):
|
||||||
func = pmb.build._package.get_depends
|
func = pmb.build._package.get_depends
|
||||||
apkbuild = {"pkgname": "test", "depends": ["a"], "makedepends": ["c", "b"],
|
apkbuild = {"pkgname": "test", "depends": ["a"], "makedepends": ["c", "b"],
|
||||||
"subpackages": ["d"]}
|
"checkdepends": "e", "subpackages": ["d"], "options": []}
|
||||||
|
|
||||||
# Depends + makedepends
|
# Depends + makedepends
|
||||||
args = args_patched(monkeypatch, ["pmbootstrap", "build", "test"])
|
args = args_patched(monkeypatch, ["pmbootstrap", "build", "test"])
|
||||||
assert func(args, apkbuild) == ["a", "b", "c"]
|
assert func(args, apkbuild) == ["a", "b", "c", "e"]
|
||||||
args = args_patched(monkeypatch, ["pmbootstrap", "install"])
|
args = args_patched(monkeypatch, ["pmbootstrap", "install"])
|
||||||
assert func(args, apkbuild) == ["a", "b", "c"]
|
assert func(args, apkbuild) == ["a", "b", "c", "e"]
|
||||||
|
|
||||||
# Ignore depends (-i)
|
# Ignore depends (-i)
|
||||||
args = args_patched(monkeypatch, ["pmbootstrap", "build", "-i", "test"])
|
args = args_patched(monkeypatch, ["pmbootstrap", "build", "-i", "test"])
|
||||||
assert func(args, apkbuild) == ["b", "c"]
|
assert func(args, apkbuild) == ["b", "c", "e"]
|
||||||
|
|
||||||
# Package depends on its own subpackage
|
# Package depends on its own subpackage
|
||||||
apkbuild["makedepends"] = ["d"]
|
apkbuild["makedepends"] = ["d"]
|
||||||
args = args_patched(monkeypatch, ["pmbootstrap", "build", "test"])
|
args = args_patched(monkeypatch, ["pmbootstrap", "build", "test"])
|
||||||
assert func(args, apkbuild) == ["a"]
|
assert func(args, apkbuild) == ["a", "e"]
|
||||||
|
|
||||||
# Package depends on itself
|
# Package depends on itself
|
||||||
apkbuild["makedepends"] = ["c", "b", "test"]
|
apkbuild["makedepends"] = ["c", "b", "test"]
|
||||||
args = args_patched(monkeypatch, ["pmbootstrap", "build", "test"])
|
args = args_patched(monkeypatch, ["pmbootstrap", "build", "test"])
|
||||||
assert func(args, apkbuild) == ["a", "b", "c"]
|
assert func(args, apkbuild) == ["a", "b", "c", "e"]
|
||||||
|
|
||||||
|
|
||||||
def test_build_depends(args, monkeypatch):
|
def test_build_depends(args, monkeypatch):
|
||||||
# Shortcut and fake apkbuild
|
# Shortcut and fake apkbuild
|
||||||
func = pmb.build._package.build_depends
|
func = pmb.build._package.build_depends
|
||||||
apkbuild = {"pkgname": "test", "depends": ["a"], "makedepends": ["b"],
|
apkbuild = {"pkgname": "test", "depends": ["a"], "makedepends": ["b"],
|
||||||
"subpackages": ["d"]}
|
"checkdepends": [], "subpackages": ["d"], "options": []}
|
||||||
|
|
||||||
# No depends built (first makedepends + depends, then only makedepends)
|
# No depends built (first makedepends + depends, then only makedepends)
|
||||||
monkeypatch.setattr(pmb.build._package, "package", return_none)
|
monkeypatch.setattr(pmb.build._package, "package", return_none)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue