aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-03-22 14:28:35 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-03-22 14:28:35 +0000
commitfb8a17589be3a2682084cf4a6001860108417d6a (patch)
tree52cec87e70718b4efea41504bde845addb0022e3
parent60012adbcee544b037db607b90c4ca565778880c (diff)
parente106ee3301113116bdc4e11cdb9af60ea946d12b (diff)
downloadrepohooks-androidx-activity-release.tar.gz
Snap for 11610999 from e106ee3301113116bdc4e11cdb9af60ea946d12b to androidx-activity-releaseandroidx-activity-release
Change-Id: If96655a0113ac6696f5ccc9023eb1091567c55af
-rwxr-xr-xpre-upload.py6
-rw-r--r--rh/hooks.py10
2 files changed, 8 insertions, 8 deletions
diff --git a/pre-upload.py b/pre-upload.py
index 3eece2d..18bf11f 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -359,8 +359,7 @@ def _run_project_hooks_in_cwd(
config = _get_project_config(from_git)
except rh.config.ValidationError as e:
output.error('Loading config files', str(e))
- ret.internal_failure = True
- return ret
+ return ret._replace(internal_failure=True)
# If the repo has no pre-upload hooks enabled, then just return.
hooks = list(config.callable_hooks())
@@ -374,8 +373,7 @@ def _run_project_hooks_in_cwd(
except rh.utils.CalledProcessError as e:
output.error('Upstream remote/tracking branch lookup',
f'{e}\nDid you run repo start? Is your HEAD detached?')
- ret.internal_failure = True
- return ret
+ return ret._replace(internal_failure=True)
project = rh.Project(name=project_name, dir=proj_dir)
rel_proj_dir = os.path.relpath(proj_dir, rh.git.find_repo_root())
diff --git a/rh/hooks.py b/rh/hooks.py
index 1168720..6cb92a0 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -346,15 +346,17 @@ def check_bpfmt(project, commit, _desc, diff, options=None):
bpfmt = options.tool_path('bpfmt')
bpfmt_options = options.args((), filtered)
- cmd = [bpfmt, '-l'] + bpfmt_options
+ cmd = [bpfmt, '-d'] + bpfmt_options
+ fixup_cmd = [bpfmt, '-w']
+ if '-s' in bpfmt_options:
+ fixup_cmd.append('-s')
+ fixup_cmd.append('--')
+
ret = []
for d in filtered:
data = rh.git.get_file_content(commit, d.file)
result = _run(cmd, input=data)
if result.stdout:
- fixup_cmd = [bpfmt, '-w']
- if '-s' in bpfmt_options:
- fixup_cmd.append('-s')
ret.append(rh.results.HookResult(
'bpfmt', project, commit,
error=result.stdout,