From a470a1b965c3d6ecaecc112ab4e9ddc666965276 Mon Sep 17 00:00:00 2001 From: Marvin Friedrich Date: Thu, 30 Jan 2025 11:38:56 +0100 Subject: [PATCH] base: Add --quiet flag --- xbstrap/__init__.py | 7 +++++++ xbstrap/base.py | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/xbstrap/__init__.py b/xbstrap/__init__.py index d531184..f22008d 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..1a2ed4d 100644 --- a/xbstrap/base.py +++ b/xbstrap/base.py @@ -252,10 +252,11 @@ 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 +2182,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),