Specifying the 'force-clean' flag to the automate script should remove the build output directory.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1003 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
4c44ce466e
commit
933e01fb0e
|
@ -146,6 +146,25 @@ def get_checkout_info(path, fetch_latest = True):
|
|||
}
|
||||
}
|
||||
|
||||
def onerror(func, path, exc_info):
|
||||
"""
|
||||
Error handler for ``shutil.rmtree``.
|
||||
|
||||
If the error is due to an access error (read only file)
|
||||
it attempts to add write permission and then retries.
|
||||
|
||||
If the error is for another reason it re-raises the error.
|
||||
|
||||
Usage : ``shutil.rmtree(path, onerror=onerror)``
|
||||
"""
|
||||
import stat
|
||||
if not os.access(path, os.W_OK):
|
||||
# Is the error an access error ?
|
||||
os.chmod(path, stat.S_IWUSR)
|
||||
func(path)
|
||||
else:
|
||||
raise
|
||||
|
||||
# cannot be loaded as a module
|
||||
if __name__ != "__main__":
|
||||
sys.stderr.write('This file cannot be loaded as a module!')
|
||||
|
@ -209,8 +228,17 @@ if not os.path.exists(download_dir):
|
|||
# create the download directory
|
||||
os.makedirs(download_dir)
|
||||
|
||||
# set the expected script extension
|
||||
# Test the operating system.
|
||||
platform = '';
|
||||
if sys.platform == 'win32':
|
||||
platform = 'windows'
|
||||
elif sys.platform == 'darwin':
|
||||
platform = 'macosx'
|
||||
elif sys.platform.startswith('linux'):
|
||||
platform = 'linux'
|
||||
|
||||
# set the expected script extension
|
||||
if platform == 'windows':
|
||||
script_ext = '.bat'
|
||||
else:
|
||||
script_ext = '.sh'
|
||||
|
@ -308,6 +336,20 @@ if options.forceclean:
|
|||
# revert all Chromium changes and delete all unversioned files
|
||||
run('gclient revert -n', cwd = chromium_dir)
|
||||
|
||||
# remove the build output directories
|
||||
output_dirs = []
|
||||
if platform == 'windows':
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'build\\Debug'))
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'build\\Release'))
|
||||
elif platform == 'macosx':
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'xcodebuild'))
|
||||
elif platform == 'linux':
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'out'))
|
||||
|
||||
for output_dir in output_dirs:
|
||||
if os.path.exists(output_dir):
|
||||
shutil.rmtree(output_dir, onerror=onerror)
|
||||
|
||||
# force update, build and distrib steps
|
||||
options.forceupdate = True
|
||||
options.forcebuild = True
|
||||
|
|
|
@ -54,6 +54,25 @@ def get_svn_info(path):
|
|||
raise
|
||||
return {'url': url, 'revision': rev}
|
||||
|
||||
def onerror(func, path, exc_info):
|
||||
"""
|
||||
Error handler for ``shutil.rmtree``.
|
||||
|
||||
If the error is due to an access error (read only file)
|
||||
it attempts to add write permission and then retries.
|
||||
|
||||
If the error is for another reason it re-raises the error.
|
||||
|
||||
Usage : ``shutil.rmtree(path, onerror=onerror)``
|
||||
"""
|
||||
import stat
|
||||
if not os.access(path, os.W_OK):
|
||||
# Is the error an access error ?
|
||||
os.chmod(path, stat.S_IWUSR)
|
||||
func(path)
|
||||
else:
|
||||
raise
|
||||
|
||||
# cannot be loaded as a module
|
||||
if __name__ != "__main__":
|
||||
sys.stderr.write('This file cannot be loaded as a module!')
|
||||
|
@ -162,8 +181,17 @@ if not os.path.exists(download_dir):
|
|||
# create the download directory
|
||||
os.makedirs(download_dir)
|
||||
|
||||
# set the expected script extension
|
||||
# Test the operating system.
|
||||
platform = '';
|
||||
if sys.platform == 'win32':
|
||||
platform = 'windows'
|
||||
elif sys.platform == 'darwin':
|
||||
platform = 'macosx'
|
||||
elif sys.platform.startswith('linux'):
|
||||
platform = 'linux'
|
||||
|
||||
# set the expected script extension
|
||||
if platform == 'windows':
|
||||
script_ext = '.bat'
|
||||
else:
|
||||
script_ext = '.sh'
|
||||
|
@ -299,6 +327,20 @@ if options.forceclean:
|
|||
# revert all Chromium changes and delete all unversioned files
|
||||
run('gclient revert -n', chromium_dir, depot_tools_dir)
|
||||
|
||||
# remove the build output directories
|
||||
output_dirs = []
|
||||
if platform == 'windows':
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'build\\Debug'))
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'build\\Release'))
|
||||
elif platform == 'macosx':
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'xcodebuild'))
|
||||
elif platform == 'linux':
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'out'))
|
||||
|
||||
for output_dir in output_dirs:
|
||||
if os.path.exists(output_dir):
|
||||
shutil.rmtree(output_dir, onerror=onerror)
|
||||
|
||||
# force update, build and distrib steps
|
||||
options.forceupdate = True
|
||||
options.forcebuild = True
|
||||
|
|
Loading…
Reference in New Issue