Package entropy :: Package server :: Package interfaces :: Module main :: Class Server

Class Server

source code


Instance Methods
 
init_singleton(self, default_repository=None, save_repository=False, fake_default_repo=False, fake_default_repo_id=None, fake_default_repo_desc=None, handle_uninitialized=True, **kwargs)
Entropy Client Singleton interface.
source code
 
destroy(self, _from_shutdown=False)
Destroy this singleton instance.
source code
 
is_destroyed(self)
Return whether the singleton instance is destroyed.
source code
 
complete_remote_package_relative_path(self, pkg_rel_url, repository_id) source code
 
complete_local_upload_package_path(self, pkg_rel_url, repository_id) source code
 
complete_local_package_path(self, pkg_rel_url, repository_id) source code
list
remote_repository_mirrors(self, repository_id)
Return a list of remote repository mirrors (database) for given repository.
source code
list
remote_packages_mirrors(self, repository_id)
Return a list of remote packages mirrors (packages) for given repository.
source code
int
local_repository_revision(self, repository_id)
Return local repository revision.
source code
int
remote_repository_revision(self, repository_id)
Return the highest repository revision available on mirrors for given repository.
source code
list
repositories(self)
Return a list of available Entropy Server repositories.
source code
list
qa_repositories(self)
Return a list of QA-testable available Entropy Server repositories.
source code
 
repository(self)
Return the current repository marked as default.
source code
entropy.qa.QAInterface instance
QA(self)
Get Entropy QA Interface instance.
source code
entropy.spm.plugins.skel.SpmPlugin based instance
Spm(self)
Get Source Package Manager interface instance.
source code
 
Spm_class(self)
Get Source Package Manager interface class.
source code
 
ConfigurationUpdates(self)
Return Entropy Configuration File Updates management object.
source code
entropy.transceivers.EntropyTransceiver
Transceiver(self, uri)
Get EntropyTransceiver interface instance.
source code
 
sets_available(self, *args, **kwargs) source code
 
sets_search(self, *args, **kwargs) source code
 
sets_match(self, *args, **kwargs) source code
 
atom_match(self, *args, **kwargs)
Match one or more packages inside all the available repositories.
source code
bool
mask_packages(self, repository_id, packages)
Mask given package dependencies for given repository, if any (otherwise use default one).
source code
bool
unmask_packages(self, repository_id, packages)
Unmask given package dependencies for given repository, if any (otherwise use default one).
source code
int
initialize_repository(self, repository_id, ask=True)
Initialize (and wipe all data!) given repository to empty status.
source code
int
tag_packages(self, package_matches, package_tag, ask=True)
Change version tag for given package matches.
source code
int
flushback_packages(self, repository_id, from_branches, ask=True)
When creating a new branch, for space reasons, packages are not moved to a new location.
source code
set
move_packages(self, package_ids, from_repository_id, to_repository_id, ask=True, pull_dependencies=False)
Move packages from a repository to another.
source code
set
copy_packages(self, package_ids, from_repository_id, to_repository_id, ask=True, pull_dependencies=False)
Copy packages from a repository to another.
source code
 
remove_packages(self, repository_id, package_ids)
Remove packages from given repository.
source code
 
sign_local_packages(self, repository_id, ask=True)
Sign local packages in given repository using GPG key hopefully set for it.
source code
 
orphaned_spm_packages_test(self) source code
 
drained_dependencies_test(self, repository_ids, use_cache=True)
Test repositories against missing dependencies taking into consideration the possibility of repositories being drained and their content merged into the repositories before them.
source code
set
injected_library_dependencies_test(self, repository_ids, use_cache=True)
Test repositories against missing library dependencies for injected packages.
source code
list
removed_reverse_dependencies_test(self, repository_ids, use_cache=True)
Test repositories against packages that have been removed from system (but not stored in an injected state) and are still in the repositories.
source code
list
revision_downgrades_test(self, repository_ids, use_cache=True)
Test against revision downgrades, we assume that if a package in a repository x has a lesser revision than the same package in repository x - 1, it might be a source of troubles.
source code
set
extended_dependencies_test(self, repository_ids, use_cache=True)
Test repository against missing dependencies.
source code
set
dependencies_test(self, repository_id, match_repo=None, use_cache=True)
Test repository against missing dependencies.
source code
int
test_shared_objects(self, repository_id, dump_results_to_file=False)
Test packages in repository, against missing shared objects.
source code
 
close_repositories(self, mask_clear=False)
Close all the previously opened (through open_repository()) repository instances.
source code
 
commit_repositories(self)
Execute commit on all the open (in rw) repositories.
source code
 
close_repository(self, entropy_repository)
Close single EntropyRepositoryBase instance, given its class object.
source code
dict
repository_metadata(self, repository_id)
Return Entropy Server repository configuration metadata.
source code
dict
available_repositories(self)
Return a dictionary representing available repositories metadata.
source code
 
switch_default_repository(self, repository_id, save=None, handle_uninitialized=True)
Change Entropy Server default (current) repository.
source code
bool
enable_repository(self, repository_id)
Enable a repository.
source code
bool
disable_repository(self, repository_id)
Disable a repository.
source code
entropy.server.interfaces.ServerPackagesRepository
open_repository(self, repository_id)
This method aims to improve class usability by providing an easier method to open Entropy Server-side repositories like it happens with Entropy Client-side ones.
source code
bool
remove_repository(self, repository_id, disable=False)
Remove Repository from those available, server-side override.
source code
EntropyRepositoryBase
open_server_repository(self, repository_id, read_only=True, no_upload=True, just_reading=False, indexing=True, warnings=True, do_cache=True, use_branch=None, lock_remote=True, is_new=False, do_treeupdates=True)
Open Server-side Entropy repository given its repository identifier.
source code
 
missing_runtime_dependencies_test(self, package_matches, ask=True, bump_packages=False)
Use Entropy QA interface to check package matches against missing runtime dependencies, adding them.
source code
set
add_packages_to_repository(self, repository_id, packages_data, ask=True)
Add package files to given repository.
source code
 
scan_package_changes(self, repository_ids=None, removal_repository_ids=None)
Scan, using Source Package Manager, for added/removed/updated packages.
source code

Inherited from client.interfaces.client.Client: Cacher, ClientSettings, PackageActionFactory, Repositories, RepositorySecurity, RepositoryWebServices, Security, Sets, Settings, WebServices, clear_cache, repository_packages_spm_sync, shutdown

Inherited from core.Singleton: __init__

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

Inherited from client.interfaces.dep.CalculatorsMixin: atom_search, calculate_available_packages, calculate_critical_updates, calculate_masked_packages, calculate_orphaned_packages, calculate_security_updates, calculate_updates, check_package_update, get_install_queue, get_masked_packages, get_removal_queue, get_reverse_queue, packages_expand, validate_package_removal

Inherited from client.interfaces.methods.RepositoryMixin: add_package_repository, add_repository, backup_repository, clean_downloaded_packages, close_installed_repository, filter_repositories, installed_repository, installed_repository_backups, installed_repository_path, open_generic_repository, open_temp_repository, reopen_installed_repository, repositories_checksum, restore_repository, shift_repository, unavailable_repositories

Inherited from client.interfaces.methods.MiscMixin: benchmark_mirrors, generate_package, get_licenses_to_accept, get_meant_packages, get_package_groups, is_entropy_package_free, reorder_mirrors, set_branch, switch_chroot

Inherited from client.interfaces.methods.MatchMixin: get_package_action, is_package_masked, is_package_masked_by_user, is_package_unmasked_by_user, mask_package, mask_package_generic, search_available_mimetype, search_installed_mimetype, unmask_package, unmask_package_generic

Class Methods
class object
get_repository(cls, repository_id)
Reimplemented from entropy.client.interfaces.client.Client class
source code

Inherited from output.TextInterface: ask_question, edit_file, input_box, output, set_title

Static Methods

Inherited from core.Singleton: __new__

Class Variables
  CACHE_DIR = '/var/lib/entropy/server_cache'
  SYSTEM_SETTINGS_PLG_ID = 'server_plugin'

Inherited from output.TextInterface: OUTPUT_LOCK

Inherited from client.interfaces.dep.CalculatorsMixin: DISABLE_ASAP_SCHEDULING, DISABLE_AUTOCONFLICT, DISABLE_NEEDED_SCANNING, DISABLE_REWRITE_SELECTED_MATCHES, DISABLE_SLOT_INTERSECTION

Properties

Inherited from client.interfaces.client.Client: logger

Inherited from object: __class__

Method Details

init_singleton(self, default_repository=None, save_repository=False, fake_default_repo=False, fake_default_repo_id=None, fake_default_repo_desc=None, handle_uninitialized=True, **kwargs)

source code 

Entropy Client Singleton interface. Your hitchhikers' guide to the Galaxy.

Parameters:
  • indexing - enable metadata indexing (default is True)
  • installed_repo - open installed packages repository? (default is True). Accepted values: True = open, False = open but consider it not available, -1 = do not even try to open
  • xcache - enable on-disk cache (default is True)
  • user_xcache - enable on-disk cache even for users not in the entropy group (default is False). Dangerous, could lead to cache inconsistencies.
  • repo_validation - validate all the available repositories and automatically exclude the faulty ones
  • url_fetcher - override default entropy.fetchers.UrlFetcher class usage. Provide your own implementation of UrlFetcher using this argument.
  • multiple_url_fetcher - override default entropy.fetchers.MultipleUrlFetcher class usage. Provide your own implementation of MultipleUrlFetcher using this argument.
Overrides: client.interfaces.client.Client.init_singleton
(inherited documentation)

destroy(self, _from_shutdown=False)

source code 

Destroy this singleton instance.

Overrides: client.interfaces.client.Client.destroy

is_destroyed(self)

source code 

Return whether the singleton instance is destroyed.

Overrides: client.interfaces.client.Client.is_destroyed

remote_repository_mirrors(self, repository_id)

source code 

Return a list of remote repository mirrors (database) for given repository.

Parameters:
  • repository_id (string) - repository identifier
Returns: list
list of available repository mirrors
Raises:
  • KeyError - if repository_id is invalid

remote_packages_mirrors(self, repository_id)

source code 

Return a list of remote packages mirrors (packages) for given repository.

Parameters:
  • repository_id (string) - repository identifier
Returns: list
list of available packages mirrors
Raises:
  • KeyError - if repository_id is invalid

local_repository_revision(self, repository_id)

source code 

Return local repository revision.

Parameters:
  • repository_id (string) - repository identifier
Returns: int
the actual repository revision

remote_repository_revision(self, repository_id)

source code 

Return the highest repository revision available on mirrors for given repository.

Parameters:
  • repository_id (string) - repository identifier
Returns: int
remote repository revision

repositories(self)

source code 

Return a list of available Entropy Server repositories.

Returns: list
list of available Entropy Server repositories
Overrides: client.interfaces.methods.RepositoryMixin.repositories

qa_repositories(self)

source code 

Return a list of QA-testable available Entropy Server repositories.

Returns: list
list of QA-testable available Entropy Server repositories

QA(self)

source code 

Get Entropy QA Interface instance.

Returns: entropy.qa.QAInterface instance
Entropy QA Interface instance
Overrides: client.interfaces.client.Client.QA

Spm(self)

source code 

Get Source Package Manager interface instance.

#@return: Source Package Manager interface instance

Returns: entropy.spm.plugins.skel.SpmPlugin based instance
Overrides: client.interfaces.client.Client.Spm

Spm_class(self)

source code 

Get Source Package Manager interface class.

Overrides: client.interfaces.client.Client.Spm_class

ConfigurationUpdates(self)

source code 

Return Entropy Configuration File Updates management object.

Overrides: client.interfaces.client.Client.ConfigurationUpdates

Transceiver(self, uri)

source code 

Get EntropyTransceiver interface instance.

Parameters:
  • uri (string) - EntropyTransceiver URI
Returns: entropy.transceivers.EntropyTransceiver
EntropyTransceiver instance

atom_match(self, *args, **kwargs)

source code 

Match one or more packages inside all the available repositories.

Overrides: client.interfaces.dep.CalculatorsMixin.atom_match
(inherited documentation)

mask_packages(self, repository_id, packages)

source code 

Mask given package dependencies for given repository, if any (otherwise use default one).

Parameters:
  • repository_id (string) - repository identifier
  • packages (list) - list of package dependency strings
Returns: bool
mask status, True if ok, False if not

unmask_packages(self, repository_id, packages)

source code 

Unmask given package dependencies for given repository, if any (otherwise use default one).

Parameters:
  • repository_id (string) - repository identifier
  • packages (list) - list of package dependency strings
Returns: bool
mask status, True if ok, False if not

initialize_repository(self, repository_id, ask=True)

source code 

Initialize (and wipe all data!) given repository to empty status.

Parameters:
  • repository_id (string) - repository identifier
  • ask (bool) - ask before making any change?
Returns: int
execution status (0 = fine)

tag_packages(self, package_matches, package_tag, ask=True)

source code 

Change version tag for given package matches.

Parameters:
  • package_matches (list) - list of Entropy package matches
  • package_tag (string) - new Entropy package tag string
Returns: int
execution status (0 = fine)

flushback_packages(self, repository_id, from_branches, ask=True)

source code 

When creating a new branch, for space reasons, packages are not moved to a new location. This works fine until old branch is removed. To avoid inconsistences, before deciding to do that, all the packages in the old branch should be flushed back to the the currently configured branch.

Parameters:
  • repository_id (string) - repository identifier
  • from_branches (list) - list of branches to move packages from
  • ask (bool @return execution status (0 = fine)) - ask before making any change?
Returns: int

move_packages(self, package_ids, from_repository_id, to_repository_id, ask=True, pull_dependencies=False)

source code 

Move packages from a repository to another.

Parameters:
  • package_ids (list) - list of package identifiers contained in from_repository_id repository
  • from_repository_id (string) - source repository identifier
  • to_repository_id (string) - destination repository identifier
  • ask (bool) - execute in interactive mode
  • pull_dependencies (bool) - also include reverse dependencies in move
Returns: set
list (set) of moved package identifiers

copy_packages(self, package_ids, from_repository_id, to_repository_id, ask=True, pull_dependencies=False)

source code 

Copy packages from a repository to another.

Parameters:
  • package_ids (list) - list of package identifiers contained in from_repository_id repository
  • from_repository_id (string) - source repository identifier
  • to_repository_id (string) - destination repository identifier
  • ask (bool) - execute in interactive mode
  • pull_dependencies (bool) - also include reverse dependencies in copy
Returns: set
list (set) of copied package identifiers

remove_packages(self, repository_id, package_ids)

source code 

Remove packages from given repository.

Parameters:
  • repository_id (string) - repository identifier
  • package_ids (list) - list of package identifiers contained in from_repository_id repository

sign_local_packages(self, repository_id, ask=True)

source code 

Sign local packages in given repository using GPG key hopefully set for it.

Raises:
  • OnlineMirrorError - if package path is not available after having tried to download it, this should never happen btw.

drained_dependencies_test(self, repository_ids, use_cache=True)

source code 
Test repositories against missing dependencies taking into
consideration the possibility of repositories being drained
and their content merged into the repositories before them.
So, if you have 3 repositories, say: main, limbo, hell, this
method will test:
- hell drained and merged into main and limbo
- limbo and hell drained and merged into main

@param repository_ids: ordered list of repository identifiers
    to test, like the output of Server.repositories()
@type repository_ids: list
@keyword use_cache: use on-disk cache
@type use_cache: bool
@return: list (set) of unsatisfied dependencies
@rtype: set

injected_library_dependencies_test(self, repository_ids, use_cache=True)

source code 

Test repositories against missing library dependencies for injected packages. Injected packages are not actually tracking any specific package on the system, thus they need particular attention in terms of library-level dependencies.

Parameters:
  • repository_ids (list) - ordered list of repository identifiers to test, like the output of Server.repositories()
  • use_cache (bool) - use on-disk cache
Returns: set
list (set) of package matches with broken dependencies

removed_reverse_dependencies_test(self, repository_ids, use_cache=True)

source code 

Test repositories against packages that have been removed from system (but not stored in an injected state) and are still in the repositories. For each of them, print a list of direct reverse dependencies that should be fixed.

Parameters:
  • repository_ids (list) - repository identifiers to consider
  • use_cache (bool) - use on-disk cache
Returns: list
an ordered list of orphaned package matches (sorted by atom).

revision_downgrades_test(self, repository_ids, use_cache=True)

source code 

Test against revision downgrades, we assume that if a package in a repository x has a lesser revision than the same package in repository x - 1, it might be a source of troubles. package equality is when atom_1 = atom_2 for each couples of elements in x and x - 1. There are O(nm) couples.

Parameters:
  • repository_ids (list) - repository identifiers to consider
  • use_cache (bool) - use on-disk cache
Returns: list
an ordered list of package matches with problems (sorted by atom).

extended_dependencies_test(self, repository_ids, use_cache=True)

source code 

Test repository against missing dependencies. Moreover, the base repository (the first listed in server.conf) is tested by itself, since it must always be self-contained.

Parameters:
  • repository_ids (list) - list of repository identifiers to test
  • use_cache (bool) - use on-disk cache
Returns: set
list (set) of unsatisfied dependencies

dependencies_test(self, repository_id, match_repo=None, use_cache=True)

source code 

Test repository against missing dependencies.

Parameters:
  • repository_id (string) - repository identifier
  • match_repo (list) - list of repositories to look for missing deps
  • use_cache (bool) - use on-disk cache
Returns: set
list (set) of unsatisfied dependencies
Overrides: client.interfaces.dep.CalculatorsMixin.dependencies_test

test_shared_objects(self, repository_id, dump_results_to_file=False)

source code 

Test packages in repository, against missing shared objects.

Parameters:
  • repository_id (string) - repository identifier
  • dump_results_to_file (bool) - dump results to file
Returns: int
execution status (0 = fine)

close_repositories(self, mask_clear=False)

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 - clear package masking information if True
Overrides: client.interfaces.methods.RepositoryMixin.close_repositories
(inherited documentation)

close_repository(self, entropy_repository)

source code 

Close single EntropyRepositoryBase instance, given its class object.

Parameters:
  • entropy_repository (entropy.db.skel.EntropyRepositoryBase) - EntropyRepositoryBase instance

repository_metadata(self, repository_id)

source code 

Return Entropy Server repository configuration metadata.

Returns: dict
repository configuration metadata
Raises:
  • KeyError - if repository is not configured or available

available_repositories(self)

source code 

Return a dictionary representing available repositories metadata.

Returns: dict
available repository metadata

switch_default_repository(self, repository_id, save=None, handle_uninitialized=True)

source code 

Change Entropy Server default (current) repository.

Parameters:
  • repository_id (string) - repository identifier
  • save (bool) - if True, save the default repository in server configuration
  • handle_uninitialized (bool) - if repository is uninitialized, handle the case automatically

enable_repository(self, repository_id)

source code 

Enable a repository.

Parameters:
  • repository_id (string) - repository identifier
  • enable (bool) - True for enable, False for disable
Returns: bool
True, if switch went fine, False otherwise
Overrides: client.interfaces.methods.RepositoryMixin.enable_repository

disable_repository(self, repository_id)

source code 

Disable a repository.

Parameters:
  • repository_id (string) - repository identifier
Returns: bool
True, if switch went fine, False otherwise
Raises:
  • ValueError - if repository is not available
  • ValueError - if repository is a package repository
Overrides: client.interfaces.methods.RepositoryMixin.disable_repository

get_repository(cls, repository_id)
Class Method

source code 

Reimplemented from entropy.client.interfaces.client.Client class

Parameters:
  • repository_id - repository identifier
Returns: class object
EntropyRepositoryBase based class
Overrides: client.interfaces.methods.RepositoryMixin.get_repository

open_repository(self, repository_id)

source code 

This method aims to improve class usability by providing an easier method to open Entropy Server-side repositories like it happens with Entropy Client-side ones. If you just want open a read-only repository, feel free to use this wrapping method.

Parameters:
  • repository_id (string) - repository identifier
Returns: entropy.server.interfaces.ServerPackagesRepository
ServerPackagesRepository instance
Overrides: client.interfaces.methods.RepositoryMixin.open_repository

remove_repository(self, repository_id, disable=False)

source code 

Remove Repository from those available, server-side override.

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

open_server_repository(self, repository_id, read_only=True, no_upload=True, just_reading=False, indexing=True, warnings=True, do_cache=True, use_branch=None, lock_remote=True, is_new=False, do_treeupdates=True)

source code 

Open Server-side Entropy repository given its repository identifier.

Parameters:
  • repository_id (string) - repository identifier
  • read_only (bool) - open repository in read-only
  • no_upload (bool) - allow to force the upload of the repository if required
  • just_reading (bool) - open the repository just for the purpose of getting data from it, without any fancy action. This avoids triggering some forced behaviours. If just_reading is True, read_only is forced to True.
  • indexing (bool) - allow repository indexing
  • warnings (bool) - show warnings to user if True
  • do_cache (bool) - use cache to retrieve a fresh repository object
  • use_branch (bool) - override default package branch when opening a new repository
  • lock_remote (bool) - lock remote mirrors when opening
  • is_new (bool) - set this to True if the repository has been just created
  • do_treeupdates (allow the execution of package names and slot updates)
Returns: EntropyRepositoryBase
EntropyRepositoryBase instance
Raises:

missing_runtime_dependencies_test(self, package_matches, ask=True, bump_packages=False)

source code 

Use Entropy QA interface to check package matches against missing runtime dependencies, adding them.

Parameters:
  • package_matches (list) - list of Entropy package matches
  • ask (bool) - if missing runtime dependencies should be validated interactively
  • bump_packages (bool) - True, if packages should be bumped (revision bumped)

add_packages_to_repository(self, repository_id, packages_data, ask=True)

source code 

Add package files to given repository. packages_data contains a list of tuples composed by (path to package files, execute_injection boolean). Injection is a way to avoid a package being removed from the repository automatically when an updated package is added.

Parameters:
  • repository_id (string) - repository identifier
  • packages_data (list) - list of tuples composed by ([path, path1], bool) The first path object represents the main package file. While the others represent further package files. If one ends with eptConst['packagesdebugext'], it will be considered as debuginfo package file.
Returns: set
list (set) of package identifiers added

scan_package_changes(self, repository_ids=None, removal_repository_ids=None)

source code 

Scan, using Source Package Manager, for added/removed/updated packages. Please note that in order to trigger SPM level package moves, it is better to also call Spm().package_names_update() before this, or opening all the repos in read/write (read_only=False).

Parameters:
  • repository_ids (list or iterable) - list of repository identifiers to include in the scanning process. By default: the list of available repositories.
  • removal_repository_ids (list or set) - list of repository identifiers to include in the list of removable packages. By default, only the default repository.
Returns:
tuple composed of (1) list of spm package name and spm package id, (2) list of entropy package matches for packages to be removed (3) list of entropy package matches for packages to be injected.