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

Unified Diff: chrome/browser/policy/proto/PRESUBMIT.py

Issue 108563005: Move the cloud policy protobufs into the component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/proto/PRESUBMIT.py
diff --git a/chrome/browser/policy/proto/PRESUBMIT.py b/chrome/browser/policy/proto/PRESUBMIT.py
new file mode 100644
index 0000000000000000000000000000000000000000..406e24fcf9d1080c73e0b09e151a784b58d1aa3b
--- /dev/null
+++ b/chrome/browser/policy/proto/PRESUBMIT.py
@@ -0,0 +1,67 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# TODO(joaodasilva): remove this file. http://crbug.com/327345
+
+import itertools
+
+def _CheckPolicyProtobufs(input_api, output_api):
+ # List of pairs (A, B) where A should equal B.
+ file_pairs = [
+ ( 'chrome/browser/policy/proto/chromeos/chrome_device_policy.proto',
+ 'chrome/browser/chromeos/policy/proto/chrome_device_policy.proto' ),
+ ( 'chrome/browser/policy/proto/chromeos/install_attributes.proto',
+ 'chrome/browser/chromeos/policy/proto/install_attributes.proto' ),
+ ( 'chrome/browser/policy/proto/cloud/chrome_extension_policy.proto',
+ 'components/policy/proto/chrome_extension_policy.proto' ),
+ ( 'chrome/browser/policy/proto/cloud/device_management_backend.proto',
+ 'components/policy/proto/device_management_backend.proto' ),
+ ( 'chrome/browser/policy/proto/cloud/device_management_local.proto',
+ 'components/policy/proto/device_management_local.proto' ),
+ ( 'chrome/browser/policy/proto/PRESUBMIT.py',
+ 'components/policy/proto/PRESUBMIT.py' ),
+ ( 'chrome/browser/chromeos/policy/proto/PRESUBMIT.py',
+ 'components/policy/proto/PRESUBMIT.py' ),
+ ]
+
+ root = input_api.change.RepositoryRoot()
+ results = []
+
+ for file_a, file_b in file_pairs:
+ path_a = input_api.os_path.join(root, *file_a.split('/'))
+ path_b = input_api.os_path.join(root, *file_b.split('/'))
+ with open(path_a, 'r') as f_a:
+ content_a = f_a.read()
+ with open(path_b, 'r') as f_b:
+ content_b = f_b.read()
+ if content_a != content_b:
+ # If you get this error then check |file_pairs| and make sure that the
+ # contents of the files in each pair match.
+ results.append(output_api.PresubmitError(
+ '%s must equal %s. This is temporary until http://crbug.com/327345 '
+ 'is fixed.' % (file_a, file_b)))
+
+ # If new files are added then |file_pairs| must be updated.
+ existing = frozenset(itertools.chain(*file_pairs))
+ for f in input_api.AffectedFiles():
+ if f.LocalPath() not in existing:
+ # If you get this error then add an entry for the new files to
+ # |file_pairs|.
+ results.append(output_api.PresubmitError(
+ 'Please add an entry for %s to %s/PRESUBMIT.py' %
+ (f.LocalPath(), input_api.PresubmitLocalPath())))
+
+ return results
+
+
+def _CommonChecks(input_api, output_api):
+ return _CheckPolicyProtobufs(input_api, output_api)
+
+
+def CheckChangeOnUpload(input_api, output_api):
+ return _CommonChecks(input_api, output_api)
+
+
+def CheckChangeOnCommit(input_api, output_api):
+ return _CommonChecks(input_api, output_api)
« no previous file with comments | « chrome/browser/policy/cloud/user_policy_signin_service_android.cc ('k') | chrome/browser/ui/webui/policy_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698