portage.cache.sqlite module

class portage.cache.sqlite.database(*args, **config)

Bases: portage.cache.fs_template.FsBased

class _connection_info_entry(connection, cursor, pid)

Bases: tuple

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('connection', 'cursor', 'pid')
classmethod _make(iterable)

Make a new _connection_info_entry object from a sequence or iterable

_replace(**kwds)

Return a new _connection_info_entry object replacing specified fields with new values

connection

Alias for field number 0

count(value, /)

Return number of occurrences of value.

cursor

Alias for field number 1

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

pid

Alias for field number 2

property _db_connection
property _db_cursor
_db_escape_string(s)

meta escaping, returns quoted string for use in sql statements

_db_init_cache_size(cache_bytes)
_db_init_connection()
_db_init_structures()
_db_init_synchronous(synchronous)
_db_table_exists(table_name)

return true/false dependant on a tbl existing

_db_table_get_create(table_name)

return true/false dependant on a tbl existing

_db_validate_create_statement(statement)
_delitem(cpv)

__delitem__ calls this after readonly checks. override it in derived classes

_ensure_access(path, mtime=- 1)

returns true or false if it’s able to ensure that path is properly chmod’d and chowned. if mtime is specified, attempts to ensure that’s correct also

_ensure_dirs(path=None)

with path!=None, ensure beyond self.location. otherwise, ensure self.location

_getitem(cpv)

get cpv’s values. override this in derived classess

_import_sqlite()
static _internal_eclasses(extern_ec_dict, chf_type, paths)

When serialize_eclasses is False, we have to convert an external eclass dict containing hashed_path objects into an appropriate internal dict containing values of chf_type (and eclass dirs if store_eclass_paths is True).

_prune_empty_dirs()
_setitem(cpv, values)

__setitem__ calls this after readonly checks. override it in derived classes note _eclassees_ key must be handled

_validate_entry(chf_type, entry, ebuild_hash, eclass_db)
autocommits = False
cache_bytes = 10485760
chf_types = ('md5', 'mtime')
cleanse_keys = False
commit()
complete_eclass_entries = True
get(k, x=None)
get_matches(match_dict)

generic function for walking the entire cache db, matching restrictions to filter what cpv’s are returned. Derived classes should override this if they can implement a faster method then pulling each cpv:values, and checking it.

For example, RDBMS derived classes should push the matching logic down to the actual RDBM.

has_key(cpv)
items()
iteritems()
iterkeys()
keys()

This method should always be overridden. It is provided only for backward compatibility with modules that override iterkeys instead. It will automatically raise a NotImplementedError if iterkeys has not been overridden.

serialize_eclasses = True
store_eclass_paths = True
sync(rate=0)
synchronous = False
validate_entry(entry, ebuild_hash, eclass_db)
validation_chf = 'md5'