mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 09:35:54 +02:00
jw.pkg.cmds.projects.CmdBuild: Add --source-profile
Add --source-profile=[no|add|replace] to the projects build command, doing the obvious thing. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
2d1beeebb0
commit
230eacac8b
1 changed files with 15 additions and 8 deletions
|
|
@ -4,7 +4,7 @@ import os, re, sys, subprocess, datetime, time
|
|||
from argparse import Namespace, ArgumentParser
|
||||
from functools import lru_cache
|
||||
|
||||
from ...lib.util import run_cmd
|
||||
from ...lib.util import run_cmd, get_profile_env
|
||||
from ...lib.log import *
|
||||
from ..Cmd import Cmd
|
||||
from ..CmdProjects import CmdProjects
|
||||
|
|
@ -24,6 +24,8 @@ 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('target', default='all', help='Build target')
|
||||
parser.add_argument('modules', nargs='+', default='', help='Modules to be built')
|
||||
|
||||
|
|
@ -85,16 +87,21 @@ class CmdBuild(Cmd): # export
|
|||
return 1
|
||||
|
||||
async def run_make(module, target, cur_project, num_projects):
|
||||
|
||||
patt = self.app.is_excluded_from_build(module)
|
||||
if patt is not None:
|
||||
print(f',{title} >')
|
||||
print(f'| Configured to skip build on platform >{patt}<')
|
||||
print(f'`{title} <')
|
||||
return
|
||||
|
||||
make_cmd = [ "make", target ]
|
||||
wd = self.app.find_dir(module, pretty=False)
|
||||
title = '---- [%d/%d]: Running "%s" in %s -' % (cur_project, num_projects, ' '.join(make_cmd), wd)
|
||||
|
||||
patt = self.app.is_excluded_from_build(module)
|
||||
if patt is not None:
|
||||
print(',' + title + ' >')
|
||||
print('| Configured to skip build on platform >' + patt + '<')
|
||||
print('`' + title + ' <')
|
||||
return
|
||||
env = None
|
||||
if args.source_profile != 'no':
|
||||
env = await get_profile_env(add=True if args.source_profile == 'add' else False)
|
||||
|
||||
try:
|
||||
stdout, stderr = await run_cmd(
|
||||
|
|
@ -103,7 +110,7 @@ class CmdBuild(Cmd): # export
|
|||
throw=True,
|
||||
verbose=True,
|
||||
cmd_input=None,
|
||||
env=None,
|
||||
env=env,
|
||||
title=title
|
||||
)
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue