# HG changeset patch # User Brett Smith # Date 1215737709 14400 # Node ID b0290eeb3b7a3935ee6dcf433c6c6d46b7275d18 # Parent 48d2421a3178391b83365d9c21bd3c04b16f345c Recurse better when the contents were just one file. diff -r 48d2421a3178 -r b0290eeb3b7a scripts/dtrx --- a/scripts/dtrx Thu Jul 10 20:09:12 2008 -0400 +++ b/scripts/dtrx Thu Jul 10 20:55:09 2008 -0400 @@ -1025,9 +1025,17 @@ self.options.recursion_policy.prep(filename, action.target, extractor) if self.options.recursion_policy.ok_to_recurse(): for filename in extractor.included_archives: + logger.debug("recursing with %s archive" % + (extractor.content_type,)) tail_path, basename = os.path.split(filename) - directory = os.path.join(self.current_directory, action.target, - extractor.included_root, tail_path) + path_args = [self.current_directory, extractor.included_root, + tail_path] + logger.debug("included root: %s" % (extractor.included_root,)) + logger.debug("tail path: %s" % (tail_path,)) + if os.path.isdir(action.target): + logger.debug("action target: %s" % (action.target,)) + path_args.insert(1, action.target) + directory = os.path.join(*path_args) self.archives.setdefault(directory, []).append(basename) def check_file(self, filename): diff -r 48d2421a3178 -r b0290eeb3b7a tests/test-one-archive.tar.gz Binary file tests/test-one-archive.tar.gz has changed diff -r 48d2421a3178 -r b0290eeb3b7a tests/tests.yml --- a/tests/tests.yml Thu Jul 10 20:09:12 2008 -0400 +++ b/tests/tests.yml Thu Jul 10 20:55:09 2008 -0400 @@ -593,3 +593,14 @@ filenames: ../test-onefile.tar.gz baseline: tar -zxf $1 antigrep: "contains" + +- name: test recursive extraction of one archive + directory: inside-dir + options: "" + filenames: ../test-one-archive.tar.gz + baseline: | + tar -zxf $1 + zcat test-text.gz >test-text + input: | + h + o