Make strict mode available to packages (!1771)
Packages can add pmb:strict to their options to enable the --strict mode. This can be used if packages need to get build in a clean chroot or their make dependencies need to get removed.
This commit is contained in:
parent
b846ccebae
commit
2df16c5999
|
@ -218,7 +218,7 @@ def init_buildenv(args, apkbuild, arch, strict=False, force=False, cross=None,
|
||||||
pmb.build.init(args, suffix)
|
pmb.build.init(args, suffix)
|
||||||
pmb.build.other.configure_abuild(args, suffix)
|
pmb.build.other.configure_abuild(args, suffix)
|
||||||
pmb.build.other.configure_ccache(args, suffix)
|
pmb.build.other.configure_ccache(args, suffix)
|
||||||
if not strict and len(depends):
|
if not strict and "pmb:strict" not in apkbuild["options"] and len(depends):
|
||||||
pmb.chroot.apk.install(args, depends, suffix)
|
pmb.chroot.apk.install(args, depends, suffix)
|
||||||
if src:
|
if src:
|
||||||
pmb.chroot.apk.install(args, ["rsync"], suffix)
|
pmb.chroot.apk.install(args, ["rsync"], suffix)
|
||||||
|
@ -405,7 +405,10 @@ def run_abuild(args, apkbuild, arch, strict=False, force=False, cross=None,
|
||||||
|
|
||||||
# Build the abuild command
|
# Build the abuild command
|
||||||
cmd = ["abuild", "-D", "postmarketOS"]
|
cmd = ["abuild", "-D", "postmarketOS"]
|
||||||
if strict:
|
if strict or "pmb:strict" in apkbuild["options"]:
|
||||||
|
if not strict:
|
||||||
|
logging.debug(apkbuild["pkgname"] + ": 'pmb:strict' found in"
|
||||||
|
" options, building in strict mode")
|
||||||
cmd += ["-r"] # install depends with abuild
|
cmd += ["-r"] # install depends with abuild
|
||||||
else:
|
else:
|
||||||
cmd += ["-d"] # do not install depends with abuild
|
cmd += ["-d"] # do not install depends with abuild
|
||||||
|
@ -435,7 +438,7 @@ def finish(args, apkbuild, arch, output, strict=False, suffix="native"):
|
||||||
arch + "/APKINDEX.tar.gz")
|
arch + "/APKINDEX.tar.gz")
|
||||||
|
|
||||||
# Uninstall build dependencies (strict mode)
|
# Uninstall build dependencies (strict mode)
|
||||||
if strict:
|
if strict or "pmb:strict" in apkbuild["options"]:
|
||||||
logging.info("(" + suffix + ") uninstall build dependencies")
|
logging.info("(" + suffix + ") uninstall build dependencies")
|
||||||
pmb.chroot.user(args, ["abuild", "undeps"], suffix, "/home/pmos/build",
|
pmb.chroot.user(args, ["abuild", "undeps"], suffix, "/home/pmos/build",
|
||||||
env={"SUDO_APK": "abuild-apk --no-progress"})
|
env={"SUDO_APK": "abuild-apk --no-progress"})
|
||||||
|
|
|
@ -226,7 +226,7 @@ def test_init_buildenv(args, monkeypatch):
|
||||||
|
|
||||||
# Shortcut and fake apkbuild
|
# Shortcut and fake apkbuild
|
||||||
func = pmb.build._package.init_buildenv
|
func = pmb.build._package.init_buildenv
|
||||||
apkbuild = {"pkgname": "test", "depends": ["a"], "makedepends": ["b"]}
|
apkbuild = {"pkgname": "test", "depends": ["a"], "makedepends": ["b"], "options": []}
|
||||||
|
|
||||||
# Build is necessary (various code paths)
|
# Build is necessary (various code paths)
|
||||||
assert func(args, apkbuild, "armhf", strict=True) is True
|
assert func(args, apkbuild, "armhf", strict=True) is True
|
||||||
|
@ -297,7 +297,7 @@ def test_finish(args, monkeypatch):
|
||||||
|
|
||||||
# Shortcut and fake apkbuild
|
# Shortcut and fake apkbuild
|
||||||
func = pmb.build._package.finish
|
func = pmb.build._package.finish
|
||||||
apkbuild = {}
|
apkbuild = {"options": []}
|
||||||
|
|
||||||
# Non-existing output path
|
# Non-existing output path
|
||||||
with pytest.raises(RuntimeError) as e:
|
with pytest.raises(RuntimeError) as e:
|
||||||
|
|
Loading…
Reference in New Issue