From b702248debd4460dfd12401128de3828e11399bb Mon Sep 17 00:00:00 2001 From: Guo Dong Date: Mon, 11 Feb 2019 11:25:31 -0700 Subject: [PATCH] Enhance build script for clean command BuildLoader.py will failure to run git command if Slim bootloader source code is not in a git repo. Update Buildloader.py to check if git repo could not be detected, it will not run git command to clean un-tracked git files. TEST=Tested to build/clean APL success without git repo. Signed-off-by: Guo Dong --- BuildLoader.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/BuildLoader.py b/BuildLoader.py index 214d0634..add985aa 100755 --- a/BuildLoader.py +++ b/BuildLoader.py @@ -1218,7 +1218,6 @@ def main(): os.path.join (sbl_dir, 'BootloaderCorePkg/Platform.dsc'), os.path.join (workspace, 'Report.log') ] - cmds = [] if args.distclean: dirs.extend ([ @@ -1228,10 +1227,6 @@ def main(): files.extend ([ ]) - cmds.extend ([ - 'git clean -xdf BaseTools', - ]) - for dir in dirs: dirpath = os.path.join (workspace, dir) print 'Removing %s' % dirpath @@ -1242,7 +1237,8 @@ def main(): print 'Removing %s' % file os.remove(file) - for cmd in cmds: + if os.path.exists(os.path.join (sbl_dir, '.git')): + cmd = 'git clean -xdf BaseTools' x = subprocess.call(cmd.split(' '), cwd=sbl_dir) if x: raise Exception ('Failed to run clean-up commands !')