diff --git a/src/python/jw/pkg/cmds/projects/CmdBuild.py b/src/python/jw/pkg/cmds/projects/CmdBuild.py index c6424ecf..048b4655 100644 --- a/src/python/jw/pkg/cmds/projects/CmdBuild.py +++ b/src/python/jw/pkg/cmds/projects/CmdBuild.py @@ -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: