Always specify current OS when syncing Chromium.

Recently, we've hit a rare case of a dependency being
present only below 'unix' and not in the 'android' section
of the DEPS file in Chromium (src/third_party/junit/src).

This exposed a bug in our sync_chromium.py script, which is that
when the --deps flag is passed to gclient sync, _only_ that platform
is processed. That means our Android builders synced with --deps=android
and thus only getting the Android deps, not the 'unix' ones (Linux).
That behavior is different from a regular gclient sync, where both
the current platform's DEPS and the one specified by appending a target_os
variable into .gclient is used.

Ensuring that we pass both the current platform and the optionally specified
DEPS platform into our sync_chromium.py sync, gives us the same behavior
as a regular sync for the special Chromium sync we use.

TESTED=
First:
rm chromium/.last_sync_chromium
Then I ran without this patch and with target_os = ["android"] in .gclient. Verified
that --deps=android was passed.
With this patch, I repeated the above and verified --deps=unix,android was passed.

R=phoglund@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/52379004

Cr-Commit-Position: refs/heads/master@{#9103}
This commit is contained in:
Henrik Kjellander 2015-04-28 16:08:23 +02:00
parent 8786f637b2
commit ae331349c6

View File

@ -35,6 +35,20 @@ SCRIPT_VERSION = 4
ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
CHROMIUM_NO_HISTORY = 'CHROMIUM_NO_HISTORY' CHROMIUM_NO_HISTORY = 'CHROMIUM_NO_HISTORY'
# Duplicated from depot_tools/gclient.py since we cannot depend on that:
DEPS_OS_CHOICES = {
"win32": "win",
"win": "win",
"cygwin": "win",
"darwin": "mac",
"mac": "mac",
"unix": "unix",
"linux": "unix",
"linux2": "unix",
"linux3": "unix",
"android": "android",
}
def _parse_gclient_dict(): def _parse_gclient_dict():
gclient_dict = {} gclient_dict = {}
try: try:
@ -51,7 +65,12 @@ def get_cache_dir():
def get_target_os_list(): def get_target_os_list():
return ','.join(_parse_gclient_dict().get('target_os', [])) # Always add the currently running OS since the --deps option will override
# that if specified:
target_os_list = [DEPS_OS_CHOICES.get(sys.platform, 'unix')]
# Add any target_os entries from .gclient.
target_os_list += _parse_gclient_dict().get('target_os', [])
return ','.join(target_os_list)
def main(): def main():