build.menuconfig: add support for out-of-tree builds using _outdir (!1893)

This commit is contained in:
Dolphin von Chips 2020-03-21 13:36:01 +05:00 committed by Oliver Smith
parent ff61dfc077
commit cb9a02b348
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 6 additions and 2 deletions

View File

@ -40,7 +40,7 @@ def get_arch(args, apkbuild):
apkbuild["arch"][0] + "' architecture.")
def get_outputdir(args, pkgname):
def get_outputdir(args, pkgname, apkbuild):
"""
Get the folder for the kernel compilation output.
For most APKBUILDs, this is $builddir. But some older ones still use
@ -69,6 +69,10 @@ def get_outputdir(args, pkgname):
if os.path.exists(chroot + ret + "/kernel/.config"):
return os.path.join(ret, "kernel")
# Out-of-tree builds ($_outdir)
if os.path.exists(chroot + ret + "/" + apkbuild["_outdir"] + "/.config"):
return os.path.join(ret, apkbuild["_outdir"])
# Not found
raise RuntimeError("Could not find the kernel config. Consider making a"
" backup of your APKBUILD and recreating it from the"
@ -121,7 +125,7 @@ def menuconfig(args, pkgname):
env={"CARCH": arch})
# Run make menuconfig
outputdir = get_outputdir(args, pkgname)
outputdir = get_outputdir(args, pkgname, apkbuild)
logging.info("(native) make " + kopt)
pmb.chroot.user(args, ["make", kopt], "native",
outputdir, output="tui",