From 390fcb7a202163a22ae13979a0246f66180b2011 Mon Sep 17 00:00:00 2001 From: "henrike@webrtc.org" Date: Mon, 22 Jul 2013 22:32:50 +0000 Subject: [PATCH] Modified the presubmit checks such that difference license templates are checked for in webrtc and talk folder. BUG=2091 R=andrew@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1833004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4381 4adac7df-926f-26a2-2b94-8c16560cd09d --- PRESUBMIT.py | 24 ----------- talk/PRESUBMIT.py | 93 ++++++++++++++++++++++++++++++++++++++++++ talk/app/webrtc/OWNERS | 18 +++----- webrtc/PRESUBMIT.py | 45 ++++++++++++++++++++ 4 files changed, 144 insertions(+), 36 deletions(-) create mode 100644 talk/PRESUBMIT.py create mode 100644 webrtc/PRESUBMIT.py diff --git a/PRESUBMIT.py b/PRESUBMIT.py index d1fb53f20..c8a0213da 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -6,27 +6,6 @@ # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. -def _LicenseHeader(input_api): - """Returns the license header regexp.""" - # Accept any year number from 2011 to the current year - current_year = int(input_api.time.strftime('%Y')) - allowed_years = (str(s) for s in reversed(xrange(2011, current_year + 1))) - years_re = '(' + '|'.join(allowed_years) + ')' - license_header = ( - r'.*? Copyright \(c\) %(year)s The WebRTC project authors\. ' - r'All Rights Reserved\.\n' - r'.*?\n' - r'.*? Use of this source code is governed by a BSD-style license\n' - r'.*? that can be found in the LICENSE file in the root of the source\n' - r'.*? tree\. An additional intellectual property rights grant can be ' - r'found\n' - r'.*? in the file PATENTS\. All contributing project authors may\n' - r'.*? be found in the AUTHORS file in the root of the source tree\.\n' - ) % { - 'year': years_re, - } - return license_header - def _CheckNoIOStreamInHeaders(input_api, output_api): """Checks to make sure no .h files include .""" files = [] @@ -146,8 +125,6 @@ def _CommonChecks(input_api, output_api): results.extend(input_api.canned_checks.CheckChangeTodoHasOwner( input_api, output_api)) results.extend(_CheckApprovedFilesLintClean(input_api, output_api)) - results.extend(input_api.canned_checks.CheckLicense( - input_api, output_api, _LicenseHeader(input_api))) results.extend(_CheckNoIOStreamInHeaders(input_api, output_api)) results.extend(_CheckNoFRIEND_TEST(input_api, output_api)) return results @@ -170,4 +147,3 @@ def CheckChangeOnCommit(input_api, output_api): results.extend(input_api.canned_checks.CheckChangeHasTestField( input_api, output_api)) return results - diff --git a/talk/PRESUBMIT.py b/talk/PRESUBMIT.py new file mode 100644 index 000000000..5fbda4a8f --- /dev/null +++ b/talk/PRESUBMIT.py @@ -0,0 +1,93 @@ +# libjingle +# Copyright 2013 Google Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +def _LicenseHeader(input_api): + """Returns the license header regexp.""" + # Accept any year number from 2011 to the current year + current_year = int(input_api.time.strftime('%Y')) + allowed_years = (str(s) for s in reversed(xrange(2008, current_year + 1))) + years_re = '(' + '|'.join(allowed_years) + ')' + license_header = ( + r'.*? libjingle\n' + r'.*? Copyright %(year)s Google Inc\.\n' + r'.*?\n' + r'.*? Redistribution and use in source and binary forms, with or without' + r'\n' + r'.*? modification, are permitted provided that the following conditions ' + r'are met:\n' + r'.*?\n' + r'.*? 1\. Redistributions of source code must retain the above copyright ' + r'notice,\n' + r'.*? this list of conditions and the following disclaimer\.\n' + r'.*? 2\. Redistributions in binary form must reproduce the above ' + r'copyright notice,\n' + r'.*? this list of conditions and the following disclaimer in the ' + r'documentation\n' + r'.*? and/or other materials provided with the distribution\.\n' + r'.*? 3\. The name of the author may not be used to endorse or promote ' + r'products\n' + r'.*? derived from this software without specific prior written ' + r'permission\.\n' + r'.*?\n' + r'.*? THIS SOFTWARE IS PROVIDED BY THE AUTHOR \`\`AS IS\'\' AND ANY ' + r'EXPRESS OR IMPLIED\n' + r'.*? WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ' + r'OF\n' + r'.*? MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ' + r'DISCLAIMED\. IN NO\n' + r'.*? EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ' + r'INCIDENTAL,\n' + r'.*? SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \(INCLUDING, ' + r'BUT NOT LIMITED TO,\n' + r'.*? PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ' + r'PROFITS;\n' + r'.*? OR BUSINESS INTERRUPTION\) HOWEVER CAUSED AND ON ANY THEORY OF ' + r'LIABILITY,\n' + r'.*? WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \(INCLUDING ' + r'NEGLIGENCE OR\n' + r'.*? OTHERWISE\) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ' + r'EVEN IF\n' + r'.*? ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\.\n' + ) % { + 'year': years_re, + } + return license_header + +def _CommonChecks(input_api, output_api): + """Checks common to both upload and commit.""" + results = [] + results.extend(input_api.canned_checks.CheckLicense( + input_api, output_api, _LicenseHeader(input_api))) + return results + +def CheckChangeOnUpload(input_api, output_api): + results = [] + results.extend(_CommonChecks(input_api, output_api)) + return results + +def CheckChangeOnCommit(input_api, output_api): + results = [] + results.extend(_CommonChecks(input_api, output_api)) + return results diff --git a/talk/app/webrtc/OWNERS b/talk/app/webrtc/OWNERS index 548f6d1ba..40c5bdc14 100644 --- a/talk/app/webrtc/OWNERS +++ b/talk/app/webrtc/OWNERS @@ -1,12 +1,6 @@ -hellner -juberti -mallinath -perkj -ronghuawu -tommi -hellner -juberti -mallinath -perkj -ronghuawu -tommi \ No newline at end of file +hellner@google.com +juberti@google.com +mallinath@google.com +perkj@google.com +ronghuawu@google.com +tommi@google.com \ No newline at end of file diff --git a/webrtc/PRESUBMIT.py b/webrtc/PRESUBMIT.py new file mode 100644 index 000000000..4d4a3d50a --- /dev/null +++ b/webrtc/PRESUBMIT.py @@ -0,0 +1,45 @@ +# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +def _LicenseHeader(input_api): + """Returns the license header regexp.""" + # Accept any year number from 2011 to the current year + current_year = int(input_api.time.strftime('%Y')) + allowed_years = (str(s) for s in reversed(xrange(2011, current_year + 1))) + years_re = '(' + '|'.join(allowed_years) + ')' + license_header = ( + r'.*? Copyright \(c\) %(year)s The WebRTC project authors\. ' + r'All Rights Reserved\.\n' + r'.*?\n' + r'.*? Use of this source code is governed by a BSD-style license\n' + r'.*? that can be found in the LICENSE file in the root of the source\n' + r'.*? tree\. An additional intellectual property rights grant can be ' + r'found\n' + r'.*? in the file PATENTS\. All contributing project authors may\n' + r'.*? be found in the AUTHORS file in the root of the source tree\.\n' + ) % { + 'year': years_re, + } + return license_header + +def _CommonChecks(input_api, output_api): + """Checks common to both upload and commit.""" + results = [] + results.extend(input_api.canned_checks.CheckLicense( + input_api, output_api, _LicenseHeader(input_api))) + return results + +def CheckChangeOnUpload(input_api, output_api): + results = [] + results.extend(_CommonChecks(input_api, output_api)) + return results + +def CheckChangeOnCommit(input_api, output_api): + results = [] + results.extend(_CommonChecks(input_api, output_api)) + return results