Kaydet (Commit) 1a4351a6 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

updater: handle paths with spaces correctly

Change-Id: I8089f1e2b46a242562608431e56c5da4c63fdb01
üst f3c1987f
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# Extract a mar file and uncompress the content # Extract a mar file and uncompress the content
import os import os
import re
import sys import sys
import subprocess import subprocess
from path import convert_to_native from path import convert_to_native
...@@ -26,13 +27,17 @@ def extract_mar(mar_file, target_dir): ...@@ -26,13 +27,17 @@ def extract_mar(mar_file, target_dir):
subprocess.check_call([mar, "-C", convert_to_native(target_dir), "-x", convert_to_native(mar_file)]) subprocess.check_call([mar, "-C", convert_to_native(target_dir), "-x", convert_to_native(mar_file)])
file_info = subprocess.check_output([mar, "-t", convert_to_native(mar_file)]) file_info = subprocess.check_output([mar, "-t", convert_to_native(mar_file)])
lines = file_info.splitlines() lines = file_info.splitlines()
prog = re.compile("\d+\s+\d+\s+(.+)")
for line in lines: for line in lines:
info = line.split() match = prog.match(line.decode("utf-8", "strict"))
if match is None:
continue
info = match.groups()[0]
# ignore header line # ignore header line
if info[2] == b'NAME': if info == b'NAME':
continue continue
uncompress_content(os.path.join(target_dir, info[2].decode("utf-8"))) uncompress_content(os.path.join(target_dir, info))
def main(): def main():
if len(sys.argv) != 3: if len(sys.argv) != 3:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment