From ed7135f7257ea0c5a75df71cad765a66013ecb7f Mon Sep 17 00:00:00 2001 From: Marvin Friedrich Date: Thu, 30 Jan 2025 12:52:50 +0100 Subject: [PATCH] base: Add --quiet flag --- xbstrap/__init__.py | 7 +++++++ xbstrap/base.py | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/xbstrap/__init__.py b/xbstrap/__init__.py index d531184..1d5a65f 100755 --- a/xbstrap/__init__.py +++ b/xbstrap/__init__.py @@ -47,6 +47,12 @@ main_parser.add_argument( "-C", type=str, dest="build_dir", help="build dir (in place of cwd)", default="" ) +main_parser.add_argument( + "--quiet", + action="store_true", + default=False, + help="redirect stdout of packages to /dev/null", +) main_subparsers = main_parser.add_subparsers(dest="command") @@ -56,6 +62,7 @@ def config_for_args(args): changed_source_root=args.source_dir, debug_cfg_files=args.debug_cfg_files, ignore_cfg_cache=args.ignore_cfg_cache, + quiet=args.quiet, ) diff --git a/xbstrap/base.py b/xbstrap/base.py index 0da9c20..8937f10 100644 --- a/xbstrap/base.py +++ b/xbstrap/base.py @@ -252,10 +252,17 @@ def name_from_subject_id(subject_id): class Config: def __init__( - self, path, changed_source_root=None, *, debug_cfg_files=False, ignore_cfg_cache=False + self, + path, + changed_source_root=None, + *, + debug_cfg_files=False, + ignore_cfg_cache=False, + quiet=False, ): self.debug_cfg_files = debug_cfg_files self.ignore_cfg_cache = ignore_cfg_cache + self.quiet = quiet self._build_root_override = None if path == "" else path self._config_path = path @@ -2181,7 +2188,7 @@ def run_program( "args": args, "workdir": workdir, "extra_environ": extra_environ, - "quiet": quiet, + "quiet": quiet or cfg.quiet, "cargo_home": cfg.cargo_config_toml is not None and cargo_home, "for_package": for_package, "virtual_tools": list(virtual_tools),