Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: tools/update-deps.py

Issue 648353002: Remove Skia's forked buildbot code (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Address comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/tests/factory_configuration/verify_mapping.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Run this script to update chromium_revision within the buildbot DEPS file.
7 """
8
9 import os
10 import re
11 import subprocess
12
13
14 def GetSvnRevision(file_or_url):
15 """Returns the revision of this file within its Subversion repository
16 (or the latest revision of a given Subversion repository).
17 Raises IOError if unable to find the revision of this file/URL.
18 """
19 command = ['svn', 'info', file_or_url]
20 popen = subprocess.Popen(command, stdout=subprocess.PIPE, shell=False)
21 output = popen.stdout.read()
22 matches = re.findall('Revision: (\d+)$', output, re.MULTILINE)
23 if not matches:
24 raise IOError('could not find revision of file_or_url %s' % file_or_url)
25 return matches[0]
26
27
28 def ReplaceDepsVar(deps_file, variable_name, value):
29 """Replaces the definition of a variable within this DEPS file, and writes
30 the new version of the file out in place of the old one.
31 """
32 with open(deps_file, 'r') as file_handle:
33 contents_old = file_handle.read()
34 contents_new = re.sub(
35 '"%s":.*,' % variable_name,
36 '"%s": "%s",' % (variable_name, value),
37 contents_old)
38 with open(deps_file, 'w') as file_handle:
39 file_handle.write(contents_new)
40
41
42 def Main():
43 # cd to the root directory of this checkout.
44 os.chdir(os.path.join(os.path.dirname(__file__), os.path.pardir))
45
46 # Update chromium_revision in standard DEPS file.
47 chromium_rev = GetSvnRevision('http://src.chromium.org/svn/trunk')
48 ReplaceDepsVar('DEPS', 'chromium_revision', chromium_rev)
49
50
51 if __name__ == '__main__':
52 Main()
OLDNEW
« no previous file with comments | « tools/tests/factory_configuration/verify_mapping.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698