Skip to content

Commit 8aa1e41

Browse files
Remove root_dir variable from DEPS + enforce rename.
Update DEPS to no longer have the root_dir variable. Add a script that detects if the user have a solution named 'trunk' and explains what needs to be done to change it to 'src'. The reason for this change is that bot_update doesn't support custom_vars in solutions and Chrome infra is trying to get rid of them entirely in the future. The bots are already using a solution named 'src' so they won't run into this error during runhooks. BUG=3534 TESTED=Ran the script with a .gclient containing a solution named 'trunk' and one named 'src'. Also tested the presence of the custom_vars dict and not. [email protected], [email protected] Review URL: https://webrtc-codereview.appspot.com/30619004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7405 4adac7df-926f-26a2-2b94-8c16560cd09d
1 parent fb29395 commit 8aa1e41

File tree

2 files changed

+70
-10
lines changed

2 files changed

+70
-10
lines changed

DEPS

+13-10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
# instead.
55

66
vars = {
7-
# Override root_dir in your .gclient's custom_vars to specify a custom root
8-
# folder name.
9-
"root_dir": "trunk",
107
"extra_gyp_flag": "-Dextra_gyp_flag=0",
118

129
# Use this googlecode_url variable only if there is an internal mirror for it.
@@ -20,16 +17,16 @@ vars = {
2017
deps = {
2118
# When rolling gflags, also update deps/third_party/webrtc/webrtc.DEPS/DEPS
2219
# in Chromium's repo.
23-
Var("root_dir") + "/third_party/gflags/src":
20+
"src/third_party/gflags/src":
2421
(Var("googlecode_url") % "gflags") + "/trunk/src@84",
2522

26-
Var("root_dir") + "/third_party/junit/":
23+
"src/third_party/junit/":
2724
(Var("googlecode_url") % "webrtc") + "/deps/third_party/junit@3367",
2825
}
2926

3027
deps_os = {
3128
"win": {
32-
Var("root_dir") + "/third_party/winsdk_samples/src":
29+
"src/third_party/winsdk_samples/src":
3330
(Var("googlecode_url") % "webrtc") + "/deps/third_party/winsdk_samples_v71@3145",
3431
},
3532
}
@@ -54,18 +51,24 @@ skip_child_includes = [
5451
]
5552

5653
hooks = [
54+
{
55+
# Check for legacy named top-level dir (named 'trunk').
56+
"name": "check_root_dir_name",
57+
"pattern": ".",
58+
"action": ["python", "-u", "src/check_root_dir.py"],
59+
},
5760
{
5861
# Clone chromium and its deps.
5962
"name": "sync chromium",
6063
"pattern": ".",
61-
"action": ["python", "-u", Var("root_dir") + "/sync_chromium.py",
64+
"action": ["python", "-u", "src/sync_chromium.py",
6265
"--target-revision", Var("chromium_revision")],
6366
},
6467
{
6568
# Create links to shared dependencies in Chromium.
6669
"name": "setup_links",
6770
"pattern": ".",
68-
"action": ["python", Var("root_dir") + "/setup_links.py"],
71+
"action": ["python", "src/setup_links.py"],
6972
},
7073
{
7174
# Download test resources, i.e. video and audio files from Google Storage.
@@ -76,13 +79,13 @@ hooks = [
7679
"--num_threads=10",
7780
"--no_auth",
7881
"--bucket", "chromium-webrtc-resources",
79-
Var("root_dir") + "/resources"],
82+
"src/resources"],
8083
},
8184
{
8285
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
8386
"name": "gyp",
8487
"pattern": ".",
85-
"action": ["python", Var("root_dir") + "/webrtc/build/gyp_webrtc",
88+
"action": ["python", "src/webrtc/build/gyp_webrtc",
8689
Var("extra_gyp_flag")],
8790
},
8891
]

check_root_dir.py

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env python
2+
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3+
#
4+
# Use of this source code is governed by a BSD-style license
5+
# that can be found in the LICENSE file in the root of the source
6+
# tree. An additional intellectual property rights grant can be found
7+
# in the file PATENTS. All contributing project authors may
8+
# be found in the AUTHORS file in the root of the source tree.
9+
10+
"""Checks for legacy root directory and instructs the user how to upgrade."""
11+
12+
import os
13+
import sys
14+
15+
SOLUTION_ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),
16+
os.pardir)
17+
MESSAGE = """\
18+
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
19+
A C T I O N R E Q I R E D
20+
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
21+
22+
It looks like you have a legacy checkout where the solution's top-level
23+
directory is named 'trunk'. From now on, it must be named 'src'.
24+
25+
What you need to do is to:
26+
27+
1. Edit your .gclient file and change the solution name from 'trunk' to 'src'
28+
2. Rename your 'trunk' directory to 'src'
29+
3. Re-run gclient sync (or gclient runhooks)"""
30+
31+
32+
def main():
33+
gclient_filename = os.path.join(SOLUTION_ROOT_DIR, '.gclient')
34+
config_dict = {}
35+
try:
36+
with open(gclient_filename, 'rb') as gclient_file:
37+
exec(gclient_file, config_dict)
38+
for solution in config_dict.get('solutions', []):
39+
if solution['name'] == 'trunk':
40+
print MESSAGE
41+
if solution.get('custom_vars', {}).get('root_dir'):
42+
print ('4. Optional: Remove your "root_dir" entry from the '
43+
'custom_vars dictionary of the solution.')
44+
45+
# Remove the gclient cache file to avoid an error on the next sync.
46+
entries_file = os.path.join(SOLUTION_ROOT_DIR, '.gclient_entries')
47+
if os.path.exists(entries_file):
48+
os.unlink(entries_file)
49+
return 1
50+
return 0
51+
except Exception as e:
52+
print >> sys.stderr, "Error while parsing .gclient: ", e
53+
return 1
54+
55+
56+
if __name__ == '__main__':
57+
sys.exit(main())

0 commit comments

Comments
 (0)