pre-upload: drop _PROJECT_SPECIFIC_HOOKS
Now that all repos opt-in to whatever checks they want, we don't
have to hardcode a reverse-list of projects.
BUG=chromium:466264
TEST=CQ passes
Change-Id: I5734b2849347f93ac7888c9136ff5afccf96ca46
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/repohooks/+/2595357
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 2407ac5..9555eae 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -2144,14 +2144,6 @@
]
-# A dictionary of project-specific hooks(callbacks), indexed by project name.
-# dict[project] = [callback1, callback2]
-_PROJECT_SPECIFIC_HOOKS = {
- 'chromiumos/third_party/kernel': [_kernel_configcheck],
- 'chromiumos/third_party/kernel-next': [_kernel_configcheck],
-}
-
-
# A dictionary of flags (keys) that can appear in the config file, and the hook
# that the flag controls (value).
_HOOK_FLAGS = {
@@ -2258,13 +2250,12 @@
return config.items(SECTION)
-def _get_project_hooks(project, presubmit, config_file=None):
+def _get_project_hooks(presubmit, config_file=None):
"""Returns a list of hooks that need to be run for a project.
Expects to be called from within the project root.
Args:
- project: A string, name of the project.
presubmit: A Boolean, True if the check is run as a git pre-submit script.
config_file: A string, the config file. Defaults to _CONFIG_FILE.
"""
@@ -2294,10 +2285,6 @@
hooks = list(enabled_hooks) + hooks
- if project in _PROJECT_SPECIFIC_HOOKS:
- hooks.extend(hook for hook in _PROJECT_SPECIFIC_HOOKS[project]
- if hook not in disabled_hooks)
-
for name, script in _get_project_hook_scripts(config):
func = functools.partial(_run_project_hook_script, script)
func.__name__ = name
@@ -2371,7 +2358,7 @@
os.chdir(pwd)
return True
- hooks = _get_project_hooks(project.name, presubmit, config_file)
+ hooks = _get_project_hooks(presubmit, config_file)
error_found = False
commit_count = len(commit_list)
hook_count = len(hooks)
diff --git a/pre-upload_unittest.py b/pre-upload_unittest.py
index 15b91ad..0ddbbb1 100755
--- a/pre-upload_unittest.py
+++ b/pre-upload_unittest.py
@@ -2124,8 +2124,7 @@
"""Helper to write config and parse it."""
filename = os.path.join(self.tempdir, 'config')
osutils.WriteFile(filename, data)
- return pre_upload._get_project_hooks(project='test', presubmit=True,
- config_file=filename)
+ return pre_upload._get_project_hooks(presubmit=True, config_file=filename)
def testClangFormatCheckDefault(self):
"""Verify clang-format check disabled by default."""