DEPS: Remove migration scripts and use hooks_os.
Remove old scripts for handling migrations from checkouts
with 'trunk' as root dir and the old symlink-approach to
handling dependencies.
Recent development in crbug.com/570091 now allows to
use target OS conditional hooks. This change moves all
Android-specific hooks to that section.
BUG=None
NOTRY=True
Review-Url: https://codereview.webrtc.org/2997123002
Cr-Commit-Position: refs/heads/master@{#19391}
diff --git a/DEPS b/DEPS
index 50d1010..ac0a1bd 100644
--- a/DEPS
+++ b/DEPS
@@ -133,27 +133,9 @@
Var('chromium_git') + '/external/webrtc/deps/third_party/winsdk_samples_v71' + '@' + '2d31a1cbecc86359e6ec041fb9ff6c082babd073',
},
}
-pre_deps_hooks = [
- {
- # Remove any symlinks from before 177567c518b121731e507e9b9c4049c4dc96e4c8.
- # TODO(kjellander): Remove this in March 2017.
- 'name': 'cleanup_links',
- 'pattern': '.',
- 'action': ['python', 'src/cleanup_links.py'],
- },
-]
+
hooks = [
{
- # Check for legacy named top-level dir (named 'trunk').
- 'name': 'check_root_dir_name',
- 'pattern': '.',
- 'action': ['python','-c',
- ('import os,sys;'
- 'script = os.path.join("trunk","check_root_dir.py");'
- '_ = os.system("%s %s" % (sys.executable,script)) '
- 'if os.path.exists(script) else 0')],
- },
- {
# This clobbers when necessary (based on get_landmines.py). It should be
# an early hook but it will need to be run after syncing Chromium and
# setting up the links, so the script actually exists.
@@ -179,181 +161,6 @@
'--disable',
],
},
- # Android dependencies. Many are downloaded using Google Storage these days.
- # They're copied from https://cs.chromium.org/chromium/src/DEPS for all
- # such dependencies we share with Chromium.
- {
- # This downloads SDK extras and puts them in the
- # third_party/android_tools/sdk/extras directory.
- 'name': 'sdkextras',
- 'pattern': '.',
- # When adding a new sdk extras package to download, add the package
- # directory and zip file to .gitignore in third_party/android_tools.
- 'action': ['python',
- 'src/build/android/play_services/update.py',
- 'download'
- ],
- },
- {
- 'name': 'intellij',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-intellij',
- '-l', 'third_party/intellij'
- ],
- },
- {
- 'name': 'javax_inject',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-javax-inject',
- '-l', 'third_party/javax_inject'
- ],
- },
- {
- 'name': 'hamcrest',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-hamcrest',
- '-l', 'third_party/hamcrest'
- ],
- },
- {
- 'name': 'guava',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-guava',
- '-l', 'third_party/guava'
- ],
- },
- {
- 'name': 'android_support_test_runner',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-android-support-test-runner',
- '-l', 'third_party/android_support_test_runner'
- ],
- },
- {
- 'name': 'byte_buddy',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-byte-buddy',
- '-l', 'third_party/byte_buddy'
- ],
- },
- {
- 'name': 'espresso',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-espresso',
- '-l', 'third_party/espresso'
- ],
- },
- {
- 'name': 'robolectric_libs',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-robolectric',
- '-l', 'third_party/robolectric'
- ],
- },
- {
- 'name': 'apache_velocity',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-apache-velocity',
- '-l', 'third_party/apache_velocity'
- ],
- },
- {
- 'name': 'ow2_asm',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-ow2-asm',
- '-l', 'third_party/ow2_asm'
- ],
- },
- {
- 'name': 'icu4j',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-icu4j',
- '-l', 'third_party/icu4j'
- ],
- },
- {
- 'name': 'accessibility_test_framework',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-accessibility-test-framework',
- '-l', 'third_party/accessibility_test_framework'
- ],
- },
- {
- 'name': 'bouncycastle',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-bouncycastle',
- '-l', 'third_party/bouncycastle'
- ],
- },
- {
- 'name': 'sqlite4java',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-sqlite4java',
- '-l', 'third_party/sqlite4java'
- ],
- },
- {
- 'name': 'xstream',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-robolectric',
- '-l', 'third_party/xstream'
- ],
- },
- {
- 'name': 'objenesis',
- 'pattern': '.',
- 'action': ['python',
- 'src/build/android/update_deps/update_third_party_deps.py',
- 'download',
- '-b', 'chromium-objenesis',
- '-l', 'third_party/objenesis'
- ],
- },
{
# Downloads the current stable linux sysroot to build/linux/ if needed.
# This sysroot updates at about the same rate that the chrome build deps
@@ -530,8 +337,126 @@
'src/resources'],
},
]
+
+# Note: These are keyed off target os, not host os. So don't move things here
+# that depend on the target os.
hooks_os = {
'android': [
+ # Android dependencies. Many are downloaded using Google Storage these days.
+ # They're copied from https://cs.chromium.org/chromium/src/DEPS for all
+ # such dependencies we share with Chromium.
+ {
+ # This downloads SDK extras and puts them in the
+ # third_party/android_tools/sdk/extras directory.
+ 'name': 'sdkextras',
+ 'pattern': '.',
+ # When adding a new sdk extras package to download, add the package
+ # directory and zip file to .gitignore in third_party/android_tools.
+ 'action': ['python',
+ 'src/build/android/play_services/update.py',
+ 'download'
+ ],
+ },
+ {
+ 'name': 'intellij',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-intellij',
+ '-l', 'third_party/intellij'
+ ],
+ },
+ {
+ 'name': 'javax_inject',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-javax-inject',
+ '-l', 'third_party/javax_inject'
+ ],
+ },
+ {
+ 'name': 'hamcrest',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-hamcrest',
+ '-l', 'third_party/hamcrest'
+ ],
+ },
+ {
+ 'name': 'guava',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-guava',
+ '-l', 'third_party/guava'
+ ],
+ },
+ {
+ 'name': 'android_support_test_runner',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-android-support-test-runner',
+ '-l', 'third_party/android_support_test_runner'
+ ],
+ },
+ {
+ 'name': 'byte_buddy',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-byte-buddy',
+ '-l', 'third_party/byte_buddy'
+ ],
+ },
+ {
+ 'name': 'espresso',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-espresso',
+ '-l', 'third_party/espresso'
+ ],
+ },
+ {
+ 'name': 'robolectric_libs',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-robolectric',
+ '-l', 'third_party/robolectric'
+ ],
+ },
+ {
+ 'name': 'apache_velocity',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-apache-velocity',
+ '-l', 'third_party/apache_velocity'
+ ],
+ },
+ {
+ 'name': 'ow2_asm',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-ow2-asm',
+ '-l', 'third_party/ow2_asm'
+ ],
+ },
{
'name': 'desugar',
'pattern': '.',
@@ -542,6 +467,66 @@
'-l', 'third_party/bazel/desugar'
],
},
+ {
+ 'name': 'icu4j',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-icu4j',
+ '-l', 'third_party/icu4j'
+ ],
+ },
+ {
+ 'name': 'accessibility_test_framework',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-accessibility-test-framework',
+ '-l', 'third_party/accessibility_test_framework'
+ ],
+ },
+ {
+ 'name': 'bouncycastle',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-bouncycastle',
+ '-l', 'third_party/bouncycastle'
+ ],
+ },
+ {
+ 'name': 'sqlite4java',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-sqlite4java',
+ '-l', 'third_party/sqlite4java'
+ ],
+ },
+ {
+ 'name': 'xstream',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-robolectric',
+ '-l', 'third_party/xstream'
+ ],
+ },
+ {
+ 'name': 'objenesis',
+ 'pattern': '.',
+ 'action': ['python',
+ 'src/build/android/update_deps/update_third_party_deps.py',
+ 'download',
+ '-b', 'chromium-objenesis',
+ '-l', 'third_party/objenesis'
+ ],
+ },
],
}
recursedeps = [
diff --git a/check_root_dir.py b/check_root_dir.py
deleted file mode 100755
index 57a6e6d..0000000
--- a/check_root_dir.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS. All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-"""Checks for legacy root directory and instructs the user how to upgrade."""
-
-import os
-import sys
-
-SOLUTION_ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),
- os.pardir)
-MESSAGE = """\
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- A C T I O N R E Q I R E D
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-
-It looks like you have a legacy checkout where the solution's top-level
-directory is named 'trunk'. From now on, it must be named 'src'.
-
-What you need to do is to:
-
-1. Edit your .gclient file and change the solution name from 'trunk' to 'src'
-2. Rename your 'trunk' directory to 'src'
-3. Re-run gclient sync (or gclient runhooks)"""
-
-
-def main():
- gclient_filename = os.path.join(SOLUTION_ROOT_DIR, '.gclient')
- config_dict = {}
- try:
- with open(gclient_filename, 'rb') as gclient_file:
- exec(gclient_file, config_dict)
- for solution in config_dict.get('solutions', []):
- if solution['name'] == 'trunk':
- print MESSAGE
- if solution.get('custom_vars', {}).get('root_dir'):
- print ('4. Optional: Remove your "root_dir" entry from the '
- 'custom_vars dictionary of the solution.')
-
- # Remove the gclient cache file to avoid an error on the next sync.
- entries_file = os.path.join(SOLUTION_ROOT_DIR, '.gclient_entries')
- if os.path.exists(entries_file):
- os.unlink(entries_file)
- return 1
- return 0
- except Exception as e:
- print >> sys.stderr, "Error while parsing .gclient: ", e
- return 1
-
-
-if __name__ == '__main__':
- sys.exit(main())
diff --git a/cleanup_links.py b/cleanup_links.py
deleted file mode 100755
index 9dafda7..0000000
--- a/cleanup_links.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS. All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-"""Script to cleanup symlinks created from setup_links.py.
-
-Before 177567c518b121731e507e9b9c4049c4dc96e4c8 (#15754) we had a Chromium
-checkout which we created symlinks into. In order to do clean syncs after
-landing that change, this script cleans up any old symlinks, avoiding annoying
-manual cleanup needed in order to complete gclient sync.
-"""
-
-import logging
-import optparse
-import os
-import shelve
-import subprocess
-import sys
-
-
-ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
-LINKS_DB = 'links'
-
-# Version management to make future upgrades/downgrades easier to support.
-SCHEMA_VERSION = 1
-
-class WebRTCLinkSetup(object):
- def __init__(self, links_db, dry_run=False):
- self._dry_run = dry_run
- self._links_db = links_db
-
- def CleanupLinks(self):
- logging.debug('CleanupLinks')
- for source, link_path in self._links_db.iteritems():
- if source == 'SCHEMA_VERSION':
- continue
- if os.path.islink(link_path) or sys.platform.startswith('win'):
- # os.path.islink() always returns false on Windows
- # See http://bugs.python.org/issue13143.
- logging.debug('Removing link to %s at %s', source, link_path)
- if not self._dry_run:
- if os.path.exists(link_path):
- if sys.platform.startswith('win') and os.path.isdir(link_path):
- subprocess.check_call(['rmdir', '/q', '/s', link_path],
- shell=True)
- else:
- os.remove(link_path)
- del self._links_db[source]
-
-
-def _InitializeDatabase(filename):
- links_database = shelve.open(filename)
- # Wipe the database if this version of the script ends up looking at a
- # newer (future) version of the links db, just to be sure.
- version = links_database.get('SCHEMA_VERSION')
- if version and version != SCHEMA_VERSION:
- logging.info('Found database with schema version %s while this script only '
- 'supports %s. Wiping previous database contents.', version,
- SCHEMA_VERSION)
- links_database.clear()
- links_database['SCHEMA_VERSION'] = SCHEMA_VERSION
- return links_database
-
-
-def main():
- parser = optparse.OptionParser()
- parser.add_option('-d', '--dry-run', action='store_true', default=False,
- help='Print what would be done, but don\'t perform any '
- 'operations. This will automatically set logging to '
- 'verbose.')
- parser.add_option('-v', '--verbose', action='store_const',
- const=logging.DEBUG, default=logging.INFO,
- help='Print verbose output for debugging.')
- options, _ = parser.parse_args()
-
- if options.dry_run:
- options.verbose = logging.DEBUG
- logging.basicConfig(format='%(message)s', level=options.verbose)
-
- # Work from the root directory of the checkout.
- script_dir = os.path.dirname(os.path.abspath(__file__))
- os.chdir(script_dir)
-
- # The database file gets .db appended on some platforms.
- db_filenames = [LINKS_DB, LINKS_DB + '.db']
- if any(os.path.isfile(f) for f in db_filenames):
- links_database = _InitializeDatabase(LINKS_DB)
- try:
- symlink_creator = WebRTCLinkSetup(links_database, options.dry_run)
- symlink_creator.CleanupLinks()
- finally:
- for f in db_filenames:
- if os.path.isfile(f):
- os.remove(f)
- return 0
-
-
-if __name__ == '__main__':
- sys.exit(main())