gzip reference dumps while copying to ref-dump-dir.
Remove the additional step of gzipping reference dumps manually.
Test: utils/create_reference_dumps.py --version current -ref-dump-dir
$ANDROID_BUILD_TOP/prebuilts/abi-dumps/vndk; mm -j64 in
external/libexif.
Change-Id: Ib22a3b4fa90e4f849529efc4b03ab43d87996458
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
import tempfile
|
import tempfile
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import gzip
|
||||||
|
import shutil
|
||||||
|
|
||||||
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
|
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||||
AOSP_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, *['..'] * 5))
|
AOSP_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, *['..'] * 5))
|
||||||
@@ -48,11 +50,11 @@ def copy_reference_dumps(lib_paths, reference_dir_stem,
|
|||||||
|
|
||||||
def copy_reference_dump(lib_path, reference_dump_dir):
|
def copy_reference_dump(lib_path, reference_dump_dir):
|
||||||
reference_dump_path = os.path.join(reference_dump_dir,
|
reference_dump_path = os.path.join(reference_dump_dir,
|
||||||
os.path.basename(lib_path))
|
os.path.basename(lib_path)) + '.gz'
|
||||||
os.makedirs(os.path.dirname(reference_dump_path), exist_ok=True)
|
os.makedirs(os.path.dirname(reference_dump_path), exist_ok=True)
|
||||||
output_content = read_output_content(lib_path, AOSP_DIR)
|
output_content = read_output_content(lib_path, AOSP_DIR)
|
||||||
with open(reference_dump_path, 'w') as f:
|
with gzip.open(reference_dump_path, 'wb') as f:
|
||||||
f.write(output_content)
|
f.write(bytes(output_content, 'utf-8'))
|
||||||
print('Created abi dump at ', reference_dump_path)
|
print('Created abi dump at ', reference_dump_path)
|
||||||
return reference_dump_path
|
return reference_dump_path
|
||||||
|
|
||||||
@@ -67,6 +69,7 @@ def copy_reference_dump_content(lib_name, output_content,
|
|||||||
os.makedirs(os.path.dirname(reference_dump_path), exist_ok=True)
|
os.makedirs(os.path.dirname(reference_dump_path), exist_ok=True)
|
||||||
with open(reference_dump_path, 'w') as f:
|
with open(reference_dump_path, 'w') as f:
|
||||||
f.write(output_content)
|
f.write(output_content)
|
||||||
|
|
||||||
print('Created abi dump at ', reference_dump_path)
|
print('Created abi dump at ', reference_dump_path)
|
||||||
return reference_dump_path
|
return reference_dump_path
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user