Merge "Revert "Revert "releasetools: Use pattern filter when unzipping.""" am: 8e02284362

am: 85f8de467a

Change-Id: I56d3dee99e7f33c5c1e5efd23776cf2106e7d63d
This commit is contained in:
Tao Bao 2017-03-06 16:54:06 +00:00 committed by android-build-merger
commit 654e4f4c77
3 changed files with 8 additions and 4 deletions

View file

@ -235,7 +235,7 @@ class TargetFiles(object):
self.certmap = None self.certmap = None
def LoadZipFile(self, filename): def LoadZipFile(self, filename):
d, z = common.UnzipTemp(filename, '*.apk') d, z = common.UnzipTemp(filename, ['*.apk'])
try: try:
self.apks = {} self.apks = {}
self.apks_by_basename = {} self.apks_by_basename = {}

View file

@ -564,7 +564,7 @@ def UnzipTemp(filename, pattern=None):
def unzip_to_dir(filename, dirname): def unzip_to_dir(filename, dirname):
cmd = ["unzip", "-o", "-q", filename, "-d", dirname] cmd = ["unzip", "-o", "-q", filename, "-d", dirname]
if pattern is not None: if pattern is not None:
cmd.append(pattern) cmd.extend(pattern)
p = Run(cmd, stdout=subprocess.PIPE) p = Run(cmd, stdout=subprocess.PIPE)
p.communicate() p.communicate()
if p.returncode != 0: if p.returncode != 0:

View file

@ -184,6 +184,8 @@ OPTIONS.payload_signer = None
OPTIONS.payload_signer_args = [] OPTIONS.payload_signer_args = []
METADATA_NAME = 'META-INF/com/android/metadata' METADATA_NAME = 'META-INF/com/android/metadata'
UNZIP_PATTERN = ['IMAGES/*', 'META/*']
def MostPopularKey(d, default): def MostPopularKey(d, default):
"""Given a dict, return the key corresponding to the largest """Given a dict, return the key corresponding to the largest
@ -2214,7 +2216,8 @@ def main(argv):
OPTIONS.extra_script = open(OPTIONS.extra_script).read() OPTIONS.extra_script = open(OPTIONS.extra_script).read()
print("unzipping target target-files...") print("unzipping target target-files...")
OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0]) OPTIONS.input_tmp, input_zip = common.UnzipTemp(
args[0], UNZIP_PATTERN if OPTIONS.block_based else None)
OPTIONS.target_tmp = OPTIONS.input_tmp OPTIONS.target_tmp = OPTIONS.input_tmp
OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.target_tmp) OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.target_tmp)
@ -2282,7 +2285,8 @@ def main(argv):
else: else:
print("unzipping source target-files...") print("unzipping source target-files...")
OPTIONS.source_tmp, source_zip = common.UnzipTemp( OPTIONS.source_tmp, source_zip = common.UnzipTemp(
OPTIONS.incremental_source) OPTIONS.incremental_source,
UNZIP_PATTERN if OPTIONS.block_based else None)
OPTIONS.target_info_dict = OPTIONS.info_dict OPTIONS.target_info_dict = OPTIONS.info_dict
OPTIONS.source_info_dict = common.LoadInfoDict(source_zip, OPTIONS.source_info_dict = common.LoadInfoDict(source_zip,
OPTIONS.source_tmp) OPTIONS.source_tmp)