diff --git a/src/python/jw/pkg/App.py b/src/python/jw/pkg/App.py index 6e5d2844..6dc8e4fd 100644 --- a/src/python/jw/pkg/App.py +++ b/src/python/jw/pkg/App.py @@ -232,7 +232,18 @@ class App(Base): async def __init_async(self) -> None: if self.__distro is None: - self.__distro = await Distro.instantiate(ec=self.exec_context, id=self.args.distro_id) + pkg_filter_str = self.args.pkg_filter + if pkg_filter_str is None: + pkg_filter_str = os.getenv('JW_DEFAULT_PKG_FILTER') + pkg_filter: PackageFilter|None = None + if pkg_filter_str is not None: + from .lib.PackageFilter import PackageFilterString + pkg_filter = PackageFilterString(pkg_filter_str) + self.__distro = await Distro.instantiate( + ec = self.exec_context, + id = self.args.distro_id, + default_pkg_filter = pkg_filter, + ) async def __aexit__(self, exc_type, exc, tb) -> None: if self.__exec_context is not None: @@ -251,6 +262,7 @@ class App(Base): parser.add_argument('--interactive', choices=['true', 'false', 'auto'], default='true', help='Wait for user input or try to proceed unattended') parser.add_argument('--verbose', action='store_true', default=False, help='Be verbose on stderr about what\'s being done on the distro level') parser.add_argument('--uri', default='local', help='Run commands on this host') + parser.add_argument('--pkg-filter', help='Default filter for all distribution package-related operations') async def _run(self, args: argparse.Namespace) -> None: self.__topdir = args.topdir