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

Class MiscMixin

source code


Instance Methods
 
benchmark_mirrors(self, mirrors)
Execute a throughput-oriented benchmark against the list of given Entropy Packages mirrors.
source code
string or None
generate_package(self, entropy_package_metadata, save_directory, edb=True, fake=False, compression='bz2', shiftpath=None)
Generate a valid Entropy package file from a full package metadata object (see entropy.db.skel.EntropyRepositoryBase.getPackageData()) and save it into save_directory directory, package content is read from disk, so this method works fine ONLY for installed packages.
source code
dict
get_licenses_to_accept(self, *args, **kwargs)
Return, for given package matches, what licenses have to be accepted.
source code
list
get_meant_packages(self, search_term, from_installed=False, valid_repos=None)
Return a list of package matches that are phonetically similar to search_term string.
source code
dict
get_package_groups(self)
Return Entropy Package Groups metadata.
source code
bool
is_entropy_package_free(self, package_id, repository_id)
Return whether given Entropy package match tuple points to a free (as in freedom) package.
source code
dict
reorder_mirrors(self, repository_id, dry_run=False)
Reorder mirror list for given repository using a throughput-based benchmark.
source code
 
set_branch(self, branch)
Set new Entropy branch.
source code
 
switch_chroot(self, chroot)
Switch Entropy Client to work on given chroot.
source code
Method Details

benchmark_mirrors(self, mirrors)

source code 

Execute a throughput-oriented benchmark against the list of given Entropy Packages mirrors. Return a new sorted list.

generate_package(self, entropy_package_metadata, save_directory, edb=True, fake=False, compression='bz2', shiftpath=None)

source code 

Generate a valid Entropy package file from a full package metadata object (see entropy.db.skel.EntropyRepositoryBase.getPackageData()) and save it into save_directory directory, package content is read from disk, so this method works fine ONLY for installed packages.

Parameters:
  • entropy_package_metadata (dict) - entropy package metadata
  • save_directory (string) - directory where to store the package file
  • edb (bool) - add Entropy database metadata at the end of the file
  • fake (bool) - create a fake package (empty)
  • compression (string) - supported compressions: "gz", "bz2" or "" (no compression)
  • shiftpath (string) - if package files are stored into an alternative root directory.
Returns: string or None
path to generated package file or None (if error)

get_licenses_to_accept(self, *args, **kwargs)

source code 

Return, for given package matches, what licenses have to be accepted.

Parameters:
  • package_matches (list) - list of entropy package matches [(package_id, repository_id), ...]
Returns: dict
dictionary composed by license id as key and list of package matches as value.
Decorators:
  • @sharedinstlock

get_meant_packages(self, search_term, from_installed=False, valid_repos=None)

source code 

Return a list of package matches that are phonetically similar to search_term string.

Parameters:
  • search_string (string) - the search string
  • from_installed (bool) - if packages should be searched inside the installed packages repository only (instead of available package repositories, the default)
  • valid_repos (list) - list of repository identifiers that should be used instead of default ones.
Returns: list
list of package matches

get_package_groups(self)

source code 

Return Entropy Package Groups metadata. The returned dictionary contains information to make Entropy Client users to group packages into "macro" categories.

Returns: dict
Entropy Package Groups metadata

is_entropy_package_free(self, package_id, repository_id)

source code 

Return whether given Entropy package match tuple points to a free (as in freedom) package.

Parameters:
  • package_id (int) - package identifier
  • repository_id (string) - repository identifier
Returns: bool
True, if given entropy package is free (as in freedom)

reorder_mirrors(self, repository_id, dry_run=False)

source code 

Reorder mirror list for given repository using a throughput-based benchmark. This method is atomic and does not require locking, however, it uses a lock-free strategy to read and update SystemSettings configuration metadata and configuration files and can thus raise KeyError exceptions under a race condition. In this case, just retry the execution if you beliefe that your input data (the repository_id string) is valid.

Parameters:
  • repository_id (string) - repository identifier
  • dry_run (bool) - do not actually change repository mirrors order
Returns: dict
new repository metadata
Raises:
  • KeyError - if repository_id is not available

set_branch(self, branch)

source code 

Set new Entropy branch. This is NOT thread-safe. Please note that if you call this method all your repository instance references will become invalid. This is caused by close_repositories and SystemSettings clear methods. Once you changed branch, the repository databases won't be available until you fetch them (through Repositories class)

@param branch -- new branch @type branch basestring @return None

switch_chroot(self, chroot)

source code 

Switch Entropy Client to work on given chroot. Please consider this method EXPERIMENTAL. No verification will be made against given "chroot" path. By default, chroot equals to "". So, to switch back to default chroot, please pass chroot="".

Parameters:
  • chroot (string) - path to new valid chroot