Add support to automate.py for building release branches (issue #325).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@428 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-12-19 23:11:56 +00:00
parent eff39b0f11
commit 9cc8ea09dc
1 changed files with 97 additions and 41 deletions

View File

@ -127,6 +127,10 @@ else:
# Retrieve the Chromium URL and revision from the CEF repo
compat_url = cef_url + "/CHROMIUM_BUILD_COMPATIBILITY.txt?r="+cef_rev
release_url = None
chromium_url = None
chromium_rev = None
try:
# Read the remote URL contents
handle = urllib.urlopen(compat_url)
@ -136,13 +140,18 @@ try:
# Parse the contents
config = eval(compat_value, {'__builtins__': None}, None)
if not 'chromium_url' in config:
raise Exception("Missing chromium_url value")
if not 'chromium_revision' in config:
raise Exception("Missing chromium_revision value")
chromium_url = check_url(config['chromium_url'])
chromium_rev = str(int(config['chromium_revision']))
if 'release_url' in config:
# building from a release
release_url = check_url(config['release_url'])
else:
# building from chromium src
if not 'chromium_url' in config:
raise Exception("Missing chromium_url value")
if not 'chromium_revision' in config:
raise Exception("Missing chromium_revision value")
chromium_url = check_url(config['chromium_url'])
chromium_rev = str(int(config['chromium_revision']))
except Exception, e:
sys.stderr.write('Failed to read URL and revision information from '+ \
compat_url+"\n")
@ -180,10 +189,11 @@ info = get_svn_info(cef_src_dir)
current_cef_url = info['url']
current_cef_rev = info['revision']
# retrieve the current Chromium URL and revision
info = get_svn_info(chromium_src_dir)
current_chromium_url = info['url']
current_chromium_rev = info['revision']
if release_url is None:
# retrieve the current Chromium URL and revision
info = get_svn_info(chromium_src_dir)
current_chromium_url = info['url']
current_chromium_rev = info['revision']
# test if the CEF URL changed
cef_url_changed = current_cef_url != cef_url
@ -197,46 +207,88 @@ sys.stdout.write('CEF Revision: '+current_cef_rev+"\n")
if cef_rev_changed:
sys.stdout.write(' -> CHANGED TO: '+cef_rev+"\n")
# test if the Chromium URL changed
chromium_url_changed = current_chromium_url != chromium_url
sys.stdout.write('Chromium URL: '+current_chromium_url+"\n")
if chromium_url_changed:
sys.stdout.write(' -> CHANGED TO: '+chromium_url+"\n")
release_url_changed = False
chromium_url_changed = False
chromium_rev_changed = False
# test if the Chromium revision changed
chromium_rev_changed = current_chromium_rev != chromium_rev
sys.stdout.write('Chromium Revision: '+current_chromium_rev+"\n")
if chromium_rev_changed:
sys.stdout.write(' -> CHANGED TO: '+chromium_rev+"\n")
if release_url is None:
# test if the Chromium URL changed
chromium_url_changed = current_chromium_url != chromium_url
sys.stdout.write('Chromium URL: '+current_chromium_url+"\n")
if chromium_url_changed:
sys.stdout.write(' -> CHANGED TO: '+chromium_url+"\n")
# test if the Chromium revision changed
chromium_rev_changed = current_chromium_rev != chromium_rev
sys.stdout.write('Chromium Revision: '+current_chromium_rev+"\n")
if chromium_rev_changed:
sys.stdout.write(' -> CHANGED TO: '+chromium_rev+"\n")
else:
# test if the release URL changed
current_release_url = 'None'
path = os.path.join(chromium_dir, '.gclient')
if os.path.exists(path):
# read the .gclient file
fp = open(path, 'r')
data = fp.read()
fp.close()
# Parse the contents
config_dict = {}
try:
exec(data, config_dict)
current_release_url = config_dict['solutions'][0]['url']
except Exception, e:
sys.stderr.write('Failed to parse existing .glient file.\n')
raise
release_url_changed = current_release_url != release_url
sys.stdout.write('Release URL: '+current_release_url+"\n")
if release_url_changed:
sys.stdout.write(' -> CHANGED TO: '+release_url+"\n")
# true if anything changed
any_changed = chromium_url_changed or chromium_rev_changed or \
cef_url_changed or cef_rev_changed
any_changed = release_url_changed or chromium_url_changed or \
chromium_rev_changed or cef_url_changed or cef_rev_changed
if not any_changed:
sys.stdout.write("No changes.\n")
if chromium_url_changed or options.forceconfig:
if release_url_changed or chromium_url_changed or options.forceconfig:
if release_url is None:
url = chromium_url
else:
url = release_url
# run gclient config to create the .gclient file
run('gclient config '+chromium_url, chromium_dir, depot_tools_dir)
run('gclient config '+url, chromium_dir, depot_tools_dir)
path = os.path.join(chromium_dir, '.gclient')
if not os.path.exists(path):
sys.stderr.write(".gclient file was not created\n")
raise Exception('.gclient file was not created')
# read the resulting .gclient file
fp = open(path, 'r')
data = fp.read()
fp.close()
# populate "custom_deps" section
data = data.replace('"custom_deps" : {', '"custom_deps" : {'+\
custom_deps = \
"\n "+'"src/third_party/WebKit/LayoutTests": None,'+\
"\n "+'"src/chrome_frame/tools/test/reference_build/chrome": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_mac": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_win": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_linux": None,')
"\n "+'"src/chrome/tools/test/reference_build/chrome_linux": None,'
if not release_url is None:
# TODO: Read the DEPS file and exclude all non-src directories.
custom_deps += \
"\n "+'"chromeos": None,'+\
"\n "+'"depot_tools": None,'
# populate "custom_deps" section
data = data.replace('"custom_deps" : {', '"custom_deps" : {'+custom_deps)
# write the new .gclient file
fp = open(path, 'w')
fp.write(data)
@ -246,22 +298,26 @@ if options.forceclean:
if os.path.exists(chromium_src_dir):
# revert all Chromium changes and delete all unversioned files
run('gclient revert -n', chromium_dir, depot_tools_dir)
# force update, build and distrib steps
options.forceupdate = True
options.forcebuild = True
options.forcedistrib = True
if chromium_url_changed or chromium_rev_changed or options.forceupdate:
# download/update the Chromium source code
run('gclient sync --revision src@'+chromium_rev+' --jobs 8 --force', \
chromium_dir, depot_tools_dir)
if release_url is None:
if chromium_url_changed or chromium_rev_changed or options.forceupdate:
# download/update the Chromium source code
run('gclient sync --revision src@'+chromium_rev+' --jobs 8 --force', \
chromium_dir, depot_tools_dir)
elif release_url_changed or options.forceupdate:
# download/update the release source code
run('gclient sync --jobs 8 --force', chromium_dir, depot_tools_dir)
if not os.path.exists(cef_src_dir) or cef_url_changed:
if cef_url_changed and os.path.exists(cef_src_dir):
# delete the cef directory (it will be re-downloaded)
shutil.rmtree(cef_src_dir)
# download the CEF source code
run('svn checkout '+cef_url+' -r '+cef_rev+' '+cef_src_dir, download_dir)
elif cef_rev_changed or options.forceupdate:
@ -279,11 +335,11 @@ if any_changed or options.forcebuild:
if not options.nodebugbuild:
# make CEF Debug build
run(path+' Debug', cef_tools_dir, depot_tools_dir)
if not options.noreleasebuild:
# make CEF Release build
run(path+' Release', cef_tools_dir, depot_tools_dir)
if any_changed or options.forcedistrib:
if not options.nodistrib:
# make CEF binary distribution