'Dump provenance information for a spec to a particular path.
This dumps the package file and any associated patch files.
Raises UnknownPackageError if not found.'

@_autospec
def dump_provenance(self, spec, path):

    if spec.virtual:
        raise UnknownPackageError(spec.name)
    if (spec.namespace and (spec.namespace != self.namespace)):
        raise UnknownPackageError(('Repository    %s    does    not    contain    package    %s.' % (self.namespace, spec.fullname)))
    mkdirp(path)
    for (spec, patches) in spec.package.patches.items():
        for patch in patches:
            if patch.path:
                if os.path.exists(patch.path):
                    install(patch.path, path)
                else:
                    tty.warn(('Patch    file    did    not    exist:    %s' % patch.path))
    install(self.filename_for_package_name(spec), path)
