OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ Merges a 64-bit and a 32-bit APK into a single APK | 6 """ Merges a 64-bit and a 32-bit APK into a single APK |
7 | 7 |
8 """ | 8 """ |
9 | 9 |
10 import os | 10 import os |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 if args.uncompress_shared_libraries: | 195 if args.uncompress_shared_libraries: |
196 expected_files[args.shared_library] += ['-0'] | 196 expected_files[args.shared_library] += ['-0'] |
197 | 197 |
198 shutil.copyfile(args.apk_64bit, tmp_apk) | 198 shutil.copyfile(args.apk_64bit, tmp_apk) |
199 | 199 |
200 # need to unpack APKs to compare their contents | 200 # need to unpack APKs to compare their contents |
201 UnpackApk(args.apk_64bit, tmp_dir_64) | 201 UnpackApk(args.apk_64bit, tmp_dir_64) |
202 UnpackApk(args.apk_32bit, tmp_dir_32) | 202 UnpackApk(args.apk_32bit, tmp_dir_32) |
203 | 203 |
204 # TODO(sgurun) remove WebViewPlatformBridge.apk from this list crbug/580678 | |
205 dcmp = filecmp.dircmp( | 204 dcmp = filecmp.dircmp( |
206 tmp_dir_64, | 205 tmp_dir_64, |
207 tmp_dir_32, | 206 tmp_dir_32, |
208 ignore=['META-INF', 'AndroidManifest.xml', 'WebViewPlatformBridge.apk']) | 207 ignore=['META-INF', 'AndroidManifest.xml']) |
209 | 208 |
210 diff_files = GetDiffFiles(dcmp, tmp_dir_32) | 209 diff_files = GetDiffFiles(dcmp, tmp_dir_32) |
211 | 210 |
212 # Check that diff_files match exactly those files we want to insert into | 211 # Check that diff_files match exactly those files we want to insert into |
213 # the 64-bit APK. | 212 # the 64-bit APK. |
214 CheckFilesExpected(diff_files, expected_files) | 213 CheckFilesExpected(diff_files, expected_files) |
215 | 214 |
216 RemoveMetafiles(tmp_apk) | 215 RemoveMetafiles(tmp_apk) |
217 | 216 |
218 AddDiffFiles(diff_files, tmp_dir_32, tmp_apk, expected_files) | 217 AddDiffFiles(diff_files, tmp_dir_32, tmp_apk, expected_files) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 except ApkMergeFailure as e: | 262 except ApkMergeFailure as e: |
264 print e | 263 print e |
265 return 1 | 264 return 1 |
266 finally: | 265 finally: |
267 shutil.rmtree(tmp_dir) | 266 shutil.rmtree(tmp_dir) |
268 return 0 | 267 return 0 |
269 | 268 |
270 | 269 |
271 if __name__ == '__main__': | 270 if __name__ == '__main__': |
272 sys.exit(main()) | 271 sys.exit(main()) |
OLD | NEW |