mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02: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:
@ -5,7 +5,6 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
|
||||||
from io import open
|
from io import open
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import os
|
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'
|
cef_git_url = 'https://bitbucket.org/chromiumembedded/cef.git'
|
||||||
|
|
||||||
chromium_channel_json_url = 'https://omahaproxy.appspot.com/all.json'
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Global system variables.
|
# Global system variables.
|
||||||
##
|
##
|
||||||
@ -159,16 +156,6 @@ def get_git_hash(path, branch):
|
|||||||
return 'Unknown'
|
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):
|
def get_git_url(path):
|
||||||
""" Returns the origin url for the specified path. """
|
""" Returns the origin url for the specified path. """
|
||||||
cmd = "%s config --get remote.origin.url" % (git_exe)
|
cmd = "%s config --get remote.origin.url" % (git_exe)
|
||||||
@ -326,49 +313,6 @@ def onerror(func, path, exc_info):
|
|||||||
raise
|
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):
|
def get_chromium_main_position(commit):
|
||||||
""" Returns the closest main position for the specified Chromium commit. """
|
""" Returns the closest main position for the specified Chromium commit. """
|
||||||
# Using -2 because a "Publish DEPS" commit which does not have a master
|
# 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
|
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():
|
def get_build_compat_versions():
|
||||||
""" Returns the compatible Chromium and (optionally) depot_tools versions
|
""" Returns the compatible Chromium and (optionally) depot_tools versions
|
||||||
specified by the CEF checkout. """
|
specified by the CEF checkout. """
|
||||||
@ -416,68 +350,6 @@ def get_build_compat_versions():
|
|||||||
return config
|
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):
|
def get_build_directory_name(is_debug):
|
||||||
build_dir = ('Debug' if is_debug else 'Release') + '_'
|
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 '+\
|
'branch/hash/tag). This overrides the value specified '+\
|
||||||
'by CEF in CHROMIUM_BUILD_COMPATIBILITY.txt.',
|
'by CEF in CHROMIUM_BUILD_COMPATIBILITY.txt.',
|
||||||
default='')
|
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.
|
# Miscellaneous options.
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
@ -950,8 +812,7 @@ if (options.nochromiumupdate and options.forceupdate) or \
|
|||||||
(options.nocefupdate and options.forceupdate) or \
|
(options.nocefupdate and options.forceupdate) or \
|
||||||
(options.nobuild and options.forcebuild) or \
|
(options.nobuild and options.forcebuild) or \
|
||||||
(options.nodistrib and options.forcedistrib) or \
|
(options.nodistrib and options.forcedistrib) or \
|
||||||
((options.forceclean or options.forcecleandeps) and options.fastupdate) or \
|
((options.forceclean or options.forcecleandeps) and options.fastupdate):
|
||||||
(options.chromiumcheckout and options.chromiumchannel):
|
|
||||||
print("Invalid combination of options.")
|
print("Invalid combination of options.")
|
||||||
parser.print_help(sys.stderr)
|
parser.print_help(sys.stderr)
|
||||||
sys.exit(1)
|
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']
|
chromium_compat_version = build_compat_versions['chromium_checkout']
|
||||||
if len(options.chromiumcheckout) > 0:
|
if len(options.chromiumcheckout) > 0:
|
||||||
chromium_checkout = options.chromiumcheckout
|
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:
|
else:
|
||||||
chromium_checkout = chromium_compat_version
|
chromium_checkout = chromium_compat_version
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user