U-Boot: Remove old paths and add checkpatch check to U-Boot commits
This creates a new check called _run_checkpatch_no_tree that will
run checkpatch with the --no-tree option. This option is required
for U-Boot because U-Boot doesn't match the kernel tree.
BUG=None
TEST=Upload new patch for U-Boot with checkpatch violations.
Observe that the upload failed due to violations.
Change-Id: I8a46641fb956bc6cb14fbbf528a7487258ec5afe
Reviewed-on: http://gerrit.chromium.org/gerrit/6403
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index ff951f2..e7e643d 100644
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -219,9 +219,7 @@
def _check_no_tabs(project, commit):
"""Checks there are no unexpanded tabs."""
TAB_OK_PATHS = [
- r"/src/platform/u-boot-config/",
r"/src/third_party/u-boot/",
- r"/src/third_party/u-boot-next/",
r".*\.ebuild$",
r".*\.eclass$",
r".*/[M|m]akefile$"
@@ -300,16 +298,20 @@
# Project-specific hooks
-def _run_checkpatch(project, commit):
+def _run_checkpatch(project, commit, options=[]):
"""Runs checkpatch.pl on the given project"""
hooks_dir = _get_hooks_dir()
- cmd = ['%s/checkpatch.pl' % hooks_dir, '-']
+ cmd = ['%s/checkpatch.pl' % hooks_dir] + options + ['-']
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
output = p.communicate(_get_diff(commit))[0]
if p.returncode:
return HookFailure('checkpatch.pl errors/warnings\n\n' + output)
+def _run_checkpatch_no_tree(project, commit):
+ return _run_checkpatch(project, commit, ['--no-tree'])
+
+
def _run_json_check(project, commit):
"""Checks that all JSON files are syntactically valid."""
for f in _filter_files(_get_affected_files(commit), [r'.*\.json']):
@@ -339,6 +341,7 @@
_PROJECT_SPECIFIC_HOOKS = {
"chromiumos/third_party/kernel": [_run_checkpatch],
"chromiumos/third_party/kernel-next": [_run_checkpatch],
+ "chromiumos/third_party/u-boot": [_run_checkpatch_no_tree],
"chromeos/autotest-tools": [_run_json_check],
}