mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
jw.pkg.cmds.projects.CmdBuild: --source-profile -> --env-reinit
Replace --source-profile by --env-reinit and --env-keep to allow more fine-grained control over environment manipulation. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
b3fd624a3f
commit
d814052aac
1 changed files with 15 additions and 4 deletions
|
|
@ -24,8 +24,10 @@ class CmdBuild(Cmd): # export
|
|||
default=False, help='Don\'t build anything, just print the build order.')
|
||||
parser.add_argument('-I', '--ignore-deps', action='store_true',
|
||||
default=False, help='Don\'t build dependencies, i.e. build only modules specified on the command line')
|
||||
parser.add_argument('--source-profile', choices=['no', 'add', 'replace'],
|
||||
default='no', help='Source /etc/profile before each build step')
|
||||
parser.add_argument('--env-reinit', action='store_true',
|
||||
default=False, help='Source /etc/profile before each build step. Discard environment unless --env-keep is specified')
|
||||
parser.add_argument('--env-keep', default='none', help='Comma seperated list of environment variables to keep, '
|
||||
+ '"all" or "none", only meaningful if --env-reinit is specified')
|
||||
parser.add_argument('target', default='all', help='Build target')
|
||||
parser.add_argument('modules', nargs='+', default='', help='Modules to be built')
|
||||
|
||||
|
|
@ -100,8 +102,17 @@ class CmdBuild(Cmd): # export
|
|||
title = '---- [%d/%d]: Running "%s" in %s -' % (cur_project, num_projects, ' '.join(make_cmd), wd)
|
||||
|
||||
env = None
|
||||
if args.source_profile != 'no':
|
||||
env = await get_profile_env(add=True if args.source_profile == 'add' else False)
|
||||
if args.env_reinit:
|
||||
keep: bool|list[str] = False
|
||||
if args.env_keep is not None:
|
||||
match args.env_keep:
|
||||
case 'all':
|
||||
keep=True
|
||||
case 'none':
|
||||
keep=False
|
||||
case _:
|
||||
keep = args.env_keep.split(',')
|
||||
env = await get_profile_env(keep=keep)
|
||||
|
||||
try:
|
||||
stdout, stderr = await run_cmd(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue