Package entropy :: Package client :: Package interfaces :: Package package :: Module preservedlibs :: Class PreservedLibraries

Class PreservedLibraries

source code


Preserved libraries management class.

This class can be used to determine if a library should be preserved, garbage collect the currently preserved libraries, retrieving the list of preserved libraries, etc.

An instance of this class should be used just for one package and then thrown away.

Installed Packages Repository locking must be done externally.

Instance Methods
 
__init__(self, installed_repository, installed_package_id, provided_libraries, root=None)
Object constructor.
source code
 
installed_repository(self)
Return the installed packages repository used by this object.
source code
 
package_id(self)
Return the installed packages repository package identifier.
source code
 
resolve(self, library_path)
Resolve the given library path into a (library, elfclass, path) tuple.
source code
set
determine(self, library_path)
Determine if the passed library path requires protection.
source code
set
needed(self, library_path)
Return a set of installed packages identifiers that need the given library.
source code
list
list(self)
Return a list of all the preserved libraries items stored in the registry.
source code
list
collect(self)
Return a list of collectable preserved libraries items that can be removed from the registry in the installed packages repository.
source code
collections.queue
remove(self, library_path)
Remove the given preserved library element from the system.
source code
 
register(self, library, elfclass, path, atom)
Register the given preserved library element into the registry in the installed packages repository.
source code
 
unregister(self, library, elfclass, path)
Unregister the given preserved library element from the registry in the installed packages repository.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, installed_repository, installed_package_id, provided_libraries, root=None)
(Constructor)

source code 

Object constructor.

Parameters:
  • installed_repository (EntropyRepository) - an EntropyRepository object pointing to the installed packages repository
  • installed_package_id (int) - the installed packages repository package identifier
  • provided_libraries (set) - set of libraries that a package provides, typically this is the data returned by EntropyRepository.retrieveProvidedLibraries()
  • root (string) - path to the root directory minus the trailing "/". For "/" it's just "" or None.
Overrides: object.__init__

resolve(self, library_path)

source code 

Resolve the given library path into a (library, elfclass, path) tuple. A tuple is returned iff it can be found in the provided libraries metadata passed during initialization of this object, None otherwise.

Parameters:
  • library_path (string) - path to a library that would be removed (without the root prefix)
Returns:
a (library name, elf class, library path) tuple or None

determine(self, library_path)

source code 

Determine if the passed library path requires protection.

The returned data is a set of paths that should be protected and stored in the installed packages repository.

Parameters:
  • library_path (string) - path to a library that would be removed (without the root prefix)
Returns: set
set of paths to protect

needed(self, library_path)

source code 

Return a set of installed packages identifiers that need the given library.

Parameters:
  • library_path (string) - path to a library that would be removed (without the root prefix)
Returns: set
set of package identifiers

list(self)

source code 

Return a list of all the preserved libraries items stored in the registry. The list is composed of a tuple (library, elfclass, path, atom).

Returns: list
a list of preserved library items (library, elfclass, path, atom)

collect(self)

source code 

Return a list of collectable preserved libraries items that can be removed from the registry in the installed packages repository.

Returns: list
a list of preserved library items (library, elfclass, path)

remove(self, library_path)

source code 

Remove the given preserved library element from the system. This method will not unregister the element from the registry, please use unregister().

Parameters:
  • library_path (string) - the path to the library
Returns: collections.queue
a sequence of path that haven't been removed and their reasons

register(self, library, elfclass, path, atom)

source code 

Register the given preserved library element into the registry in the installed packages repository.

Parameters:
  • library (string) - the library name
  • elfclass (int) - the ELF class of the library
  • path (string) - the path to the library

unregister(self, library, elfclass, path)

source code 

Unregister the given preserved library element from the registry in the installed packages repository.

Parameters:
  • library (string) - the library name
  • elfclass (int) - the ELF class of the library
  • path (string) - the path to the library