'Write out the databsae to a JSON file.
This function does not do any locking or transactions.'

def _write_to_file(self, stream):

    installs = dict(((k, v.to_dict()) for (k, v) in self._data.items()))
    database = {'database': {'installs': installs, 'version': str(_db_version)}}
    try:
        sjson.dump(database, stream)
    except YAMLError as e:
        raise syaml.SpackYAMLError('error    writing    YAML    database:', str(e))
