portage.util._dyn_libs.PreservedLibsRegistry module

class portage.util._dyn_libs.PreservedLibsRegistry.PreservedLibsRegistry(root, filename)

Bases: object

This class handles the tracking of preserved library objects

_json_write = True
_json_write_opts = {'ensure_ascii': False, 'indent': '\t', 'sort_keys': True}
_normalize_counter(counter)

For simplicity, normalize as a unicode string and strip whitespace. This avoids the need for int conversion and a possible ValueError resulting from vardb corruption.

getPreservedLibs()

Return a mapping of packages->preserved objects. :return mapping of package instances to preserved objects :rtype Dict cpv->list-of-paths

hasEntries()

Check if this registry contains any records.

load()

Reload the registry data from file

lock()

Grab an exclusive lock on the preserved libs registry.

pruneNonExisting()

Remove all records for objects that no longer exist on the filesystem.

register(cpv, slot, counter, paths)

Register new objects in the registry. If there is a record with the same packagename (internally derived from cpv) and slot it is overwritten with the new data. :param cpv: package instance that owns the objects :type cpv: CPV (as String) :param slot: the value of SLOT of the given package instance :type slot: String :param counter: vdb counter value for the package instance :type counter: String :param paths: absolute paths of objects that got preserved during an update :type paths: List

store()

Store the registry data to the file. The existing inode will be replaced atomically, so if that inode is currently being used for a lock then that lock will be rendered useless. Therefore, it is important not to call this method until the current lock is ready to be immediately released.

unlock()

Release our exclusive lock on the preserved libs registry.

unregister(cpv, slot, counter)

Remove a previous registration of preserved objects for the given package. :param cpv: package instance whose records should be removed :type cpv: CPV (as String) :param slot: the value of SLOT of the given package instance :type slot: String