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

Side by Side Diff: webkit/build/webkit_version.py

Issue 6267010: lastchange: handle the git-but-not-git-svn case (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« build/util/lastchange.py ('K') | « build/util/lastchange.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
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 '''Reads the Webkit Version.xcconfig file looking for MAJOR_VERSION and 6 '''Reads the Webkit Version.xcconfig file looking for MAJOR_VERSION and
7 MINOR_VERSION, emitting them into a webkit_version.h header file as 7 MINOR_VERSION, emitting them into a webkit_version.h header file as
8 WEBKIT_MAJOR_VERSION and WEBKIT_MINOR_VERSION macros. 8 WEBKIT_MAJOR_VERSION and WEBKIT_MINOR_VERSION macros.
9 ''' 9 '''
10 10
(...skipping 27 matching lines...) Expand all
38 minor = int(match.group(1)) 38 minor = int(match.group(1))
39 continue 39 continue
40 assert(major >= 0 and minor >= 0) 40 assert(major >= 0 and minor >= 0)
41 return (major, minor) 41 return (major, minor)
42 42
43 def GetWebKitRevision(webkit_dir, version_file): 43 def GetWebKitRevision(webkit_dir, version_file):
44 """Get the WebKit revision, in the form 'trunk@1234'.""" 44 """Get the WebKit revision, in the form 'trunk@1234'."""
45 45
46 # "svn info" tells us what we want, but third_party/WebKit does *not* 46 # "svn info" tells us what we want, but third_party/WebKit does *not*
47 # point at the upstream repo. So instead we run svn info on the directory 47 # point at the upstream repo. So instead we run svn info on the directory
48 # containing the versioning file (which is some subdirectory of WebKit), 48 # containing the versioning file (which is some subdirectory of WebKit).
49 # then strip that path back off of the resulting URL.
50 version_file_dir = os.path.dirname(version_file) 49 version_file_dir = os.path.dirname(version_file)
51 version_info = lastchange.FetchVersionInfo( 50 version_info = lastchange.FetchVersionInfo(
52 default_lastchange=None, 51 default_lastchange=None,
53 directory=os.path.join(webkit_dir, version_file_dir)) 52 directory=os.path.join(webkit_dir, version_file_dir))
54 53
55 # Now compute the real WebKit URL by stripping off the version file 54 if (version_info.url.startswith(version_info.root) and
56 # directory from the URL we get out of version_info. 55 version_info.url.endswith(version_file_dir)):
57 # Further, we want to strip off the "http://svn..." from the left. 56 # Now compute the real WebKit URL by stripping off the version file
58 # This is the root URL from the repository. 57 # directory from the URL we get out of version_info.
59 assert version_info.url.startswith(version_info.root) 58 # Further, we want to strip off the "http://svn..." from the left.
60 assert version_info.url.endswith(version_file_dir) 59 # This is the root URL from the repository.
61 webkit_url = version_info.url[len(version_info.root):-len(version_file_dir)] 60 webkit_url = version_info.url[len(version_info.root):-len(version_file_dir)]
62 webkit_url = webkit_url.strip('/') 61 webkit_url = webkit_url.strip('/')
62 else:
63 # The data isn't as we expect: perhaps they're using git without svn?
64 # Just dump the output directly.
65 webkit_url = version_info.url
63 66
64 return "%s@%s" % (webkit_url, version_info.revision) 67 return "%s@%s" % (webkit_url, version_info.revision)
65 68
66 69
67 def EmitVersionHeader(webkit_dir, version_file, output_dir): 70 def EmitVersionHeader(webkit_dir, version_file, output_dir):
68 '''Given webkit's version file, emit a header file that we can use from 71 '''Given webkit's version file, emit a header file that we can use from
69 within webkit_glue.cc. 72 within webkit_glue.cc.
70 ''' 73 '''
71 74
72 # See .gypi file for discussion of this workaround for the version file. 75 # See .gypi file for discussion of this workaround for the version file.
(...skipping 17 matching lines...) Expand all
90 f.close() 93 f.close()
91 94
92 def main(): 95 def main():
93 EmitVersionHeader(*sys.argv[1:]) 96 EmitVersionHeader(*sys.argv[1:])
94 97
95 98
96 if __name__ == "__main__": 99 if __name__ == "__main__":
97 main() 100 main()
98 101
99 102
OLDNEW
« build/util/lastchange.py ('K') | « build/util/lastchange.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698