Revert "Remove requirement that fsv_meta file is next to its inp..."
Revert submission 3495097-independant_fsverity_metadata
Reason for revert: Droidmonitor created revert due to b/396672721. Will be verifying through ABTD before submission.
Reverted changes: /q/submissionid:3495097-independant_fsverity_metadata
Change-Id: I4aab22eb434413a4b1aef7510d6b5e6c2ffd3c36
diff --git a/tools/releasetools/fsverity_metadata_generator.py b/tools/releasetools/fsverity_metadata_generator.py
index e531cca..50e23e7 100644
--- a/tools/releasetools/fsverity_metadata_generator.py
+++ b/tools/releasetools/fsverity_metadata_generator.py
@@ -230,6 +230,12 @@
if not output_file:
output_file = input_file + '.fsv_meta'
+ if output_file != args.input + '.fsv_meta':
+ sys.exit('When generating .fsv_meta files for symlinks, we assume that all fsv_meta files '
+ 'are named the same as the file they protect, just with the .fsv_meta suffix appended. '
+ 'We require that all .fsv_meta files follow this convention regardless of if it\'s a link or '
+ 'not. However {args.input} had a different output file: {args.output}')
+
# remove the output file first, as switching between a file and a symlink can be complicated
try:
os.remove(output_file)