Loading tools/releasetools/common.py +2 −22 Original line number Diff line number Diff line Loading @@ -588,29 +588,16 @@ def GetKeyPasswords(keylist): return key_passwords def SignFile(input_name, output_name, key, password, align=None, whole_file=False): def SignFile(input_name, output_name, key, password, whole_file=False): """Sign the input_name zip/jar/apk, producing output_name. Use the given key and password (the latter may be None if the key does not have a password. If align is an integer > 1, zipalign is run to align stored files in the output zip on 'align'-byte boundaries. If whole_file is true, use the "-w" option to SignApk to embed a signature that covers the whole file in the archive comment of the zip file. """ if align == 0 or align == 1: align = None if align: temp = tempfile.NamedTemporaryFile() sign_name = temp.name else: sign_name = output_name cmd = [OPTIONS.java_path, OPTIONS.java_args, "-jar", os.path.join(OPTIONS.search_path, OPTIONS.signapk_path)] cmd.extend(OPTIONS.extra_signapk_args) Loading @@ -618,7 +605,7 @@ def SignFile(input_name, output_name, key, password, align=None, cmd.append("-w") cmd.extend([key + OPTIONS.public_key_suffix, key + OPTIONS.private_key_suffix, input_name, sign_name]) input_name, output_name]) p = Run(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) if password is not None: Loading @@ -627,13 +614,6 @@ def SignFile(input_name, output_name, key, password, align=None, if p.returncode != 0: raise ExternalError("signapk.jar failed: return code %s" % (p.returncode,)) if align: p = Run(["zipalign", "-f", "-p", str(align), sign_name, output_name]) p.communicate() if p.returncode != 0: raise ExternalError("zipalign failed: return code %s" % (p.returncode,)) temp.close() def CheckSize(data, target, info_dict): """Check the data string passed against the max size limit, if Loading tools/releasetools/sign_target_files_apks.py +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ def SignApk(data, keyname, pw): signed = tempfile.NamedTemporaryFile() common.SignFile(unsigned.name, signed.name, keyname, pw, align=4) common.SignFile(unsigned.name, signed.name, keyname, pw) data = signed.read() unsigned.close() Loading Loading
tools/releasetools/common.py +2 −22 Original line number Diff line number Diff line Loading @@ -588,29 +588,16 @@ def GetKeyPasswords(keylist): return key_passwords def SignFile(input_name, output_name, key, password, align=None, whole_file=False): def SignFile(input_name, output_name, key, password, whole_file=False): """Sign the input_name zip/jar/apk, producing output_name. Use the given key and password (the latter may be None if the key does not have a password. If align is an integer > 1, zipalign is run to align stored files in the output zip on 'align'-byte boundaries. If whole_file is true, use the "-w" option to SignApk to embed a signature that covers the whole file in the archive comment of the zip file. """ if align == 0 or align == 1: align = None if align: temp = tempfile.NamedTemporaryFile() sign_name = temp.name else: sign_name = output_name cmd = [OPTIONS.java_path, OPTIONS.java_args, "-jar", os.path.join(OPTIONS.search_path, OPTIONS.signapk_path)] cmd.extend(OPTIONS.extra_signapk_args) Loading @@ -618,7 +605,7 @@ def SignFile(input_name, output_name, key, password, align=None, cmd.append("-w") cmd.extend([key + OPTIONS.public_key_suffix, key + OPTIONS.private_key_suffix, input_name, sign_name]) input_name, output_name]) p = Run(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) if password is not None: Loading @@ -627,13 +614,6 @@ def SignFile(input_name, output_name, key, password, align=None, if p.returncode != 0: raise ExternalError("signapk.jar failed: return code %s" % (p.returncode,)) if align: p = Run(["zipalign", "-f", "-p", str(align), sign_name, output_name]) p.communicate() if p.returncode != 0: raise ExternalError("zipalign failed: return code %s" % (p.returncode,)) temp.close() def CheckSize(data, target, info_dict): """Check the data string passed against the max size limit, if Loading
tools/releasetools/sign_target_files_apks.py +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ def SignApk(data, keyname, pw): signed = tempfile.NamedTemporaryFile() common.SignFile(unsigned.name, signed.name, keyname, pw, align=4) common.SignFile(unsigned.name, signed.name, keyname, pw) data = signed.read() unsigned.close() Loading