summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-05 05:52:46 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-06 22:49:33 +0200
commit1a4351a6a142389071ba3ad8400c14894fa6e4d4 (patch)
treec05e3d56e4b9d5e2530ce685740cb5d150bbcfc7 /bin
parentf3c1987fbe2d3b155076f92aaed4a1168874ab46 (diff)
updater: handle paths with spaces correctly
Change-Id: I8089f1e2b46a242562608431e56c5da4c63fdb01
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update/uncompress_mar.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/update/uncompress_mar.py b/bin/update/uncompress_mar.py
index cecb16af0e6c..0989c7e92d6d 100755
--- a/bin/update/uncompress_mar.py
+++ b/bin/update/uncompress_mar.py
@@ -11,6 +11,7 @@
# Extract a mar file and uncompress the content
import os
+import re
import sys
import subprocess
from path import convert_to_native
@@ -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)])
file_info = subprocess.check_output([mar, "-t", convert_to_native(mar_file)])
lines = file_info.splitlines()
+ prog = re.compile("\d+\s+\d+\s+(.+)")
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
- if info[2] == b'NAME':
+ if info == b'NAME':
continue
- uncompress_content(os.path.join(target_dir, info[2].decode("utf-8")))
+ uncompress_content(os.path.join(target_dir, info))
def main():
if len(sys.argv) != 3: