def METHOD_NAME(self):
    """Unarchive a file."""
    # handle some defaults for archive_path and destination_path
    archive_path = self.env.get("archive_path", self.env.get("pathname"))
    if not archive_path:
        raise ProcessorError(
            "Expected an 'archive_path' input variable but none is set!"
        )
    destination_path = self.env.get(
        "destination_path",
        os.path.join(self.env["RECIPE_CACHE_DIR"], self.env["NAME"]),
    )
    # Create the directory if needed.
    if not os.path.exists(destination_path):
        try:
            os.makedirs(destination_path)
        except OSError as err:
            raise ProcessorError(
                "Can't create %s: %s" % (destination_path, err.strerror)
            )
    elif self.env.get("purge_destination"):
        for entry in os.listdir(destination_path):
            path = os.path.join(destination_path, entry)
            try:
                if os.path.isdir(path) and not os.path.islink(path):
                    shutil.rmtree(path)
                else:
                    os.unlink(path)
            except OSError as err:
                raise ProcessorError("Can't remove %s: %s" % (path, err.strerror))
    fmt = self.env.get("archive_format")
    if fmt is None:
        fmt = self.get_archive_format(archive_path)
        if not fmt:
            raise ProcessorError(
                "Can't guess archive format for filename %s"
                % os.path.basename(archive_path)
            )
        self.output(
            "Guessed archive format '%s' from filename %s"
            % (fmt, os.path.basename(archive_path))
        )
    elif fmt not in EXTNS:
        raise ProcessorError(
            "'%s' is not valid for the 'archive_format' variable. "
            "Must be one of %s." % (fmt, ", ".join(EXTNS))
        )
    if fmt == "zip":
        cmd = [
            "/usr/bin/ditto",
            "--noqtn",
            "-x",
            "-k",
            archive_path,
            destination_path,
        ]
    elif fmt == "gzip":
        cmd = ["/usr/bin/ditto", "--noqtn", "-x", archive_path, destination_path]
    elif fmt == "7z":
        cmd_7z = self.env.get("7z_unarchiver_path")
        if not cmd_7z:
            raise ProcessorError(
                "Expected an '7z_unarchiver_path' input variable since file format is 7z!"
            )
        cmd = [cmd_7z, "x", archive_path, "-o" + destination_path]
    elif fmt.startswith("tar"):
        cmd = ["/usr/bin/tar", "-x", "-f", archive_path, "-C", destination_path]
        if fmt.endswith("gzip"):
            cmd.append("-z")
        elif fmt.endswith("bzip2"):
            cmd.append("-j")
    # Call the shell command.
    try:
        with subprocess.Popen(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
        ) as proc:
            _, stderr = proc.communicate()
    except OSError as err:
        raise ProcessorError(
            "%s execution failed with error code %d: %s"
            % (os.path.basename(cmd[0]), err.errno, err.strerror)
        )
    if proc.returncode != 0:
        raise ProcessorError(
            "Unarchiving %s with %s failed: %s"
            % (archive_path, os.path.basename(cmd[0]), stderr)
        )
    self.output("Unarchived %s to %s" % (archive_path, destination_path))