mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-12 10:05:18 +01:00
automate-git: Remove --chromium-channel parameter (fixes issue #3447)
This functionality is currently unused, and depends on deprecated omahaproxy data sources from Chromium.
This commit is contained in:
parent
f34406c57d
commit
400fbf7839
@ -5,7 +5,6 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
from datetime import datetime
|
||||
import json
|
||||
from io import open
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
@ -34,8 +33,6 @@ depot_tools_archive_url = 'https://storage.googleapis.com/chrome-infra/depot_too
|
||||
|
||||
cef_git_url = 'https://bitbucket.org/chromiumembedded/cef.git'
|
||||
|
||||
chromium_channel_json_url = 'https://omahaproxy.appspot.com/all.json'
|
||||
|
||||
##
|
||||
# Global system variables.
|
||||
##
|
||||
@ -159,16 +156,6 @@ def get_git_hash(path, branch):
|
||||
return 'Unknown'
|
||||
|
||||
|
||||
def get_git_date(path, branch):
|
||||
""" Returns the date for the specified branch/tag/hash. """
|
||||
cmd = "%s show -s --format=%%ct %s" % (git_exe, branch)
|
||||
result = exec_cmd(cmd, path)
|
||||
if result['out'] != '':
|
||||
return datetime.utcfromtimestamp(
|
||||
int(result['out'].strip())).strftime('%Y-%m-%d %H:%M:%S UTC')
|
||||
return 'Unknown'
|
||||
|
||||
|
||||
def get_git_url(path):
|
||||
""" Returns the origin url for the specified path. """
|
||||
cmd = "%s config --get remote.origin.url" % (git_exe)
|
||||
@ -326,49 +313,6 @@ def onerror(func, path, exc_info):
|
||||
raise
|
||||
|
||||
|
||||
def read_json_url(url):
|
||||
""" Read a JSON URL. """
|
||||
msg('Downloading %s' % url)
|
||||
return json.loads(urlopen(url).read())
|
||||
|
||||
|
||||
g_channel_data = None
|
||||
|
||||
|
||||
def get_chromium_channel_data(os, channel, param=None):
|
||||
""" Returns all data for the specified Chromium channel. """
|
||||
global g_channel_data
|
||||
|
||||
if g_channel_data is None:
|
||||
g_channel_data = read_json_url(chromium_channel_json_url)
|
||||
assert len(g_channel_data) > 0, 'Failed to load Chromium channel data'
|
||||
|
||||
for oses in g_channel_data:
|
||||
if oses['os'] == os:
|
||||
for version in oses['versions']:
|
||||
if version['channel'] == channel:
|
||||
assert version['os'] == os
|
||||
assert version['channel'] == channel
|
||||
if param is None:
|
||||
return version
|
||||
else:
|
||||
assert param in version, 'Missing parameter %s for Chromium channel %s %s' % (
|
||||
param, os, channel)
|
||||
return version[param]
|
||||
raise Exception("Invalid Chromium channel value: %s" % channel)
|
||||
raise Exception("Invalid Chromium os value: %s" % os)
|
||||
|
||||
|
||||
def get_chromium_channel_commit(os, channel):
|
||||
""" Returns the current branch commit for the specified Chromium channel. """
|
||||
return get_chromium_channel_data(os, channel, 'branch_commit')
|
||||
|
||||
|
||||
def get_chromium_channel_version(os, channel):
|
||||
""" Returns the current version for the specified Chromium channel. """
|
||||
return get_chromium_channel_data(os, channel, 'current_version')
|
||||
|
||||
|
||||
def get_chromium_main_position(commit):
|
||||
""" Returns the closest main position for the specified Chromium commit. """
|
||||
# Using -2 because a "Publish DEPS" commit which does not have a master
|
||||
@ -394,16 +338,6 @@ def get_chromium_main_commit(position):
|
||||
return None
|
||||
|
||||
|
||||
def get_chromium_versions(commit):
|
||||
""" Returns the list of Chromium versions that contain the specified commit.
|
||||
Versions are listed oldest to newest. """
|
||||
cmd = '%s tag --contains %s' % (git_exe, commit)
|
||||
result = exec_cmd(cmd, chromium_src_dir)
|
||||
if result['out'] != '':
|
||||
return [line.strip() for line in result['out'].strip().split('\n')]
|
||||
return None
|
||||
|
||||
|
||||
def get_build_compat_versions():
|
||||
""" Returns the compatible Chromium and (optionally) depot_tools versions
|
||||
specified by the CEF checkout. """
|
||||
@ -416,68 +350,6 @@ def get_build_compat_versions():
|
||||
return config
|
||||
|
||||
|
||||
def get_chromium_target_version(os='win', channel='canary', target_distance=0):
|
||||
""" Returns the target Chromium version based on a heuristic. """
|
||||
# The current compatible version from CEF.
|
||||
compat_version = chromium_compat_version
|
||||
compat_commit = get_git_hash(chromium_src_dir, compat_version)
|
||||
if compat_version == compat_commit:
|
||||
versions = get_chromium_versions(compat_commit)
|
||||
if len(versions) > 0:
|
||||
compat_version = 'refs/tags/' + versions[0]
|
||||
# Closest version may not align with the compat position, so adjust the
|
||||
# commit to match.
|
||||
compat_commit = get_git_hash(chromium_src_dir, compat_version)
|
||||
compat_position = get_chromium_main_position(compat_commit)
|
||||
compat_date = get_git_date(chromium_src_dir, compat_commit)
|
||||
|
||||
# The most recent channel version from the Chromium website.
|
||||
channel_version = 'refs/tags/' + get_chromium_channel_version(os, channel)
|
||||
channel_commit = get_chromium_channel_commit(os, channel)
|
||||
channel_position = get_chromium_main_position(channel_commit)
|
||||
channel_date = get_git_date(chromium_src_dir, channel_commit)
|
||||
|
||||
if compat_position >= channel_position:
|
||||
# Already compatible with the channel version or newer.
|
||||
target_version = compat_version
|
||||
target_commit = compat_commit
|
||||
target_position = compat_position
|
||||
target_date = compat_date
|
||||
elif target_distance <= 0 or compat_position + target_distance >= channel_position:
|
||||
# Channel version is within the target distance.
|
||||
target_version = channel_version
|
||||
target_commit = channel_commit
|
||||
target_position = channel_position
|
||||
target_date = channel_date
|
||||
else:
|
||||
# Find an intermediary version that's within the target distance.
|
||||
target_position = compat_position + target_distance
|
||||
target_commit = get_chromium_main_commit(target_position)
|
||||
versions = get_chromium_versions(target_commit)
|
||||
if len(versions) > 0:
|
||||
target_version = 'refs/tags/' + versions[0]
|
||||
# Closest version may not align with the target position, so adjust the
|
||||
# commit and position to match.
|
||||
target_commit = get_git_hash(chromium_src_dir, target_version)
|
||||
target_position = get_chromium_main_position(target_commit)
|
||||
else:
|
||||
target_version = target_commit
|
||||
target_date = get_git_date(chromium_src_dir, target_commit)
|
||||
|
||||
msg("")
|
||||
msg("Computed Chromium update for %s %s at distance %d" % (os, channel,
|
||||
target_distance))
|
||||
msg("Compat: %s %s %s (#%d)" % (compat_date, compat_version, compat_commit,
|
||||
compat_position))
|
||||
msg("Target: %s %s %s (#%d)" % (target_date, target_version, target_commit,
|
||||
target_position))
|
||||
msg("Channel: %s %s %s (#%d)" % (channel_date, channel_version,
|
||||
channel_commit, channel_position))
|
||||
msg("")
|
||||
|
||||
return target_version
|
||||
|
||||
|
||||
def get_build_directory_name(is_debug):
|
||||
build_dir = ('Debug' if is_debug else 'Release') + '_'
|
||||
|
||||
@ -645,16 +517,6 @@ parser.add_option('--chromium-checkout', dest='chromiumcheckout',
|
||||
'branch/hash/tag). This overrides the value specified '+\
|
||||
'by CEF in CHROMIUM_BUILD_COMPATIBILITY.txt.',
|
||||
default='')
|
||||
parser.add_option('--chromium-channel', dest='chromiumchannel',
|
||||
help='Chromium channel to check out (canary, dev, beta or '+\
|
||||
'stable). This overrides the value specified by CEF '+\
|
||||
'in CHROMIUM_BUILD_COMPATIBILITY.txt.',
|
||||
default='')
|
||||
parser.add_option('--chromium-channel-distance', dest='chromiumchanneldistance',
|
||||
help='The target number of commits to step in the '+\
|
||||
'channel, or 0 to use the newest channel version. '+\
|
||||
'Used in combination with --chromium-channel.',
|
||||
default='')
|
||||
|
||||
# Miscellaneous options.
|
||||
parser.add_option(
|
||||
@ -950,8 +812,7 @@ if (options.nochromiumupdate and options.forceupdate) or \
|
||||
(options.nocefupdate and options.forceupdate) or \
|
||||
(options.nobuild and options.forcebuild) or \
|
||||
(options.nodistrib and options.forcedistrib) or \
|
||||
((options.forceclean or options.forcecleandeps) and options.fastupdate) or \
|
||||
(options.chromiumcheckout and options.chromiumchannel):
|
||||
((options.forceclean or options.forcecleandeps) and options.fastupdate):
|
||||
print("Invalid combination of options.")
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit(1)
|
||||
@ -1320,11 +1181,6 @@ if not options.nochromiumupdate and os.path.exists(chromium_src_dir):
|
||||
chromium_compat_version = build_compat_versions['chromium_checkout']
|
||||
if len(options.chromiumcheckout) > 0:
|
||||
chromium_checkout = options.chromiumcheckout
|
||||
elif len(options.chromiumchannel) > 0:
|
||||
target_distance = int(options.chromiumchanneldistance
|
||||
) if len(options.chromiumchanneldistance) > 0 else 0
|
||||
chromium_checkout = get_chromium_target_version(
|
||||
channel=options.chromiumchannel, target_distance=target_distance)
|
||||
else:
|
||||
chromium_checkout = chromium_compat_version
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user