forked from Mirror/pmbootstrap
commands: new submodule (MR 2252)
The current mechanism of invoking pmbootstrap actions can be a bit confusing, and relies heavily on args being a big namespace with lots of properties (which may or may not be valid depending on the context). To aid in slowly removing args from the codebase, introduce a new mechanism for running commands. This works by having a class for each command, where the arguments are passed in as parameters to the constructor. No doubt this won't scale very far, but it's a skeleton we can continue to build on as we migrate more commands over to not require args in order to run. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
52cf0e0fe3
commit
8526631589
6 changed files with 121 additions and 25 deletions
|
@ -561,29 +561,6 @@ def work_migrate(args: PmbArgs):
|
|||
pmb.helpers.logging.disable()
|
||||
|
||||
|
||||
def log(args: PmbArgs):
|
||||
context = pmb.core.get_context()
|
||||
log_testsuite = pmb.config.work / "log_testsuite.txt"
|
||||
|
||||
if args.clear_log:
|
||||
pmb.helpers.run.user(["truncate", "-s", "0", context.log])
|
||||
pmb.helpers.run.user(["truncate", "-s", "0", log_testsuite])
|
||||
|
||||
cmd: List[PathString] = ["tail", "-n", args.lines, "-F"]
|
||||
|
||||
# Follow the testsuite's log file too if it exists. It will be created when
|
||||
# starting a test case that writes to it (git -C test grep log_testsuite).
|
||||
if os.path.exists(log_testsuite):
|
||||
cmd += [log_testsuite]
|
||||
|
||||
# tail writes the last lines of the files to the terminal. Put the regular
|
||||
# log at the end, so that output is visible at the bottom (where the user
|
||||
# looks for an error / what's currently going on).
|
||||
cmd += [context.log]
|
||||
|
||||
pmb.helpers.run.user(cmd, output="tui")
|
||||
|
||||
|
||||
def zap(args: PmbArgs):
|
||||
pmb.chroot.zap(args, dry=args.dry, http=args.http,
|
||||
distfiles=args.distfiles, pkgs_local=args.pkgs_local,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue