Package entropy :: Package client :: Package interfaces :: Module methods :: Class RepositoryMixin

Class RepositoryMixin

source code


Instance Methods
 
add_package_repository(self, package_file_path)
Add a package repository (through its package file) to Entropy Client.
source code
bool
add_repository(self, repository_metadata)
Add repository to Entropy Client configuration and data structures.
source code
 
backup_repository(self, repository_id, backup_dir, silent=False, compress_level=9)
Backup given repository into given backup directory.
source code
list
clean_downloaded_packages(self, dry_run=False, days_override=None, skip_available_packages=False)
Clean Entropy Client downloaded packages older than the setting specified by "packages-autoprune-days" in /etc/entropy/client.conf.
source code
 
close_installed_repository(self)
Close the Installed Packages repository.
source code
 
close_repositories(self, mask_clear=True)
Close all the previously opened (through open_repository()) repository instances.
source code
bool
disable_repository(self, repository_id)
Disable given repository in Entropy Client configuration.
source code
bool
enable_repository(self, repository_id)
Enable given repository in Entropy Client configuration.
source code
 
filter_repositories(self, repository_ids)
Filter out package repositories from a given list.
source code
entropy.db.EntropyRepository
installed_repository(self)
Return Entropy Client installed packages repository.
source code
list
installed_repository_backups(self, repository_directory=None)
List available backups for the installed packages repository.
source code
string
installed_repository_path(self)
Return the Entropy Client installed packages repository path.
source code
entropy.client.interfaces.db.GenericRepository
open_generic_repository(self, repository_path, dbname=None, name=None, xcache=None, read_only=False, indexing_override=None, skip_checks=False, direct=False)
Open a Generic Entropy Repository interface, using entropy.client.interfaces.db.GenericRepository class.
source code
entropy.db.skel.EntropyRepositoryBase
open_repository(self, repository_id)
If you just want open a read-only repository, use this method.
source code
entropy.client.interfaces.db.GenericRepository
open_temp_repository(self, dbname=None, name=None, temp_file=None)
Open a temporary (using mkstemp()) Entropy Repository.
source code
bool
remove_repository(self, repository_id, disable=False)
Remove repository from Entropy Client configuration and data structures, if available.
source code
 
reopen_installed_repository(self)
Close and reopen the Installed Packages repository.
source code
 
repositories(self)
Return a list of enabled (and valid) repository identifiers, excluding installed packages repository.
source code
string
repositories_checksum(self)
Return a SHA1 of the checksums and mtimes of all the repositories.
source code
 
restore_repository(self, backup_path, repository_path, repository_id, silent=False)
Restore given repository.
source code
 
shift_repository(self, repository_id, new_position_idx)
Change repository priority, move to given index "new_position_idx".
source code
list
unavailable_repositories(self)
Return a list of repositories that are currently unavailable on the local system.
source code
Class Methods
class object
get_repository(cls, repository_id)
Given a repository identifier, returns the repository class associated with it.
source code
Method Details

add_package_repository(self, package_file_path)

source code 

Add a package repository (through its package file) to Entropy Client. This is temporary and the lifecycle of it being available within Entropy Client is limited to this process lifetime. Any package file, either smart package or simple or webinstall must pass from here in order to get inserted, properly validated and made available.

Parameters:
  • package_file_path (string) - path to entropy package repository file
Returns:
list of package matches found in package repository.
Raises:

add_repository(self, repository_metadata)

source code 

Add repository to Entropy Client configuration and data structures. NOTE: this method is NOT thread-safe. TODO: document metadata structure

Parameters:
  • repository_metadata (dict) - repository metadata dict. See SystemSettings()['repositories']['available'][repository_id] for example metadata.
Returns: bool
True, if repository has been added

backup_repository(self, repository_id, backup_dir, silent=False, compress_level=9)

source code 

Backup given repository into given backup directory.

Parameters:
  • repository_id (string) - repository identifier
  • backup_dir (string) - backup directory
  • silent (bool) - execute in silent mode if True
  • compress_level (int) - compression level, range from 1 to 9

clean_downloaded_packages(self, dry_run=False, days_override=None, skip_available_packages=False)

source code 

Clean Entropy Client downloaded packages older than the setting specified by "packages-autoprune-days" in /etc/entropy/client.conf. If setting is not set or invalid, this method will do nothing. Otherwise, files older than given settings (representing time delta in days) will be removed.

Parameters:
  • dry_run (bool) - do not remove files, just return them
  • days_override (int) - override SystemSettings setting (from client.conf)
  • skip_available_packages (bool) - if True, the package files still available in repositories are skipped. This can be used to implement cleanups using just a shared Entropy Resources lock.
Returns: list
list of removed package file paths.
Raises:
  • AttributeError - if days_override or client.conf setting is invalid (the latter cannot really happen).

close_installed_repository(self)

source code 

Close the Installed Packages repository. It will be reopened on demand.

close_repositories(self, mask_clear=True)

source code 

Close all the previously opened (through open_repository()) repository instances. If mask_clear is True, package masking information will be cleared as well (by calling SystemSettings.clear()).

Parameters:
  • mask_clear (bool) - clear package masking information if True

disable_repository(self, repository_id)

source code 

Disable given repository in Entropy Client configuration. If repository_id doesn't exist, nothing will change. But please, make sure this won't happen. NOTE: this method is NOT thread-safe.

Parameters:
  • repository_id (string) - repository identifier
Returns: bool
True, if repository has been disabled, False otherwise
Raises:
  • ValueError - if repository is not available
  • ValueError - if repository is a package repository

enable_repository(self, repository_id)

source code 

Enable given repository in Entropy Client configuration. If repository_id doesn't exist, nothing will change. But please, make sure this won't happen. NOTE: this method is NOT thread-safe.

Parameters:
  • repository_id (string) - repository identifier
Returns: bool
True, if repository has been enabled

filter_repositories(self, repository_ids)

source code 

Filter out package repositories from a given list.

Parameters:
  • repository_ids (list) - an alternative list of enabled repository identifiers

get_repository(cls, repository_id)
Class Method

source code 

Given a repository identifier, returns the repository class associated with it. NOTE: stub. When more EntropyRepositoryBase classes will be available, this method will start making more sense. WARNING: do not use this to open a repository. Please use Client.open_repository() instead. If repository_id is None, a generic repository class is returned.

Parameters:
  • repository_id (string) - repository identifier
Returns: class object
EntropyRepositoryBase based class

installed_repository(self)

source code 

Return Entropy Client installed packages repository.

Returns: entropy.db.EntropyRepository
Entropy Client installed packages repository

installed_repository_backups(self, repository_directory=None)

source code 

List available backups for the installed packages repository.

Parameters:
  • repository_directory (string) - alternative backup directory
Returns: list
list of paths

installed_repository_path(self)

source code 

Return the Entropy Client installed packages repository path.

Returns: string
repository path

open_generic_repository(self, repository_path, dbname=None, name=None, xcache=None, read_only=False, indexing_override=None, skip_checks=False, direct=False)

source code 

Open a Generic Entropy Repository interface, using entropy.client.interfaces.db.GenericRepository class.

Parameters:
  • repository_path (string) - path to valid Entropy Repository file
  • dbname (string) - backward compatibility, don't use this
  • name (string) - repository identifier hold by the repository object and returned by repository_id()
  • xcache (bool) - enable on-disk cache for repository?
  • read_only (bool) - True, will keep the repository read-only, rolling back any transaction
  • indexing_override (bool) - override default indexing settings (default is disabled for this kind of, usually small, repositories)
  • skip_checks (bool) - skip integrity checks on repository
  • direct (bool) - True, if direct mode should be always enabled
Returns: entropy.client.interfaces.db.GenericRepository
a GenericRepository object

open_repository(self, repository_id)

source code 

If you just want open a read-only repository, use this method.

Parameters:
  • repository_id (string) - repository identifier
Returns: entropy.db.skel.EntropyRepositoryBase
EntropyRepositoryBase based instance

open_temp_repository(self, dbname=None, name=None, temp_file=None)

source code 

Open a temporary (using mkstemp()) Entropy Repository. Indexing and Caching are disabled by default.

Parameters:
  • dbname (string) - backward compatibility, don't use this
  • name (string) - repository identifier hold by the repository object and returned by repository_id()
  • temp_file (string) - override random temporary file and open given temp_file. No path validity check will be run.
Returns: entropy.client.interfaces.db.GenericRepository
a GenericRepository object

remove_repository(self, repository_id, disable=False)

source code 

Remove repository from Entropy Client configuration and data structures, if available. NOTE: this method is NOT thread-safe.

Parameters:
  • repository_id (string) - repository identifier
  • disable (bool) - instead of removing the repository from entropy configuration, just disable it. (default is remove)
Returns: bool
True, if repository has been removed

repositories(self)

source code 

Return a list of enabled (and valid) repository identifiers, excluding installed packages repository. You can use the identifiers in this list to open EntropyRepository instances using Client.open_repository() NOTE: this method directly returns a reference to the internal enabled repository list object. NOTE: the returned list is built based on SystemSettings repository metadata but might differ because extra checks are done at runtime. So, if you want to iterate over valid repositories, use this method.

Returns:
enabled and valid repository identifiers @rtype list

repositories_checksum(self)

source code 

Return a SHA1 of the checksums and mtimes of all the repositories.

This method can be used for cache validation/lookup purposes.

Returns: string
a SHA1 string of the checksum and mtimes of all the available repositories, including package repositories, excluding the installed packages repository

restore_repository(self, backup_path, repository_path, repository_id, silent=False)

source code 

Restore given repository.

Parameters:
  • backup_path (string) - path to backed up repository file
  • repository_path (string) - repository destination path
  • repository_id (string) - repository identifier
  • silent (bool) - execute in silent mode if True

shift_repository(self, repository_id, new_position_idx)

source code 

Change repository priority, move to given index "new_position_idx". The reference ordered list is at SystemSettings()['repositories']['order'] NOTE: this method is NOT thread-safe.

Parameters:
  • repository_id (string) - repository identifier
  • new_position_idx (int) - new ordered list index
Raises:
  • ValueError - if repository_id is invalid

unavailable_repositories(self)

source code 

Return a list of repositories that are currently unavailable on the local system. This method does a set difference from repositories() and SystemSettings metadata.

Returns: list
list of unavailable (or broken) repositories