Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 """Presubmit script for FFmpeg repository. | |
| 6 | |
| 7 Does the following: | |
| 8 - Displays a message indicating that all changes must be pushed to SVN. | |
| 9 - Prevents changes inside the git-svn and svn repositories. | |
| 10 - Warns users when a change is made without updating the README file. | |
| 11 """ | |
| 12 | |
| 13 import re | |
| 14 import subprocess | |
| 15 | |
| 16 | |
| 17 # Setup some basic ANSI colors. | |
| 18 BOLD_RED = '\033[1;31m' | |
| 19 BOLD_BLUE = '\033[1;34m' | |
| 20 | |
| 21 | |
| 22 def Color(color, string): | |
| 23 return ''.join([color, string, '\033[m']) | |
| 24 | |
| 25 | |
| 26 def _CheckForMainRepository(input_api, output_api): | |
| 27 """Ensure no commits are allowed to the Subversion repository.""" | |
| 28 try: | |
| 29 stdout = subprocess.Popen('git config --get remote.origin.url', shell=True, | |
| 30 cwd=input_api.PresubmitLocalPath(), | |
| 31 stdout=subprocess.PIPE).communicate()[0] | |
| 32 if 'chromium/third_party/ffmpeg.git' in stdout: | |
| 33 return [] | |
| 34 except Exception, e: | |
| 35 # Not everyone has a working Git configuration, so print the exception text | |
| 36 # and move on. | |
| 37 print e | |
| 38 | |
| 39 return [output_api.PresubmitError('\n'.join([ | |
| 40 'Commits to the FFmpeg repository must be made through Git. The easiest', | |
|
Ami GONE FROM CHROMIUM
2012/02/22 01:22:00
Get scherkus@' approval of this; his workflow is b
DaleCurtis
2012/02/22 20:15:13
+scherkus.
| |
| 41 'way to do this is to switch to using NewGit:\n', | |
| 42 ' http://code.google.com/p/chromium/wiki/UsingNewGit\n', | |
| 43 'Alternatively, you can clone the repository directly using:\n', | |
| 44 ' git clone http://git.chromium.org/chromium/third_party/ffmpeg.git']))] | |
| 45 | |
| 46 | |
| 47 def _WarnAboutManualSteps(): | |
| 48 """Warn about the manual steps required for rolling the FFmpeg repository.""" | |
| 49 print Color(BOLD_RED, '[ WARNING ]'.center(70, '*')) | |
|
Ami GONE FROM CHROMIUM
2012/02/22 01:22:00
Snazzy!
Ami GONE FROM CHROMIUM
2012/02/22 01:22:00
I don't like scripts that always WARN; it has a de
DaleCurtis
2012/02/22 20:15:13
Done.
| |
| 50 print Color( | |
| 51 BOLD_BLUE, '\n'.join([ | |
| 52 'Updates to FFmpeg require the following additional manual steps:', | |
| 53 ' - Rebuild and commit of Chrome and Chromium Windows DLLs.', | |
| 54 ' - Push of new sources from Git to Subversion. See sync_svn.py.', | |
| 55 ' - Internal and external DEPS roll.', | |
| 56 ' - If new source files were added, generate_gyp.py must be run.\n', | |
| 57 'Please see README.chromium or contact videostack-eng for help.'])) | |
|
Ami GONE FROM CHROMIUM
2012/02/22 01:22:00
videostack-eng is a google-internal list, but this
DaleCurtis
2012/02/22 20:15:13
Done.
| |
| 58 print Color(BOLD_RED, 70 * '*') | |
| 59 | |
| 60 | |
| 61 def _WarnIfReadmeIsUnchanged(input_api, output_api): | |
| 62 """Warn if the README file hasn't been updated with change notes.""" | |
| 63 readme_re = re.compile(r'.*[/\\]chromium[/\\]patches[/\\]README$') | |
| 64 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): | |
| 65 if readme_re.match(f.LocalPath()): | |
| 66 return [] | |
| 67 | |
| 68 return [output_api.PresubmitPromptWarning('\n'.join([ | |
|
Ami GONE FROM CHROMIUM
2012/02/22 01:22:00
Fine as long as this doesn't block CQ submission.
DaleCurtis
2012/02/22 20:15:13
These are OnUpload checks, so as far as I understa
| |
| 69 'FFmpeg changes detected without any update to chromium/patches/README,', | |
| 70 'it\'s good practice to update this file with a note about your changes.' | |
| 71 ]))] | |
| 72 | |
| 73 | |
| 74 def CheckChangeOnUpload(input_api, output_api): | |
| 75 _WarnAboutManualSteps() | |
| 76 results = [] | |
| 77 results.extend(_CheckForMainRepository(input_api, output_api)) | |
| 78 results.extend(_WarnIfReadmeIsUnchanged(input_api, output_api)) | |
| 79 return results | |
| OLD | NEW |