pre-upload: show ebuilds failing keywords check
If uploading multiple files, it might not be obvious which ebuild is
failing the KEYWORDS check. List the file explicitly in the failure.
BUG=chromium:307180
TEST=ran upload w/many files and looked at output
Change-Id: Ie6073e2925d9f3dba11166c94b3c0c4a6a516674
Reviewed-on: https://chromium-review.googlesource.com/219279
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 1c0cd6f..9247d93 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -592,6 +592,7 @@
ebuilds = _filter_files(_get_affected_files(commit, relative=True),
ebuilds_re)
+ bad_ebuilds = []
for ebuild in ebuilds:
# We get the full content rather than a diff as the latter does not work
# on new files (like when adding new ebuilds).
@@ -603,17 +604,20 @@
if not keywords or WHITELIST - keywords != WHITELIST:
continue
- return HookFailure(
- 'Please update KEYWORDS to use a glob:\n'
- 'If the ebuild should be marked stable (normal for non-9999 '
- 'ebuilds):\n'
- ' KEYWORDS="*"\n'
- 'If the ebuild should be marked unstable (normal for '
- 'cros-workon / 9999 ebuilds):\n'
- ' KEYWORDS="~*"\n'
- 'If the ebuild needs to be marked for only specific arches,'
- 'then use -* like so:\n'
- ' KEYWORDS="-* arm ..."\n')
+ bad_ebuilds.append(ebuild)
+
+ if bad_ebuilds:
+ return HookFailure(
+ '%s\n'
+ 'Please update KEYWORDS to use a glob:\n'
+ 'If the ebuild should be marked stable (normal for non-9999 ebuilds):\n'
+ ' KEYWORDS="*"\n'
+ 'If the ebuild should be marked unstable (normal for '
+ 'cros-workon / 9999 ebuilds):\n'
+ ' KEYWORDS="~*"\n'
+ 'If the ebuild needs to be marked for only specific arches,'
+ 'then use -* like so:\n'
+ ' KEYWORDS="-* arm ..."\n' % '\n* '.join(bad_ebuilds))
def _check_ebuild_licenses(_project, commit):