mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
App: Support --pkg-filter / JW_DEFAULT_PKG_FILTER
Add global --pkg-filter argument, defaulting to JW_DEFAULT_PKG_FILTER. If it's specified, instantiate a PackageFilterString from it, and initialize App's Distro instance with it. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
dcdf69890c
commit
4e2b15e586
1 changed files with 13 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue