pre-upload: Fix comparison between absolute and relative path.
In _check_for_uprev(), affected_paths, set of relative paths the CL
affects was compared with a set of full paths of affected ebuild files.
BUG=chromium:440138
TEST=Unit tests: check that new unit test fails before change, pass after.
Check that CL that failed verification (cl/233233) now passes.
Change-Id: I74ed0ab8d75d1ccab6d3e2e11464fecaf0b4c317
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/233912
diff --git a/pre-upload.py b/pre-upload.py
index ffa6eae..c469824 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -497,7 +497,8 @@
# Look through each directory. If it's got an ebuild in it then we'll
# consider this as a case when we need a revbump.
- affected_paths = set([FinalName(x) for x in affected_path_objs])
+ affected_paths = set(os.path.join(project_top, FinalName(x))
+ for x in affected_path_objs)
for dir_path in dirs_to_check:
contents = os.listdir(dir_path)
ebuilds = [os.path.join(dir_path, path)
diff --git a/pre-upload_unittest.py b/pre-upload_unittest.py
index 395126d..5f2af69 100755
--- a/pre-upload_unittest.py
+++ b/pre-upload_unittest.py
@@ -792,6 +792,11 @@
DiffEntry(src_file='c/p/p-0-r1.ebuild', src_mode='120000',
dst_file='c/p/p-0-r2.ebuild', dst_mode='120000', status='R')])
+ def testModifiedFilesWith9999(self):
+ """Accept 9999 ebuilds and changes in files/."""
+ self.assertAccepted([DiffEntry(src_file='c/p/files/f', status='M'),
+ DiffEntry(src_file='c/p/p-9999.ebuild', status='M')])
+
if __name__ == '__main__':
cros_test_lib.main()