portage.cache.template module

portage.cache.template._md5_deserializer(md5)

Without this validation, it’s possible for reconstruct_eclasses to mistakenly interpret mtime data as md5 data, and return an invalid data structure containing strings where ints are expected.

class portage.cache.template.database(location, label, auxdbkeys, readonly=False)

Bases: object

_delitem(cpv)

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

_getitem(cpv)

get cpv’s values. override this in derived classess

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).

_setitem(name, 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
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)
validate_entry(entry, ebuild_hash, eclass_db)
validation_chf = 'mtime'
portage.cache.template.reconstruct_eclasses(cpv, eclass_string, chf_type='mtime', paths=True)

returns a dict when handed a string generated by serialize_eclasses

portage.cache.template.serialize_eclasses(eclass_dict, chf_type='mtime', paths=True)

takes a dict, returns a string representing said dict