Skip to content
Newer
Older
100755 682 lines (563 sloc) 27.2 KB
3289dfa @dmose Make it possible invoke "./client.py" rather than "python client.py" …
dmose authored
1 #!/usr/bin/env python
d9160e1 Bug 757018 - upgrade license to MPL 2.
Gervase Markham authored
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
6
b9c95a1 @Callek Comment and correctness nit for Bug 601207, f=sgautherie, a=Callek fo…
Callek authored
7 # Warning, this file must be compatible with Python 2.4, for our
8 # various tools, such as http://mxr.mozilla.org/ see-also: Bug 601207
9
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
10 # Repo Defaults
11 # 'REV' controls the default rev for All the various repo's
12 # Define x_REV to override. Where x can be one of:
eacb4f4 Bug 506601 - Transition LDAP SDKs to Mercurial - now pull the LDAP c-…
Mark Banner authored
13 # "COMM", "MOZILLA", "CHATZILLA", "INSPECTOR", "VENKMAN", "LDAPSDKS"
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
14 DEFAULTS = {
15 # Global Default Revision
16 'REV': "default",
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
17
eacb4f4 Bug 506601 - Transition LDAP SDKs to Mercurial - now pull the LDAP c-…
Mark Banner authored
18 # LDAPSDKS
19 'LDAPSDKS_REPO': 'http://hg.mozilla.org/projects/ldap-sdks/',
2f4205e Bug 720328 - Update LDAP c-sdk to LDAPCSDK_6_0_7D_RTM - Pull in build…
Mark Banner authored
20 'LDAPSDKS_REV': 'LDAPCSDK_6_0_7D_RTM',
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
21
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
22 # URL of the default hg repository to clone for ChatZilla.
23 'CHATZILLA_REPO': 'http://hg.mozilla.org/chatzilla/',
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
24
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
25 # URL of the default hg repository to clone for DOM Inspector.
26 'INSPECTOR_REPO': 'http://hg.mozilla.org/dom-inspector/',
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
27
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
28 # URL of the default hg repository to clone for Venkman.
29 'VENKMAN_REPO': 'http://hg.mozilla.org/venkman/',
30
31 # URL of the default hg repository to clone for Mozilla.
32 'MOZILLA_REPO': 'http://hg.mozilla.org/mozilla-central/',
33 }
34
c79d494 @gozer-mozillamessaging Bug 661267 - Add --tinderbox-print to client.py to output hg revision…
gozer-mozillamessaging authored
35 REPO_SHORT_NAMES = {
36 'mozilla-central': 'moz',
37 'dom-inspector': 'dom',
38 'ldap-sdks': 'ldap',
39 }
40
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
41 def get_DEFAULT_tag(index):
42 if index in DEFAULTS:
43 return DEFAULTS[index]
44 else:
45 return DEFAULTS['REV']
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
46
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
47 # The set of defaults below relate to the current switching mechanism between
48 # trunk or branches and back again if it is required.
49
50 # The current version expected in the .treestate file for nothing to happen.
51 # This reflects the "[treestate] src_update_version = ..." value.
52 #
53 # src_update_version values:
54 # '1' : mozilla/ may have been moved to mozilla-1.9.1 (or kept the same
55 # depending on set-up).
56 # '2' : mozilla/ may have been moved back to mozilla-central.
57 CURRENT_TREESTATE_VERSION = '2'
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
58 # REGEX to match against, $1 should refer to protocol scheme
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
59 SWITCH_MOZILLA_REPO_REGEXP = '(ssh|http|https):\/\/hg\.mozilla\.org\/releases/mozilla-1.9.1\/?$'
60 # The location to back-up the existing mozilla repo to, e.g. ".mozilla-trunk"
61 # or ".mozilla-1.9.1".
62 SWITCH_MOZILLA_REPO_BACKUP_LOCATION = ".mozilla-1.9.1"
63 # This is the potential location for a repository from the last time we
64 # switched. Can be blank for no effect.
65 SWITCH_MOZILLA_REPO_OLD_REPO_LOCATION = ".mozilla-trunk"
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
66 # This should be the same as DEFAULTS['MOZILLA_REPO'] but using %s instead of http
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
67 # for the scheme.
68 SWITCH_MOZILLA_REPO_REPLACE = '%s://hg.mozilla.org/mozilla-central/'
69 SWITCH_MOZILLA_BASE_REV = "GECKO_1_9_1_BASE"
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
70
cb67f77 @Callek Bug 537571, client.py should error out early if wrong python version
Callek authored
71 import sys
21af357 @Callek Backed out changeset 25e697e42d9a/Bug 599743
Callek authored
72 # Test Python Version. 2.4 required for `import subprocess`
cb67f77 @Callek Bug 537571, client.py should error out early if wrong python version
Callek authored
73 pyver = sys.version_info
21af357 @Callek Backed out changeset 25e697e42d9a/Bug 599743
Callek authored
74 if pyver[0] <= 1 or (pyver[0] == 2 and pyver[1] < 4):
75 sys.exit("ERROR: Python 2.4 or newer required")
2929b6b Bug 537571 - client.py should error out early if wrong python version;
Serge Gautherie authored
76 elif pyver[0] >= 3:
ab281ed @Callek Bug 601649 - Client.py doesn't work with python3, Use a better error …
Callek authored
77 # Python series 3 will syntax error here, Hack needed per Bug 601649c#8
78 print "ERROR: Python series 3 is not supported, use series 2 >= 2.4"
79 sys.exit() # Do an explicit sys.exit for code clarity.
cb67f77 @Callek Bug 537571, client.py should error out early if wrong python version
Callek authored
80 del pyver
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
81
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
82 import os
83 import datetime
0376e15 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
84 from optparse import OptionParser, OptionValueError
4d39e40 Bug 631597 - Prototype the "Canary" system for Thunderbird. r=standard8
John Hopkins authored
85 import urllib2
86 import re
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
87
88 topsrcdir = os.path.dirname(__file__)
89 if topsrcdir == '':
90 topsrcdir = '.'
91
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
92 TREE_STATE_FILE = os.path.join(topsrcdir, '.treestate')
93
21af357 @Callek Backed out changeset 25e697e42d9a/Bug 599743
Callek authored
94 try:
95 from subprocess import check_call
96 except ImportError:
97 import subprocess
98 def check_call(*popenargs, **kwargs):
99 retcode = subprocess.call(*popenargs, **kwargs)
100 if retcode:
101 cmd = kwargs.get("args")
102 if cmd is None:
103 cmd = popenargs[0]
104 raise Exception("Command '%s' returned non-zero exit status %i" % (cmd, retcode))
105
c79d494 @gozer-mozillamessaging Bug 661267 - Add --tinderbox-print to client.py to output hg revision…
gozer-mozillamessaging authored
106 try:
107 from subprocess import check_output
108 except ImportError:
109 import subprocess
110 def check_output(*popenargs, **kwargs):
111 if 'stdout' in kwargs:
112 raise ValueError('stdout argument not allowed, it will be overridden.')
113 process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
114 output, unused_err = process.communicate()
115 retcode = process.poll()
116 if retcode:
117 cmd = kwargs.get("args")
118 if cmd is None:
119 cmd = popenargs[0]
120 raise CalledProcessError(retcode, cmd, output=output)
121 return output
122
123 def check_call_output(cmd, *args, **kwargs):
124 return check_output(cmd, *args, **kwargs)
125
0376e15 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
126 def check_call_noisy(cmd, retryMax=0, *args, **kwargs):
127 """Wrapper around execute_check_call() to allow retries before failing.
128
129 |cmd|, is the command to try and execute.
130 |retryMax|, is the maximum number of retries to attempt, 0 by default.
131 """
132
133 def execute_check_call(cmd, *args, **kwargs):
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
134 print "Executing command:", cmd
135 check_call(cmd, *args, **kwargs)
136
0376e15 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
137 # By default (= no retries), simply pass the call on.
138 if retryMax == 0:
139 execute_check_call(cmd, *args, **kwargs)
140 return
141
142 # Loop (1 + retryMax) times, at most.
143 for r in range(0, 1 + retryMax):
144 # Add a retry header, not for initial call.
145 if r != 0:
146 print >> sys.stderr, "Retrying previous command: %d of %d time(s)" % (r, retryMax)
147 try:
148 # (Re-)Try the call.
149 execute_check_call(cmd, *args, **kwargs)
150 # If the call succeeded then no more retries.
151 break
152 except:
153 # Print the exception without its traceback.
154 # This traceback starts in the try block, which should be low value.
155 print >> sys.stderr, "The exception was:"
156 sys.excepthook(sys.exc_info()[0], sys.exc_info()[1], None)
157 # Add a blank line.
158 print >> sys.stderr
159 else:
160 # Raise our own exception.
161 # This traceback starts at (= reports) the initial caller line.
162 raise Exception("Command '%s' failed %d time(s). Giving up." % (cmd, retryMax + 1))
163
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
164 def repo_config():
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
165 """Create/Update TREE_STATE_FILE as needed.
166
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
167 switch_mozilla_repo() may be called if the branch that the mozilla repo is
168 on needs changing
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
169 """
170
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
171 import ConfigParser
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
172
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
173 config_version = CURRENT_TREESTATE_VERSION
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
174
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
175 config = ConfigParser.ConfigParser()
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
176
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
177 # If the file exists, see if we need to move to the stable branch.
178 # If it doesn't exist, we assume the user hasn't pulled before (or has
179 # done it manually) and therefore leave his mozilla/ repo as it is.
180 if os.path.exists(TREE_STATE_FILE):
181 config.read([TREE_STATE_FILE])
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
182
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
183 if config.has_option('treestate', 'src_update_version'):
184 config_version = config.get('treestate', 'src_update_version')
185 else:
186 # If src_update_version doesn't exist, assume this to be '1' and
187 # apply the update. This was because the first version of this
188 # migration allowed the existence of the file to equate to '1'.
189 config_version = '1'
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
190
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
191 # Do nothing if the current version is up to date.
192 if config_version < CURRENT_TREESTATE_VERSION:
193 switch_mozilla_repo()
194
195 if not os.path.exists(TREE_STATE_FILE) or config_version < CURRENT_TREESTATE_VERSION:
196 if not config.has_section('treestate'):
197 config.add_section('treestate')
198 config.set('treestate', 'src_update_version', CURRENT_TREESTATE_VERSION)
199
200 # Write this file out
201 f = open(TREE_STATE_FILE, 'w')
202 try:
203 config.write(f)
204 finally:
205 f.close()
206
207 def switch_mozilla_repo():
208 """If the mozilla/ repo matches SWITCH_MOZILLA_REPO_REGEXP then:
209 1) Backup (unused anymore) checkout of mozilla/.
210 2a) If SWITCH_MOZILLA_REPO_OLD_REPO_LOCATION exists, move that to mozilla/.
211 2b) Else clone the backup of mozilla/ up to the SWITCH_MOZILLA_BASE_REV
212 revision and set the pull location to SWITCH_MOZILLA_REPO_REPLACE.
213
214 It is expected that the normal pull/update functions in this script will
215 update the new mozilla/ repo to the latest version.
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
216 """
217
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
218 mozilla_path = os.path.join(topsrcdir, 'mozilla')
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
219 # Do nothing if there is no Mozilla directory.
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
220 if not os.path.exists(mozilla_path):
221 return
222
223 import ConfigParser, re
224 config = ConfigParser.ConfigParser()
bd00c8e Bug 758914 Followup to fix pulling from another directory r=Standard8
Neil Rashbrook authored
225 config_path = os.path.join(mozilla_path, '.hg', 'hgrc')
226 config.read([config_path])
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
227 if not config.has_option('paths', 'default'):
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
228 # Abort, not to get into a possibly inconsistent state.
bd00c8e Bug 758914 Followup to fix pulling from another directory r=Standard8
Neil Rashbrook authored
229 sys.exit("Error: default path in %s is undefined!" % config_path)
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
230
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
231 # Compile the Mozilla repository regex.
232 moz_old_regex = re.compile(SWITCH_MOZILLA_REPO_REGEXP, re.I)
233 match = moz_old_regex.match(config.get('paths', 'default'))
234 # Do nothing if not pulling from the one we're trying to switch from.
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
235 if not match:
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
236 return
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
237
238 config.set('paths', 'default',
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
239 SWITCH_MOZILLA_REPO_REPLACE % match.group(1) )
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
240
241 if config.has_option('paths', 'default-push'):
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
242 match = moz_old_regex.match(config.get('paths', 'default-push'))
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
243 # Do not update this property if not pushing to Mozilla trunk.
244 if match:
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
245 config.set('paths', 'default-push',
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
246 SWITCH_MOZILLA_REPO_REPLACE % match.group(1) )
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
247
4130264 @gozer-mozillamessaging Bug 508955 - Add to client.py --hg-clone-options r=kairo
gozer-mozillamessaging authored
248 hgcloneopts = []
249 if options.hgcloneopts:
250 hgcloneopts = options.hgcloneopts.split()
251
b135b0d Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
252 hgopts = []
253 if options.hgopts:
254 hgopts = options.hgopts.split()
255
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
256 backup_mozilla_path = os.path.join(topsrcdir, SWITCH_MOZILLA_REPO_BACKUP_LOCATION)
257 print "Moving mozilla to " + SWITCH_MOZILLA_REPO_BACKUP_LOCATION + "..."
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
258 try:
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
259 os.rename(mozilla_path, backup_mozilla_path)
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
260 except:
261 # Print the exception without its traceback.
262 sys.excepthook(sys.exc_info()[0], sys.exc_info()[1], None)
263 sys.exit("Error: Mozilla directory renaming failed!")
264
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
265 # Does the user have a pre-existing backup repository?
266 old_backup_repository = os.path.join(topsrcdir, SWITCH_MOZILLA_REPO_OLD_REPO_LOCATION)
267 if SWITCH_MOZILLA_REPO_OLD_REPO_LOCATION != "" and \
268 os.path.exists(old_backup_repository):
269 # Yes, so let's use that
270 print "Moving " + old_backup_repository + " to " + mozilla_path + "..."
271 try:
272 os.rename(old_backup_repository, mozilla_path)
273 except:
274 # Print the exception without its traceback.
275 sys.excepthook(sys.exc_info()[0], sys.exc_info()[1], None)
276 sys.exit("Error: Renaming old backup directory failed! You must recover manually.")
277 # Let's leave the hgrc as it was, so any repo specific config is left
278 # the same.
279 return
280
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
281 # Locally clone common repository history.
bd05761 @gozer-mozillamessaging Bug 508955. Address comment #2 in proper handling of hg clone options…
gozer-mozillamessaging authored
282 check_call_noisy([options.hg, 'clone', '-r', SWITCH_MOZILLA_BASE_REV] + hgcloneopts + hgopts + [backup_mozilla_path, mozilla_path],
0376e15 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
283 retryMax=options.retries)
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
284
cfa7c7e Bug 522445 - "Adjust client.py for handling the creation of the 1.9.1…
Mark Banner authored
285 # Rewrite hgrc for new local mozilla repo based on pre-existing hgrc
3dd6587 @Callek bug 465521 - client.py needs a way to update the default repo for m-c…
Callek authored
286 # but with new values
287 f = open(os.path.join(topsrcdir, 'mozilla', '.hg', 'hgrc'), 'w')
288 try:
289 config.write(f)
290 finally:
291 f.close()
292
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
293 def backup_cvs_extension(extensionName, extensionDir, extensionPath):
294 """Backup (obsolete) cvs checkout of extensionName.
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
295 """
296
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
297 # Do nothing if there is no extensionName cvs directory.
298 if not os.path.exists(os.path.join(extensionPath, 'CVS')):
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
299 return
300
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
301 extensionBackupPath = extensionPath + '-cvs'
302 print "Moving %s to %s-cvs..." % (extensionDir, extensionDir)
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
303 try:
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
304 os.rename(extensionPath, extensionBackupPath)
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
305 except:
306 # Print the exception without its traceback.
307 sys.excepthook(sys.exc_info()[0], sys.exc_info()[1], None)
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
308 sys.exit("Error: %s directory renaming failed!" % extensionName)
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
309
223232c @gozer Bug 688856 - teach comm-central client.mk to use hgtool.py r=Standard…
gozer authored
310 def do_hg_pull(dir, repository, hg, rev, hgtool=None):
b135b0d Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
311 """Clone if the dir doesn't exist, pull if it does.
312 """
313
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
314 fulldir = os.path.join(topsrcdir, dir)
b135b0d Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
315
4130264 @gozer-mozillamessaging Bug 508955 - Add to client.py --hg-clone-options r=kairo
gozer-mozillamessaging authored
316 hgcloneopts = []
317 if options.hgcloneopts:
318 hgcloneopts = options.hgcloneopts.split()
319
b135b0d Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
320 hgopts = []
321 if options.hgopts:
322 hgopts = options.hgopts.split()
0f78eb9 Bug 552955 - Resync' client.py on c-1.9.1 after bug 508955 and bug 53…
Serge Gautherie authored
323
223232c @gozer Bug 688856 - teach comm-central client.mk to use hgtool.py r=Standard…
gozer authored
324 if hgtool:
325 hgtoolcmd = hgtool.split()
4f4f4ec Fix client.py bustage from bug 748158 - I had forgotten to fully take…
Mark Banner authored
326 # We need to strip the trailing slash from the repository url so that the hg tool gets a
327 # url that's consistent with the rest of the build automation.
328 check_call_noisy(['python'] + hgtoolcmd + [repository.rstrip('/'), fulldir], retryMax=options.retries)
223232c @gozer Bug 688856 - teach comm-central client.mk to use hgtool.py r=Standard…
gozer authored
329 elif not os.path.exists(fulldir):
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
330 fulldir = os.path.join(topsrcdir, dir)
4f4f4ec Fix client.py bustage from bug 748158 - I had forgotten to fully take…
Mark Banner authored
331 check_call_noisy([hg, 'clone'] + hgcloneopts + hgopts + [repository, fulldir],
0376e15 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
332 retryMax=options.retries)
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
333 else:
dc5e4f2 Bug 481835 - "client.py should use hg pull without -r tip argument" […
Mark Banner authored
334 cmd = [hg, 'pull', '-R', fulldir] + hgopts
4f4f4ec Fix client.py bustage from bug 748158 - I had forgotten to fully take…
Mark Banner authored
335 if repository is not None:
336 cmd.append(repository)
0376e15 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
337 check_call_noisy(cmd, retryMax=options.retries)
b135b0d Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
338
2652ff3 @Callek Bug 451811, comm-central's client.py needs ability to pull specific r…
Callek authored
339 # update to specific revision
b135b0d Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
340 cmd = [hg, 'update', '-r', rev, '-R', fulldir ] + hgopts
2652ff3 @Callek Bug 451811, comm-central's client.py needs ability to pull specific r…
Callek authored
341 if options.verbose:
b135b0d Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
342 cmd.append('-v')
343 # Explicitly never retry 'hg update': otherwise any merge failures are ignored.
b9bc9f0 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
344 # This command is local: a failure can't be caused by a network error.
b135b0d Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
345 check_call_noisy(cmd, retryMax=0)
346
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
347 check_call([hg, 'parent', '-R', fulldir,
348 '--template=Updated to revision {node}.\n'])
349
c79d494 @gozer-mozillamessaging Bug 661267 - Add --tinderbox-print to client.py to output hg revision…
gozer-mozillamessaging authored
350 if options.tinderbox_print and dir != '.':
351 got_rev = check_call_output([hg, 'parent', '-R', fulldir,
352 '--template={node|short}'])
353
354 url = check_call_output([hg, 'paths', 'default', '-R', fulldir ]).rstrip().rstrip('/')
355 repo_name = url.split('/')[-1]
356 repo_short_name = REPO_SHORT_NAMES.get(repo_name, repo_name)
357
358 print "TinderboxPrint:<a href=%s/rev/%s title='Built from %s revision %s'>%s:%s</a>" % ( url, got_rev, repo_name, got_rev, repo_short_name, got_rev)
359
360
0376e15 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
361 def check_retries_option(option, opt_str, value, parser):
362 if value < 0:
363 raise OptionValueError("%s option value needs to be positive (not '%d')" % (opt_str, value))
364 setattr(parser.values, option.dest, value)
365
81b5097 @gozer-mozillamessaging Bug 591388 - Teach client.py how to apply local patches; r=Standard8
gozer-mozillamessaging authored
366 def do_apply_patch(hg, patch, repo):
367 check_call_noisy([hg,
368 'import',
369 '-R', repo,
370 '-m', "local patch from %s" % patch,
371 '--no-commit', '--force',
372 patch,
373 ],
374 retryMax=0)
375 return
376
377 import glob
378 def do_apply_patches(topsrcdir, hg):
379 prefix_map = {
380 'mozilla': 'mozilla',
381 'chatzilla': os.path.join('mozilla', 'extensions', 'irc'),
382 'inspector': os.path.join('mozilla', 'extensions', 'inspector'),
383 'venkman': os.path.join('mozilla', 'extensions', 'venkman'),
eacb4f4 Bug 506601 - Transition LDAP SDKs to Mercurial - now pull the LDAP c-…
Mark Banner authored
384 'ldap': os.path.join('ldap', 'sdks'),
81b5097 @gozer-mozillamessaging Bug 591388 - Teach client.py how to apply local patches; r=Standard8
gozer-mozillamessaging authored
385 }
386
387 for prefix in prefix_map.keys():
388 prefix_dir = prefix_map.get(prefix)
389 files = glob.glob("%s*.patch" % prefix)
390 files.sort()
391 for file in files:
392 patch = os.path.join(topsrcdir, file)
393 if os.path.exists(patch):
394 do_apply_patch(hg, patch, prefix_dir)
395
0376e15 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
396 o = OptionParser(usage="%prog [options] checkout")
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
397 o.add_option("-m", "--comm-repo", dest="comm_repo",
398 default=None,
399 help="URL of comm (Calendar/Mail/Suite) repository to pull from (default: use hg default in .hg/hgrc)")
400 o.add_option("--skip-comm", dest="skip_comm",
401 action="store_true", default=False,
402 help="Skip pulling the comm (Calendar/Mail/Suite) repository.")
2652ff3 @Callek Bug 451811, comm-central's client.py needs ability to pull specific r…
Callek authored
403 o.add_option("--comm-rev", dest="comm_rev",
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
404 default=None,
8911cec @bhearsum Bug 763769 - Release sanity complains about Thunderbird mozconfigs. r…
bhearsum authored
405 help="Revision of comm (Calendar/Mail/Suite) repository to update to. If not present, COMM_REV from the environment will be used. If that doesn't exist the default is: \"" + get_DEFAULT_tag('COMM_REV') + "\"")
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
406
407 o.add_option("-z", "--mozilla-repo", dest="mozilla_repo",
33f221a Bug 758914 - client.py always pulls from http://hg.mozilla.org/mozill…
Mark Banner authored
408 default=None,
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
409 help="URL of Mozilla repository to pull from (default: use hg default in mozilla/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULTS['MOZILLA_REPO'] + "\".)")
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
410 o.add_option("--skip-mozilla", dest="skip_mozilla",
411 action="store_true", default=False,
412 help="Skip pulling the Mozilla repository.")
2652ff3 @Callek Bug 451811, comm-central's client.py needs ability to pull specific r…
Callek authored
413 o.add_option("--mozilla-rev", dest="mozilla_rev",
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
414 default=None,
8911cec @bhearsum Bug 763769 - Release sanity complains about Thunderbird mozconfigs. r…
bhearsum authored
415 help="Revision of Mozilla repository to update to. If not present, MOZILLA_REV from the environment will be used. If that doesn't exist the default is: \"" + get_DEFAULT_tag('MOZILLA_REV') + "\"")
4d39e40 Bug 631597 - Prototype the "Canary" system for Thunderbird. r=standard8
John Hopkins authored
416 o.add_option("--known-good", dest="known_good",
417 action="store_true", default=False,
418 help="Use the last known-good Mozilla repository revision.")
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
419
99341a7 @Callek Bug 437064 - DOM Inspector should live in its own repository.
Callek authored
420 o.add_option("--inspector-repo", dest="inspector_repo",
421 default=None,
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
422 help="URL of DOM Inspector repository to pull from (default: use hg default in mozilla/extensions/inspector/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULTS['INSPECTOR_REPO'] + "\".)")
99341a7 @Callek Bug 437064 - DOM Inspector should live in its own repository.
Callek authored
423 o.add_option("--skip-inspector", dest="skip_inspector",
424 action="store_true", default=False,
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
425 help="Skip pulling the DOM Inspector repository.")
2652ff3 @Callek Bug 451811, comm-central's client.py needs ability to pull specific r…
Callek authored
426 o.add_option("--inspector-rev", dest="inspector_rev",
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
427 default=None,
428 help="Revision of DOM Inspector repository to update to. Default: \"" + get_DEFAULT_tag('INSPECTOR_REV') + "\"")
99341a7 @Callek Bug 437064 - DOM Inspector should live in its own repository.
Callek authored
429
eacb4f4 Bug 506601 - Transition LDAP SDKs to Mercurial - now pull the LDAP c-…
Mark Banner authored
430 o.add_option("--ldap-repo", dest="ldap_repo",
431 default=None,
432 help="URL of LDAP repository to pull from (default: use hg default in ldap/sdks/.hg/hgrc; or if that file doesn't exist use \"" + DEFAULTS['LDAPSDKS_REPO'] + "\".)")
334708c @Callek Bug 451390, In comm-central <client.py>, add an |options.skip_ldap|
Callek authored
433 o.add_option("--skip-ldap", dest="skip_ldap",
434 action="store_true", default=False,
eacb4f4 Bug 506601 - Transition LDAP SDKs to Mercurial - now pull the LDAP c-…
Mark Banner authored
435 help="Skip pulling the LDAP repository.")
436 o.add_option("--ldap-rev", dest="ldap_rev",
437 default=None,
438 help="Revision of LDAP repository to update to. Default: \"" + get_DEFAULT_tag('LDAPSDKS_REV') + "\"")
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
439
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
440 o.add_option("--chatzilla-repo", dest = "chatzilla_repo",
441 default = None,
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
442 help = "URL of ChatZilla repository to pull from (default: use hg default in mozilla/extensions/irc/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULTS['CHATZILLA_REPO'] + "\".)")
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
443 o.add_option("--skip-chatzilla", dest="skip_chatzilla",
444 action="store_true", default=False,
445 help="Skip pulling the ChatZilla repository.")
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
446 o.add_option("--chatzilla-rev", dest = "chatzilla_rev",
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
447 default = None,
448 help = "Revision of ChatZilla repository to update to. Default: \"" + get_DEFAULT_tag('CHATZILLA_REV') + "\"")
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
449
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
450 o.add_option("--venkman-repo", dest = "venkman_repo",
451 default = None,
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
452 help = "URL of Venkman repository to pull from (default: use hg default in mozilla/extensions/venkman/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULTS['VENKMAN_REPO'] + "\".)")
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
453 o.add_option("--skip-venkman", dest="skip_venkman",
454 action="store_true", default=False,
455 help="Skip pulling the Venkman repository.")
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
456 o.add_option("--venkman-rev", dest = "venkman_rev",
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
457 default = None,
458 help = "Revision of Venkman repository to update to. Default: \"" + get_DEFAULT_tag('VENKMAN_REV') + "\"")
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
459
460 o.add_option("--hg", dest="hg", default=os.environ.get('HG', 'hg'),
461 help="The location of the hg binary")
9edbabd Bug 446604 Provide -v option to client.py to list changed files durin…
Mark Banner authored
462 o.add_option("-v", "--verbose", dest="verbose",
463 action="store_true", default=False,
464 help="Enable verbose output on hg updates")
223232c @gozer Bug 688856 - teach comm-central client.mk to use hgtool.py r=Standard…
gozer authored
465 o.add_option("--hgtool", dest="hgtool",
466 default=None,
467 help="Path to hgtool, if wanted")
84177b5 @gozer-mozillamessaging Bug 458215. Add --hg-options to client.py to pass arbitrary options t…
gozer-mozillamessaging authored
468 o.add_option("--hg-options", dest="hgopts",
469 help="Pass arbitrary options to hg commands (i.e. --debug, --time)")
4130264 @gozer-mozillamessaging Bug 508955 - Add to client.py --hg-clone-options r=kairo
gozer-mozillamessaging authored
470 o.add_option("--hg-clone-options", dest="hgcloneopts",
b135b0d Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
471 help="Pass arbitrary options to hg clone commands (i.e. --uncompressed)")
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
472
0376e15 Bug 538528 - Allow client.py network attempts to restart itself in ca…
Serge Gautherie authored
473 o.add_option("--retries", dest="retries", type="int", metavar="NUM",
474 default=1, help="Number of times to retry a failed command before giving up. (default: 1)",
475 action="callback", callback=check_retries_option)
476
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
477 o.add_option("-r", "--rev", dest = "default_rev",
478 default = None,
479 help = "Revision of all repositories to update to, unless otherwise specified.")
480
81b5097 @gozer-mozillamessaging Bug 591388 - Teach client.py how to apply local patches; r=Standard8
gozer-mozillamessaging authored
481 o.add_option("--apply-patches", dest="apply_patches",
482 action="store_true", default=False,
483 help="Look for and apply local patches (repo*.patch)")
484
c79d494 @gozer-mozillamessaging Bug 661267 - Add --tinderbox-print to client.py to output hg revision…
gozer-mozillamessaging authored
485 o.add_option("--tinderbox-print", dest="tinderbox_print",
486 action="store_true", default=False,
487 help="Print repo revisions for Tinderbox")
488
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
489 def fixup_comm_repo_options(options):
490 """Check options.comm_repo value.
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
491
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
492 options.comm_repo is normally None.
493 This is fine -- our "hg pull" command will omit the repo URL.
494 The exception is the initial checkout, which does an "hg clone".
495 That command requires a repository URL.
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
496 """
497
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
498 if options.comm_repo is None and \
499 not os.path.exists(os.path.join(topsrcdir, '.hg')):
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
500 o.print_help()
501 print
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
502 print "Error: the -m option is required for the initial checkout!"
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
503 sys.exit(2)
504
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
505 if options.comm_rev is None:
8911cec @bhearsum Bug 763769 - Release sanity complains about Thunderbird mozconfigs. r…
bhearsum authored
506 # If we weren't passed an explicit rev, try to find it from the
507 # environment. If that doesn't exist or is empty, grab the default.
508 envRev = os.environ.get("COMM_REV")
509 if envRev:
510 print "Using COMM_REV from environment (%s)" % envRev
511 options.comm_rev = envRev
512 else:
513 options.comm_rev = get_DEFAULT_tag("COMM_REV")
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
514
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
515 def fixup_mozilla_repo_options(options):
516 """Handle special case: initial checkout of Mozilla.
517
518 See fixup_comm_repo_options().
519 """
33f221a Bug 758914 - client.py always pulls from http://hg.mozilla.org/mozill…
Mark Banner authored
520 if options.mozilla_repo is None:
521 if not os.path.exists(os.path.join(topsrcdir, 'mozilla')):
522 options.mozilla_repo = DEFAULTS['MOZILLA_REPO']
523 else:
524 # Fallback to using .hgrc as hgtool/share needs the repo
525 import ConfigParser, re
526 config = ConfigParser.ConfigParser()
bd00c8e Bug 758914 Followup to fix pulling from another directory r=Standard8
Neil Rashbrook authored
527 config_path = os.path.join(topsrcdir, 'mozilla', '.hg', 'hgrc')
528 config.read([config_path])
33f221a Bug 758914 - client.py always pulls from http://hg.mozilla.org/mozill…
Mark Banner authored
529 if not config.has_option('paths', 'default'):
530 # Abort, not to get into a possibly inconsistent state.
bd00c8e Bug 758914 Followup to fix pulling from another directory r=Standard8
Neil Rashbrook authored
531 sys.exit("Error: default path in %s is undefined!" % config_path)
33f221a Bug 758914 - client.py always pulls from http://hg.mozilla.org/mozill…
Mark Banner authored
532
533 options.mozilla_repo = config.get('paths', 'default')
534
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
535 if options.mozilla_rev is None:
8911cec @bhearsum Bug 763769 - Release sanity complains about Thunderbird mozconfigs. r…
bhearsum authored
536 # If we weren't passed an explicit rev, try to find it from the
537 # environment. If that doesn't exist or is empty, grab the default.
538 envRev = os.environ.get("MOZILLA_REV")
539 if envRev:
540 print "Using MOZILLA_REV from environment (%s)" % envRev
541 options.mozilla_rev = envRev
542 else:
543 options.mozilla_rev = get_DEFAULT_tag("MOZILLA_REV")
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
544
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
545 def fixup_chatzilla_repo_options(options):
546 """Handle special case: initial hg checkout of Chatzilla.
547
548 See fixup_comm_repo_options().
549 backup_cvs_extension() is also called.
550 """
551
552 extensionPath = os.path.join(topsrcdir, 'mozilla', 'extensions', 'irc')
553
554 backup_cvs_extension('Chatzilla', 'irc', extensionPath)
555
556 if options.chatzilla_repo is None and not os.path.exists(extensionPath):
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
557 options.chatzilla_repo = DEFAULTS['CHATZILLA_REPO']
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
558
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
559 if options.chatzilla_rev is None:
560 options.chatzilla_rev = get_DEFAULT_tag("CHATZILLA_REV")
561
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
562 def fixup_inspector_repo_options(options):
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
563 """Handle special case: initial checkout of DOM Inspector.
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
564
565 See fixup_comm_repo_options().
566 """
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
567
568 # No cvs backup needed as DOM Inspector was part (and removed from)
569 # Mozilla hg repository.
570 if options.inspector_repo is None and \
571 not os.path.exists(os.path.join(topsrcdir, 'mozilla', 'extensions', 'inspector')):
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
572 options.inspector_repo = DEFAULTS['INSPECTOR_REPO']
99341a7 @Callek Bug 437064 - DOM Inspector should live in its own repository.
Callek authored
573
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
574 if options.inspector_rev is None:
575 options.inspector_rev = get_DEFAULT_tag("INSPECTOR_REV")
576
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
577 def fixup_venkman_repo_options(options):
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
578 """Handle special case: initial hg checkout of Venkman.
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
579
580 See fixup_comm_repo_options().
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
581 backup_cvs_extension() is also called.
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
582 """
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
583
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
584 extensionPath = os.path.join(topsrcdir, 'mozilla', 'extensions', 'venkman')
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
585
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
586 backup_cvs_extension('Venkman', 'venkman', extensionPath)
587
588 if options.venkman_repo is None and not os.path.exists(extensionPath):
bb77714 @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
589 options.venkman_repo = DEFAULTS['VENKMAN_REPO']
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
590
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
591 if options.venkman_rev is None:
592 options.venkman_rev = get_DEFAULT_tag("VENKMAN_REV")
593
eacb4f4 Bug 506601 - Transition LDAP SDKs to Mercurial - now pull the LDAP c-…
Mark Banner authored
594 def fixup_ldap_repo_options(options):
595 """Handle special case: initial checkout of LDAP.
596
597 See fixup_comm_repo_options().
598 """
599
600 # No cvs backup needed as LDAP directory name changed when it moved to hg
601 if options.ldap_repo is None and \
602 not os.path.exists(os.path.join(topsrcdir, 'ldap', 'sdks')):
603 options.ldap_repo = DEFAULTS['LDAPSDKS_REPO']
604
605 if options.ldap_rev is None:
606 options.ldap_rev = get_DEFAULT_tag("LDAPSDKS_REV")
607
4d39e40 Bug 631597 - Prototype the "Canary" system for Thunderbird. r=standard8
John Hopkins authored
608 def get_last_known_good_mozilla_rev():
609 kg_url = "http://build.mozillamessaging.com/buildbot/production/known-good-revisions/mozilla-central.txt"
610 try:
611 rev = urllib2.urlopen(kg_url).read().strip()
612 except IOError, err:
613 sys.exit("Error: could not fetch '%s' (%s)" % (kg_url, err))
614 if re.search(r'^[a-f0-9]+$', rev) and len(rev) == 12:
615 return rev
616 else:
617 sys.exit("Error: invalid contents fetched from %s: '%s'" % (kg_url, rev))
618
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
619 try:
620 (options, (action,)) = o.parse_args()
621 except ValueError:
622 o.print_help()
623 sys.exit(2)
624
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
625 if options.default_rev:
626 # We now wish to override all the DEFAULTS.
627 DEFAULTS['REV'] = options.default_rev
eacb4f4 Bug 506601 - Transition LDAP SDKs to Mercurial - now pull the LDAP c-…
Mark Banner authored
628 for index in ['CHATZILLA', 'INSPECTOR', 'VENKMAN', 'COMM', 'MOZILLA',
629 'LDAPSDKS']:
455dd9b @Callek Bug 556394 - Allow a single option to control tag/revision to pull in…
Callek authored
630 index += "_REV"
631 # Clear the rest from file-defaults
632 if index in DEFAULTS:
633 del DEFAULTS[index]
634
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
635 if action in ('checkout', 'co'):
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
636 # Update Comm repository configuration.
637 repo_config()
638
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
639 if not options.skip_comm:
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
640 fixup_comm_repo_options(options)
2652ff3 @Callek Bug 451811, comm-central's client.py needs ability to pull specific r…
Callek authored
641 do_hg_pull('.', options.comm_repo, options.hg, options.comm_rev)
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
642
643 if not options.skip_mozilla:
4d39e40 Bug 631597 - Prototype the "Canary" system for Thunderbird. r=standard8
John Hopkins authored
644 if options.known_good and options.mozilla_rev is None:
645 print "Fetching last known good mozilla revision"
646 options.mozilla_rev = get_last_known_good_mozilla_rev()
647 print "Setting mozilla_rev to '%s'" % options.mozilla_rev
648
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
649 fixup_mozilla_repo_options(options)
223232c @gozer Bug 688856 - teach comm-central client.mk to use hgtool.py r=Standard…
gozer authored
650 do_hg_pull('mozilla', options.mozilla_repo, options.hg, options.mozilla_rev, options.hgtool)
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
651
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
652 # Check whether destination directory exists for these extensions.
653 if (not options.skip_chatzilla or not options.skip_inspector or \
654 not options.skip_venkman) and \
655 not os.path.exists(os.path.join(topsrcdir, 'mozilla', 'extensions')):
656 # Don't create the directory: Mozilla repository should provide it...
0bc69e7 Bug 484205 - Additional fixes to client.py, after bug 482686; (Cv1) I…
Serge Gautherie authored
657 sys.exit("Error: mozilla/extensions directory does not exist;" + \
658 " ChatZilla, DOM Inspector and/or Venkman cannot be checked out!")
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
659
ffe6fd8 Bug 524682 - comm-central should pull Chatzilla from hg rather than C…
Serge Gautherie authored
660 if not options.skip_chatzilla:
661 fixup_chatzilla_repo_options(options)
662 do_hg_pull(os.path.join('mozilla', 'extensions', 'irc'), options.chatzilla_repo, options.hg, options.chatzilla_rev)
663
99341a7 @Callek Bug 437064 - DOM Inspector should live in its own repository.
Callek authored
664 if not options.skip_inspector:
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
665 fixup_inspector_repo_options(options)
2652ff3 @Callek Bug 451811, comm-central's client.py needs ability to pull specific r…
Callek authored
666 do_hg_pull(os.path.join('mozilla', 'extensions', 'inspector'), options.inspector_repo, options.hg, options.inspector_rev)
99341a7 @Callek Bug 437064 - DOM Inspector should live in its own repository.
Callek authored
667
5e26eee Bug 473827 Remove pulling of wallet from client.py. r=KaiRo
Mark Banner authored
668 if not options.skip_ldap:
eacb4f4 Bug 506601 - Transition LDAP SDKs to Mercurial - now pull the LDAP c-…
Mark Banner authored
669 fixup_ldap_repo_options(options)
670 do_hg_pull(os.path.join('ldap', 'sdks'), options.ldap_repo, options.hg, options.ldap_rev)
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
671
672 if not options.skip_venkman:
868b723 Bug 484205 - Additional fixes to client.py, after bug 482686; (Bv1) 1…
Serge Gautherie authored
673 fixup_venkman_repo_options(options)
94cbff2 Bug 482686 - comm-central should pull Venkman from hg rather than CVS…
Serge Gautherie authored
674 do_hg_pull(os.path.join('mozilla', 'extensions', 'venkman'), options.venkman_repo, options.hg, options.venkman_rev)
81b5097 @gozer-mozillamessaging Bug 591388 - Teach client.py how to apply local patches; r=Standard8
gozer-mozillamessaging authored
675
676 if options.apply_patches:
677 do_apply_patches(topsrcdir, options.hg)
678
77157ac @KaiRo-at bug 444686 - create/adapt build system for comm-central, creating the…
KaiRo-at authored
679 else:
680 o.print_help()
681 sys.exit(2)
Something went wrong with that request. Please try again.