diff --git a/pmb/build/menuconfig.py b/pmb/build/menuconfig.py index b5e63d29..49221975 100644 --- a/pmb/build/menuconfig.py +++ b/pmb/build/menuconfig.py @@ -55,7 +55,7 @@ def menuconfig(args, pkgname, arch): cmd += [key + "=" + value] cmd += ["abuild", "-d", "menuconfig"] logging.info("(native) run menuconfig") - pmb.chroot.user(args, cmd, "native", "/home/user/build", log=False) + pmb.chroot.user(args, cmd, "native", "/home/user/build", log=False, passthrough=True) # Update config + checksums logging.info("copy kernel config back to aport-folder") diff --git a/pmb/chroot/root.py b/pmb/chroot/root.py index dbf8b9c6..12e6900b 100644 --- a/pmb/chroot/root.py +++ b/pmb/chroot/root.py @@ -41,7 +41,7 @@ def executables_absolute_path(): def root(args, cmd, suffix="native", working_dir="/", log=True, - auto_init=True, return_stdout=False, check=True): + auto_init=True, return_stdout=False, check=True, passthrough=False): """ Run a command inside a chroot as root. @@ -82,4 +82,4 @@ def root(args, cmd, suffix="native", working_dir="/", log=True, # Run the command return pmb.helpers.run.core(args, cmd_full, log_message, log, - return_stdout, check) + return_stdout, check, passthrough) diff --git a/pmb/chroot/user.py b/pmb/chroot/user.py index edf8d907..7b03ad7b 100644 --- a/pmb/chroot/user.py +++ b/pmb/chroot/user.py @@ -20,7 +20,7 @@ import pmb.chroot.root def user(args, cmd, suffix="native", working_dir="/", log=True, - auto_init=True, return_stdout=False, check=True): + auto_init=True, return_stdout=False, check=True, passthrough=False): """ Run a command inside a chroot as "user" @@ -29,4 +29,4 @@ def user(args, cmd, suffix="native", working_dir="/", log=True, """ cmd = ["su", "user", "-c", " ".join(cmd)] return pmb.chroot.root(args, cmd, suffix, working_dir, log, - auto_init, return_stdout, check) + auto_init, return_stdout, check, passthrough) diff --git a/pmb/helpers/run.py b/pmb/helpers/run.py index 5f18aa23..cd2b8a79 100644 --- a/pmb/helpers/run.py +++ b/pmb/helpers/run.py @@ -19,6 +19,7 @@ along with pmbootstrap. If not, see . import logging import asyncio import locale +import subprocess @asyncio.coroutine @@ -77,7 +78,7 @@ def _execute(loop, args, cmd, log_message, log, return_stdout, check=True): return return_code -def core(args, cmd, log_message, log, return_stdout, check=True): +def core(args, cmd, log_message, log, return_stdout, check=True, passthrough=False): logging.debug(log_message) """ Run the command and write the output to the log. @@ -86,15 +87,18 @@ def core(args, cmd, log_message, log, return_stdout, check=True): :param log: send output to log instead of stdout :param return_stdout: return the stdout from the called process """ - loop = asyncio.get_event_loop() - loop.set_debug(False) - task = _execute(loop, args, cmd, log_message, log, return_stdout, check) - result = loop.run_until_complete(task) + if passthrough: + result = subprocess.check_call(cmd) + else: + loop = asyncio.get_event_loop() + loop.set_debug(False) + task = _execute(loop, args, cmd, log_message, log, return_stdout, check) + result = loop.run_until_complete(task) return result def user(args, cmd, log=True, working_dir=None, return_stdout=False, - check=True): + check=True, passthrough=False): """ :param working_dir: defaults to args.work """ @@ -102,13 +106,13 @@ def user(args, cmd, log=True, working_dir=None, return_stdout=False, working_dir = args.work # TODO: maintain and check against a whitelist - return core(args, cmd, "% " + " ".join(cmd), log, return_stdout, check) + return core(args, cmd, "% " + " ".join(cmd), log, return_stdout, check, passthrough) def root(args, cmd, log=True, working_dir=None, return_stdout=False, - check=True): + check=True, passthrough=False): """ :param working_dir: defaults to args.work """ cmd = ["sudo"] + cmd - return user(args, cmd, log, working_dir, return_stdout, check) + return user(args, cmd, log, working_dir, return_stdout, check, passthrough)