Cache which packages have been built (#972)

Fixes #968: Dependency calculation took a long time for `postmarketos-ui-plasma-mobile`
This commit is contained in:
Oliver Smith 2017-12-05 23:17:39 +00:00 committed by GitHub
parent ddabc69b8d
commit 96eaf481d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 1 deletions

View file

@ -75,6 +75,14 @@ def args_patched(monkeypatch, argv):
return pmb.parse.arguments()
def test_skip_already_built(args):
func = pmb.build._package.skip_already_built
assert args.cache["built"] == {}
assert func(args, "test-package", "armhf") is False
assert args.cache["built"] == {"armhf": ["test-package"]}
assert func(args, "test-package", "armhf") is True
def test_get_apkbuild(args):
func = pmb.build._package.get_apkbuild
@ -256,9 +264,11 @@ def test_package(args):
assert pmb.build.package(args, "hello-world", force=True)
# Package exists
args.cache["built"] = {}
assert pmb.build.package(args, "hello-world") is None
# Force building again
args.cache["built"] = {}
assert pmb.build.package(args, "hello-world", force=True)
# Build for another architecture
@ -293,6 +303,7 @@ def test_build_depends_high_level(args, monkeypatch):
# Remove hello-world
pmb.helpers.run.root(args, ["rm", output_hello_outside])
pmb.build.index_repo(args, args.arch_native)
args.cache["built"] = {}
# Ask to build the wrapper. It should not build the wrapper (it exists, not
# using force), but build/update its missing dependency "hello-world"