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 <guo.dong@intel.com>
This commit is contained in:
Guo Dong
2019-02-11 11:25:31 -07:00
committed by Maurice Ma
parent f62c2d4553
commit b702248deb
+2 -6
View File
@@ -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 !')