From 9662cfb23442047d07cca217904d5364468ae7e3 Mon Sep 17 00:00:00 2001 From: Bill Peckham Date: Wed, 24 Apr 2019 17:59:01 -0700 Subject: [PATCH] Sort content of merged target files package. By sorting the content of the final output merged target files package, the merged target files package is more like the target files packages generated by a build. Test: Generate merged target files package, verify that content is sorted. Change-Id: Ic0c198630ebd7692a3f3f9663d85e4b45229175c --- tools/releasetools/merge_target_files.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py index 0902d907cf..1af532dc4e 100755 --- a/tools/releasetools/merge_target_files.py +++ b/tools/releasetools/merge_target_files.py @@ -722,18 +722,21 @@ def merge_target_files(temp_dir, system_target_files, system_item_list, output_target_files_meta_dir = os.path.join(output_target_files_temp_dir, 'META') - command = [ + find_command = [ 'find', output_target_files_meta_dir, ] - # TODO(bpeckham): sort this to be more like build. - meta_content = common.RunAndCheckOutput(command, verbose=False) - command = [ + find_process = common.Run(find_command, stdout=subprocess.PIPE, verbose=False) + meta_content = common.RunAndCheckOutput(['sort'], stdin=find_process.stdout, + verbose=False) + + find_command = [ 'find', output_target_files_temp_dir, '-path', output_target_files_meta_dir, '-prune', '-o', '-print' ] - # TODO(bpeckham): sort this to be more like build. - other_content = common.RunAndCheckOutput(command, verbose=False) + find_process = common.Run(find_command, stdout=subprocess.PIPE, verbose=False) + other_content = common.RunAndCheckOutput(['sort'], stdin=find_process.stdout, + verbose=False) with open(output_target_files_list, 'wb') as f: f.write(meta_content)