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