From: Peter Amstutz Date: Tue, 12 Aug 2014 15:42:09 +0000 (-0400) Subject: 3373: Test filename extension before attempting to call dtrx. Non-zero dtrx exit... X-Git-Tag: 1.1.0~2341^2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/0a53423e423d107e457e1555ce3ec4e9ab2dd911 3373: Test filename extension before attempting to call dtrx. Non-zero dtrx exit code is now treated as failure. --- diff --git a/crunch_scripts/decompress-all.py b/crunch_scripts/decompress-all.py index 460425f8b2..9a286b2c66 100755 --- a/crunch_scripts/decompress-all.py +++ b/crunch_scripts/decompress-all.py @@ -45,12 +45,18 @@ if streamname != None: os.chdir(streamname) else: streamname = '.' -streamreader = filter(lambda s: s.name() == streamname, cr.all_streams())[0] -filereader = streamreader.files()[filename] -rc = subprocess.call(["dtrx", "-r", "-n", "-q", arvados.get_task_param_mount('input')]) -if rc == 0: - out = arvados.CollectionWriter() - out.write_directory_tree(outdir, max_manifest_depth=0) - task.set_output(out.finish()) + +m = re.match(r'\.(gz|Z|bz2|tgz|tbz|zip|rar|7z|cab|deb|rpm|cpio|gem)$', arvados.get_task_param_mount('input'), re.IGNORECASE) + +if m != None: + rc = subprocess.call(["dtrx", "-r", "-n", "-q", arvados.get_task_param_mount('input')]) + if rc == 0: + out = arvados.CollectionWriter() + out.write_directory_tree(outdir, max_manifest_depth=0) + task.set_output(out.finish()) + else: + return rc else: + streamreader = filter(lambda s: s.name() == streamname, cr.all_streams())[0] + filereader = streamreader.files()[filename] task.set_output(streamname + filereader.as_manifest()[1:])