Package entropy :: Package db :: Module skel :: Class EntropyRepositoryBase

Class EntropyRepositoryBase

source code


EntropyRepository interface base class. This is an abstact class containing abstract methods that subclasses need to reimplement. Every Entropy repository object has to inherit this class.

Nested Classes
  ModuleProxy
Instance Methods
 
__init__(self, readonly, xcache, temporary, name, direct=False, cache_policy=None)
EntropyRepositoryBase constructor.
source code
 
acceptLicense(self, license_name)
Mark license name as accepted by user.
source code
object
acquire_exclusive(self)
Acquire an exclusive file lock for this repository.
source code
object
acquire_shared(self)
Acquire a shared file lock for this repository.
source code
int
addPackage(self, pkg_data, revision=-1, package_id=None, formatted_content=False)
Add package to this Entropy repository.
source code
 
addRepositoryUpdatesActions(self, repository, actions, branch)
This method should be considered internal and not suited for general audience.
source code
int
alignDatabases(self, dbconn, force=False, output_header=' ', align_limit=300)
Align packages contained in foreign repository "dbconn" and this instance.
source code
bool
arePackageIdsAvailable(self, package_ids)
Return whether list of package identifiers are available.
source code
tuple or set
atomMatch(self, atom, matchSlot=None, multiMatch=False, maskFilter=True, extendedResults=False, useCache=True)
Match given atom (or dependency) in repository and return its package identifer and execution status.
source code
 
atomMatchCacheKey(self)
Return a string that shall be used as part of the atomMatch cache key string generation.
source code
 
bumpTreeUpdatesActions(self, updates)
This method should be considered internal and not suited for general audience.
source code
 
cache_policy(self)
Return the currently set in-RAM cache policy.
source code
 
cache_policy_all(self)
Return whether the cache policy is EntropyRepositoryCachePolicies.ALL.
source code
 
cache_policy_none(self)
Return whether the cache policy is EntropyRepositoryCachePolicies.NONE.
source code
bool
caching(self)
Return whether caching is enabled in this repository.
source code
string
checksum(self, do_order=False, strict=True, include_signatures=False, include_dependencies=False)
Get Repository metadata checksum, useful for integrity verification.
source code
 
clean(self)
Run repository metadata cleanup over unused references.
source code
 
clearCache(self)
Clear repository cache.
source code
 
clearPackageSets(self)
Clear Package sets (group of packages) entries in repository.
source code
 
clearTreeupdatesEntries(self, repository)
This method should be considered internal and not suited for general audience.
source code
 
close(self, safe=False)
Close repository storage communication and open disk files.
source code
 
commit(self, force=False, no_plugins=False)
Commit actual changes and make them permanently stored.
source code
frozenset
contentDiff(self, package_id, dbconn, dbconn_package_id, extended=False)
Return content metadata difference between two packages.
source code
 
createAllIndexes(self)
Create all the repository metadata indexes internally available.
source code
 
direct(*args, **kwds)
Avoid acquiring any kind of lock, disable caches and access directly to the underlying repository data.
source code
 
directed(self)
Return whether direct mode is enabled or not for the current thread.
source code
 
dropAllIndexes(self)
Drop all repository metadata indexes.
source code
 
dropChangelog(self)
Drop all packages' ChangeLogs metadata from repository, a memory hog.
source code
 
dropContent(self)
Drop all "content" metadata from repository, usually a memory hog.
source code
 
dropContentSafety(self)
Drop all "contentsafety" metadata from repository, usually a memory hog.
source code
 
dropGpgSignatures(self)
Drop all packages' GPG signatures.
source code
 
dropInstalledPackageFromStore(self, package_id)
Note: this is used by installed packages repository (also known as client db).
source code
 
exclusive(*args, **kwds)
Acquire an exclusive file lock for this repository (context manager).
source code
 
exportRepository(self, dumpfile)
Export running database to file.
source code
list
filterTreeUpdatesActions(self, actions)
This method should be considered internal and not suited for general audience.
source code
int
getApi(self)
Get Entropy repository API.
source code
tuple
getBaseData(self, package_id)
Get a set of basic package metadata for provided package identifier.
source code
string or None
getDependency(self, iddependency)
Return dependency string for given dependency identifier.
source code
int
getFakeSpmUid(self)
Obtain auto-generated available negative Source Package Manager package identifier.
source code
string or None
getInstalledPackageRepository(self, package_id)
Return repository identifier from where package has been installed from.
source code
int or None
getInstalledPackageSource(self, package_id)
Return installed package source id (corresponding to "as dependency", "by user", in other words, the reason why the package is installed).
source code
dict
getPackageData(self, package_id, get_content=True, content_insert_formatted=False, get_changelog=True, get_content_safety=True)
Reconstruct all the package metadata belonging to provided package identifier into a dict object.
source code
int
getPackageIdFromDownload(self, download_relative_path, endswith=False)
Obtain repository package identifier from its relative download path string.
source code
frozenset
getPackageIds(self, atom)
Obtain repository package identifiers from atom string.
source code
string
getPackageXmlData(self, package_ids, get_content=True, get_changelog=True, get_content_safety=True)
Generate the XML of the packages passed through package_ids.
source code
set
getPackagesToRemove(self, name, category, slot, injected)
Return a list of packages that would be removed given name, category, slot and injection status.
source code
 
getScopeData(self, package_id)
Get a set of package metadata for provided identifier that can be used to determine the scope of package.
source code
string
getSetting(self, setting_name)
Return stored Repository setting.
source code
tuple
getStrictData(self, package_id)
Get a restricted (optimized) set of package metadata for provided package identifier.
source code
tuple
getStrictScopeData(self, package_id)
Get a restricted (optimized) set of package metadata for provided identifier that can be used to determine the scope of package.
source code
 
getTriggerData(self, package_id, content=True)
Get a set of basic package metadata for provided package identifier.
source code
tuple
getVersioningData(self, package_id)
Get package version information for provided package identifier.
source code
 
handlePackage(self, pkg_data, revision=None, formattedContent=False)
Update or add a package to repository automatically handling its scope and thus removal of previous versions if requested by the given metadata.
source code
 
initializeRepository(self)
This method (re)initializes the repository, dropping all its content.
source code
 
insertAutomergefiles(self, package_id, automerge_data)
Insert configuration files automerge information for package.
source code
 
insertBranchMigration(self, repository, from_branch, to_branch, post_migration_md5sum, post_upgrade_md5sum)
Insert Entropy Client "branch migration" scripts hash metadata.
source code
 
insertConflicts(self, package_id, conflicts)
Insert dependency conflicts for package.
source code
 
insertContent(self, package_id, content, already_formatted=False)
Insert content metadata for package.
source code
 
insertDependencies(self, package_id, depdata)
Insert dependencies for package.
source code
 
insertPackageSets(self, sets_data)
Insert Package sets metadata into repository.
source code
 
insertPreservedLibrary(self, library, elfclass, path, atom)
Mark a library as preserved.
source code
 
insertSpmUid(self, package_id, spm_package_uid)
Insert Source Package Manager unique package identifier and bind it to Entropy package identifier given (package_id).
source code
 
insertTreeUpdatesActions(self, updates, repository)
This method should be considered internal and not suited for general audience.
source code
 
integrity_check(self)
Validates Entropy repository by doing advanced integrity checks.
source code
tuple
isBranchMigrationAvailable(self, repository, from_branch, to_branch)
Returns whether branch migration metadata given by the provided key (repository, from_branch, to_branch,) is available.
source code
bool or frozenset
isFileAvailable(self, path, get_id=False)
Return whether given file path is available in repository (owned by one or more packages).
source code
bool
isInjected(self, package_id)
Return whether package has been injected into repository (means that will be never ever removed due to colliding scope when other packages will be added).
source code
bool
isLicenseAccepted(self, license_name)
Return whether given license (through its name) has been accepted by user.
source code
bool
isLicenseDataKeyAvailable(self, license_name)
Return whether license name is available in License database, which is the one containing actual license texts.
source code
bool
isPackageIdAvailable(self, package_id)
Return whether given package identifier is available in repository.
source code
tuple
isPackageScopeAvailable(self, atom, slot, revision)
Return whether given package scope is available.
source code
bool
isSpmUidAvailable(self, spm_uid)
Return whether Source Package Manager package identifier is available in repository.
source code
bool
isSpmUidTrashed(self, spm_uid)
Return whether Source Package Manager package identifier has been trashed.
source code
bool
isSystemPackage(self, package_id)
Return whether package is part of core system (though, a system package).
source code
frozenset
listAllCategories(self, order_by=None)
List all categories available in repository.
source code
list
listAllDependencies(self)
List all dependencies available in repository.
source code
tuple or frozenset
listAllDownloads(self, do_sort=True, full_path=False)
List all package download URLs stored in repository.
source code
tuple or frozenset
listAllExtraDownloads(self, do_sort=True)
List all package extra download URLs stored in repository.
source code
int or tuple or frozenset
listAllFiles(self, clean=False, count=False)
List all file paths owned by packaged stored in repository.
source code
frozenset
listAllInjectedPackageIds(self)
List all injected package identifiers available in repository.
source code
tuple or frozenset
listAllPackageIds(self, order_by=None)
List all package identifiers available in repository.
source code
tuple
listAllPackages(self, get_scope=False, order_by=None)
List all packages in repository.
source code
tuple
listAllPreservedLibraries(self)
Return a list of all the recorded preserved libraries.
source code
tuple
listAllSpmUids(self)
List all Source Package Manager unique package identifiers bindings with packages in repository.
source code
frozenset
listAllSystemPackageIds(self)
List all system package identifiers available in repository.
source code
tuple
listAllTrashedSpmUids(self)
List all Source Package Manager unique package identifiers that have been marked as "trashed" by Entropy Server.
source code
 
listAllTreeUpdatesActions(self, no_ids_repos=False)
This method should be considered internal and not suited for general audience.
source code
list
listConfigProtectEntries(self, mask=False)
List CONFIG_PROTECT* entries (configuration file/directories protection).
source code
frozenset
listPackageIdsInCategory(self, category, order_by=None)
List package identifiers available in given category name.
source code
 
lock_path(self)
Return the path of the file lock for this repository.
source code
tuple
maskFilter(self, package_id, live=True)
Return whether given package identifier is available to user or not, reading package masking metadata stored in SystemSettings.
source code
 
moveSpmUidsToBranch(self, to_branch)
Note: this is not intended for general audience.
source code
float
mtime(self)
Return last modification time of given repository.
source code
bool
readonly(self)
Return whether the repository is read-only.
source code
 
regenerateSpmUidMapping(self)
Regenerate Source Package Manager <-> Entropy package identifiers mapping.
source code
 
release_exclusive(self, opaque)
Release the previously acquired exclusive file lock for this repository.
source code
 
release_shared(self, opaque)
Release the previously acquired shared file lock for this repository.
source code
 
removeConflicts(self, package_id)
Remove all the conflicts of package.
source code
 
removeDependencies(self, package_id)
Remove all the dependencies of package.
source code
 
removePackage(self, package_id, from_add_package=False)
Remove package from this Entropy repository using it's identifier (package_id).
source code
 
removePreservedLibrary(self, library, elfclass, path)
Remove a previously library marked as preserved.
source code
 
removeTrashedUids(self, spm_package_uids)
Remove given Source Package Manager unique package identifiers from the "trashed" list.
source code
 
removeTreeUpdatesActions(self, repository)
This method should be considered internal and not suited for general audience.
source code
string
repository_id(self)
Return the repository identifier assigned to this instance.
source code
 
resetTreeupdatesDigests(self)
This method should be considered internal and not suited for general audience.
source code
frozenset
resolveNeeded(self, needed, elfclass=-1, extended=False)
Resolve NEEDED ELF entry (a library name) to package_ids owning given needed (stressing, needed = library name)
source code
int or None
retrieveApi(self, package_id)
Return Entropy API in use when given package identifier was added.
source code
string or None
retrieveAtom(self, package_id)
Return "atom" metadatum for given package identifier.
source code
frozenset or dict
retrieveAutomergefiles(self, package_id, get_dict=False)
Return previously merged protected configuration files list and their md5 hashes for given package identifier.
source code
string or None
retrieveBranch(self, package_id)
Return "branch" metadatum for given package identifier.
source code
dict
retrieveBranchMigration(self, to_branch)
This method returns branch migration metadata stored in Entropy Client database (installed packages database).
source code
frozenset
retrieveBuildDependencies(self, package_id, extended=False, resolve_conditional_deps=True)
Return list of build time package dependencies for given package identifier.
source code
string or None
retrieveCategory(self, package_id)
Return category name for given package identifier.
source code
dict
retrieveCategoryDescription(self, category)
Return description text for given category.
source code
string or None
retrieveChangelog(self, package_id)
Return Source Package Manager ChangeLog for given package identifier.
source code
string or None
retrieveChangelogByKey(self, category, name)
Return Source Package Manager ChangeLog content for given package category and name.
source code
 
retrieveCompileFlags(self, package_id)
Return Compiler flags during building of package.
source code
frozenset
retrieveConflicts(self, package_id)
Return list of conflicting dependencies for given package identifier.
source code
dict or tuple or frozenset
retrieveContent(self, package_id, extended=False, formatted=False, insert_formatted=False, order_by=None)
Return files contained in given package.
source code
iterator
retrieveContentIter(self, package_id, order_by=None, reverse=False)
Return an iterator that makes possible to retrieve the files contained in given package.
source code
dict
retrieveContentSafety(self, package_id)
Return supported content safety metadata for given package.
source code
iterator
retrieveContentSafetyIter(self, package_id)
Return supported content safety metadata for given package in iterator form.
source code
string or None
retrieveCreationDate(self, package_id)
Return creation date for given package identifier.
source code
tuple or frozenset
retrieveDependencies(self, package_id, extended=False, deptype=None, exclude_deptypes=None, resolve_conditional_deps=True)
Return dependencies for given package identifier.
source code
frozenset
retrieveDependenciesList(self, package_id, exclude_deptypes=None, resolve_conditional_deps=True)
Return list of dependencies, including conflicts for given package identifier.
source code
string or None
retrieveDescription(self, package_id)
Return "description" metadatum for given package identifier.
source code
list
retrieveDesktopMime(self, package_id)
Return file association metadata for package.
source code
string or None
retrieveDigest(self, package_id)
Return "digest" metadatum for given package identifier.
source code
string or None
retrieveDownloadURL(self, package_id)
Return "download URL" metadatum for given package identifier.
source code
tuple
retrieveExtraDownload(self, package_id, down_type=None)
Retrieve a list of extra package file URLs for package identifier.
source code
string or None
retrieveHomepage(self, package_id)
Return "homepage" metadatum for given package identifier.
source code
 
retrieveKeySlot(self, package_id)
Return a tuple composed by package key and slot for given package identifier.
source code
string or None
retrieveKeySlotAggregated(self, package_id)
Return package key and package slot string (aggregated form through ":", for eg.: app-foo/foo:2).
source code
tuple
retrieveKeySlotTag(self, package_id)
Return package key, slot and tag tuple for given package identifier.
source code
 
retrieveKeySplit(self, package_id)
Return a tuple composed by package category and package name for given package identifier.
source code
frozenset
retrieveKeywords(self, package_id)
Return package SPM keyword list for given package identifier.
source code
string or None
retrieveLicense(self, package_id)
Return "license" metadatum for given package identifier.
source code
dict
retrieveLicenseData(self, package_id)
Return license metadata for given package identifier.
source code
frozenset
retrieveLicenseDataKeys(self, package_id)
Return license names available for given package identifier.
source code
string (raw format) or None
retrieveLicenseText(self, license_name)
Return license text for given license name.
source code
frozenset
retrieveManualDependencies(self, package_id, extended=False, resolve_conditional_deps=True)
Return manually added dependencies for given package identifier.
source code
frozenset
retrieveMirrorData(self, mirrorname)
Return available mirror URls for given mirror name.
source code
string or None
retrieveName(self, package_id)
Return "name" metadatum for given package identifier.
source code
tuple or dict
retrieveNeeded(self, package_id, extended=False, formatted=False)
Return "NEEDED" elf metadata for libraries contained in given package.
source code
frozenset
retrieveNeededLibraries(self, package_id)
Return the needed libraries for a given package.
source code
int
retrieveOnDiskSize(self, package_id)
Return "on disk size" metadatum for given package identifier.
source code
frozenset
retrievePackageSet(self, setname)
Return dependencies belonging to given package set name.
source code
dict
retrievePackageSets(self)
Return Package sets metadata stored in repository.
source code
frozenset
retrievePostDependencies(self, package_id, extended=False, resolve_conditional_deps=True)
Return list of post-merge package dependencies for given package identifier.
source code
frozenset
retrievePreservedLibraries(self, library, elfclass)
Return a list of paths associated with the given preserved library, if any.
source code
string
retrieveProtect(self, package_id)
Return CONFIG_PROTECT (configuration file protection) string (containing a list of space reparated paths) metadata for given package identifier.
source code
string
retrieveProtectMask(self, package_id)
Return CONFIG_PROTECT_MASK (mask for configuration file protection) string (containing a list of space reparated paths) metadata for given package identifier.
source code
frozenset
retrieveProvide(self, package_id)
Return list of dependencies/atoms are provided by the given package identifier (see Portage documentation about old-style PROVIDEs).
source code
frozenset
retrieveProvidedLibraries(self, package_id)
Return list of library names (from NEEDED ELF metadata) provided by given package identifier.
source code
frozenset
retrieveProvidedMime(self, package_id)
Return mime types associated to package.
source code
string
retrieveRepositoryUpdatesDigest(self, repository)
This method should be considered internal and not suited for general audience.
source code
tuple or frozenset
retrieveReverseDependencies(self, package_id, atoms=False, key_slot=False, exclude_deptypes=None, extended=False)
Return reverse (or inverse) dependencies for given package.
source code
int or None
retrieveRevision(self, package_id)
Return package Entropy-revision for given package identifier.
source code
frozenset
retrieveRuntimeDependencies(self, package_id, extended=False, resolve_conditional_deps=True)
Return list of runtime package dependencies for given package identifier.
source code
tuple
retrieveSignatures(self, package_id)
Return package file extra hashes (sha1, sha256, sha512) for given package identifier.
source code
int or None
retrieveSize(self, package_id)
Return "size" metadatum for given package identifier.
source code
string or None
retrieveSlot(self, package_id)
Return "slot" metadatum for given package identifier.
source code
dict or frozenset
retrieveSources(self, package_id, extended=False)
Return source package URLs for given package identifier.
source code
buffer
retrieveSpmMetadata(self, package_id)
This method retrieves Source Package Manager package metadata stored inside repository.
source code
string or None
retrieveSpmPhases(self, package_id)
Return "Source Package Manager install phases" for given package identifier.
source code
string or None
retrieveSpmRepository(self, package_id)
Return Source Package Manager source repository used at compile time.
source code
int
retrieveSpmUid(self, package_id)
Return Source Package Manager unique identifier bound to Entropy package identifier.
source code
string or None
retrieveTag(self, package_id)
Return "tag" metadatum for given package identifier.
source code
 
retrieveTreeUpdatesActions(self, repository)
This method should be considered internal and not suited for general audience.
source code
string or None
retrieveTrigger(self, package_id)
Return "trigger" script content for given package identifier.
source code
tuple
retrieveUnusedPackageIds(self)
Return packages (through their identifiers) not referenced by any other as dependency (unused packages).
source code
frozenset
retrieveUseflags(self, package_id)
Return "USE flags" metadatum for given package identifier.
source code
string or None
retrieveVersion(self, package_id)
Return package version for given package identifier.
source code
 
rollback(self)
Rollback last transaction, if it hasn't been already committed.
source code
set
runTreeUpdatesActions(self, actions)
Method not suited for general purpose usage.
source code
frozenset
searchBelongs(self, bfile, like=False)
Search packages which given file path belongs to.
source code
frozenset
searchCategory(self, keyword, like=False, just_id=False)
Search packages by category name.
source code
 
searchConflict(self, conflict, strings=False)
Search conflict dependency among packages.
source code
tuple
searchContentSafety(self, sfile)
Search content safety metadata (usually, sha256 and mtime) related to given file path.
source code
int or frozenset
searchDependency(self, dep, like=False, multi=False, strings=False)
Search dependency name in repository.
source code
frozenset
searchDescription(self, keyword, just_id=False)
Search packages using given description string as keyword.
source code
frozenset
searchHomepage(self, keyword, just_id=False)
Search packages using given homepage string as keyword.
source code
frozenset
searchKeySlot(self, key, slot)
Search package with given key and slot
source code
frozenset
searchKeySlotTag(self, key, slot, tag)
Search package with given key, slot and tag.
source code
frozenset
searchLicense(self, keyword, just_id=False)
Search packages using given license (mylicense).
source code
frozenset
searchName(self, keyword, sensitive=False, just_id=False)
Search packages by package name.
source code
frozenset
searchNameCategory(self, name, category, just_id=False)
Search packages matching given name and category strings.
source code
frozenset
searchNeeded(self, needed, elfclass=-1, like=False)
Search packages that need given NEEDED ELF entry (library name).
source code
frozenset
searchPackageIdFromDependencyId(self, dependency_id)
Search package identifiers owning dependency given (in form of dependency identifier).
source code
tuple
searchPackages(self, keyword, sensitive=False, slot=None, tag=None, order_by=None, just_id=False)
Search packages using given package name "keyword" argument.
source code
tuple
searchProvidedMime(self, mimetype)
Search package identifiers owning given mimetype.
source code
list
searchProvidedVirtualPackage(self, keyword)
Search in old-style Portage PROVIDE metadata.
source code
frozenset
searchRevisionedPackages(self, revision)
Search packages which "revision" metadatum matches the given one.
source code
frozenset
searchSets(self, keyword)
Search package sets in repository using given search keyword.
source code
tuple
searchSimilarPackages(self, keyword, atom=False)
Search similar packages (basing on package string given by mystring argument) using SOUNDEX algorithm.
source code
frozenset
searchSlotted(self, keyword, just_id=False)
Search packages with given slot string.
source code
frozenset
searchTaggedPackages(self, tag, atoms=False)
Search packages which "tag" metadatum matches the given one.
source code
frozenset
searchUseflag(self, keyword, just_id=False)
Search packages using given use flag string as keyword.
source code
 
setAtom(self, package_id, atom)
Set atom string for package.
source code
 
setBranchMigrationPostUpgradeMd5sum(self, repository, from_branch, to_branch, post_upgrade_md5sum)
Update "post-upgrade on new branch" script file md5 hash.
source code
 
setCategory(self, package_id, category)
Set category name for package.
source code
 
setCategoryDescription(self, category, description_data)
Set description for given category name.
source code
 
setContentSafety(self, package_id, content_safety)
Set (overwriting previous entries) new content safety metadata.
source code
 
setCreationDate(self, package_id, date)
Update the creation date for package.
source code
 
setDependency(self, iddependency, dependency)
Set dependency string for iddependency (dependency identifier).
source code
 
setDigest(self, package_id, digest)
Set package file md5sum for package.
source code
 
setDownloadURL(self, package_id, url)
Set download URL prefix for package.
source code
 
setInjected(self, package_id)
Mark package as injected, injection is usually set for packages manually added to repository.
source code
 
setInstalledPackageSource(self, package_id, source)
Set package source.
source code
 
setName(self, package_id, name)
Set name for package.
source code
 
setRepositoryUpdatesDigest(self, repository, digest)
This method should be considered internal and not suited for general audience.
source code
 
setRevision(self, package_id, revision)
Set Entropy revision for package.
source code
 
setSignatures(self, package_id, sha1, sha256, sha512, gpg=None)
Set package file extra hashes (sha1, sha256, sha512) for package.
source code
 
setSlot(self, package_id, slot)
Set slot string for package.
source code
 
setSpmUid(self, package_id, spm_package_uid, branch=None)
Update Source Package Manager unique package identifier for given Entropy package identifier (package_id).
source code
 
setTrashedUid(self, spm_package_uid)
Mark given Source Package Manager unique package identifier as "trashed".
source code
 
shared(*args, **kwds)
Acquire a shared file lock for this repository (context manager).
source code
 
storeInstalledPackage(self, package_id, repoid, source=0)
Note: this is used by installed packages repository (also known as client db).
source code
 
storeSpmMetadata(self, package_id, blob)
This method stores Source Package Manager package metadata inside repository.
source code
 
switchBranch(self, package_id, tobranch)
Switch branch string in repository to new value.
source code
bool
temporary(self)
Return wheter the repository is temporary (in-memory, for example).
source code
object or None
try_acquire_exclusive(self)
Try to acquire an exclusive file lock for this repository.
source code
object or None
try_acquire_shared(self)
Try to acquire a shared file lock for this repository.
source code
 
vacuum(self)
Repository storage cleanup and optimization function.
source code
 
validate(self)
Validates Entropy repository by doing basic integrity checks.
source code

Inherited from EntropyRepositoryPluginStore: add_plugin, get_plugin_metadata, get_plugins, get_plugins_metadata, remove_plugin, set_plugin_metadata

Inherited from core.EntropyPluginStore: drop_plugins, has_plugin

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

Class Methods

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

Static Methods
int
importRepository(dumpfile, db, data=None)
Import dump file to this database.
source code
int or None
remote_revision(repository_id)
Returns the repository remote revision in int format or None, if no revision is available.
source code
int or None
revision(repository_id)
Returns the repository local revision in int format or None, if no revision is available.
source code
int
update(entropy_client, repository_id, force, gpg)
Update the content of this repository.
source code

Inherited from EntropyRepositoryPluginStore: add_permanent_plugin, get_permanent_plugins, remove_permanent_plugin

Class Variables
  REPOSITORY_ALREADY_UPTODATE = -1
  REPOSITORY_CHECKSUM_ERROR = -4
  REPOSITORY_GENERIC_ERROR = -3
  REPOSITORY_NOT_AVAILABLE = -2
  REPOSITORY_PERMISSION_DENIED_ERROR = -5
  REPOSITORY_UPDATED_OK = 0
  SETTING_KEYS = ('arch', 'schema_revision')
  VIRTUAL_META_PACKAGE_CATEGORY = 'virtual'

Inherited from output.TextInterface: OUTPUT_LOCK

Properties

Inherited from object: __class__

Method Details

__init__(self, readonly, xcache, temporary, name, direct=False, cache_policy=None)
(Constructor)

source code 

EntropyRepositoryBase constructor.

Parameters:
  • readonly (bool) - readonly bit
  • xcache (bool) - xcache bit (enable on-disk cache?)
  • temporary (bool) - is this repo a temporary (non persistent) one?
  • name (string) - repository identifier (or name)
  • direct (bool) - True, if direct mode should be always enabled
Overrides: object.__init__

acceptLicense(self, license_name)

source code 

Mark license name as accepted by user. Only and only if user is allowed to accept them:

  • in entropy group
  • db not open in read only mode

Attention: call this method from your subclass, otherwise EntropyRepositoryPlugins won't be notified.

Parameters:
  • license_name (string) - license name

acquire_exclusive(self)

source code 

Acquire an exclusive file lock for this repository. This is used for inter-process synchronization only.

This locking infrastructure assumes that resources initialized during object instantiation are valid throughout the whole object lifecycle. If this is not the case, please synchronize using the Entropy Resources Lock.

The only effect of not using these synchronization methods is that stale results, incomplete results, None (in case of using a no longer valid package id, for instance) could be returned by methods. If your code can deal with such conditions, it is perfectly fine to avoid locking.

If direct mode is enabled, this method is a no-op.

This method can raise entropy.db.exceptions.LockAcquireError in case of lock acquisition errors.

Returns: object
an opaque that must be used to release the lock.

acquire_shared(self)

source code 

Acquire a shared file lock for this repository. This is used for inter-process synchronization only.

This locking infrastructure assumes that resources initialized during object instantiation are valid throughout the whole object lifecycle. If this is not the case, please synchronize using the Entropy Resources Lock.

The only effect of not using these synchronization methods is that stale results, incomplete results, None (in case of using a no longer valid package id, for instance) could be returned by methods. If your code can deal with such conditions, it is perfectly fine to avoid locking.

If direct mode is enabled, this method is a no-op.

This method can raise entropy.db.exceptions.LockAcquireError in case of lock acquisition errors.

Returns: object
an opaque that must be used to release the lock.

addPackage(self, pkg_data, revision=-1, package_id=None, formatted_content=False)

source code 

Add package to this Entropy repository. The main difference between handlePackage and this is that from here, no packages are going to be removed, in any case. For more information about pkg_data layout, please see handlePackage(). Attention: call this method from your subclass (AT THE END), otherwise EntropyRepositoryPlugins won't be notified.

Parameters:
  • pkg_data (dict) - Entropy package metadata
  • revision (int) - force a specific Entropy package revision
  • package_id (int) - add package to Entropy repository using the provided package identifier, this is very dangerous and could cause packages with the same identifier to be removed.
  • formatted_content (bool) - if True, determines whether the content metadata (usually the biggest part) in pkg_data is already prepared for insertion
Returns: int
new package identifier

addRepositoryUpdatesActions(self, repository, actions, branch)

source code 

This method should be considered internal and not suited for general audience. Add "treeupdates" actions for repository and branch provided.

Parameters:
  • repository (string) - repository identifier
  • actions (list) - list of raw treeupdates action strings
  • branch (string) - branch metadata to bind to the provided actions

alignDatabases(self, dbconn, force=False, output_header=' ', align_limit=300)

source code 

Align packages contained in foreign repository "dbconn" and this instance.

Parameters:
  • dbconn (entropy.db.EntropyRepository) - foreign repository instance
  • force (bool) - force alignment even if align_limit threshold is exceeded
  • output_header (string) - output header for printing purposes
  • align_limit (int) - threshold within alignment is done if force is False
Returns: int
alignment status (0 = all good; 1 = dbs checksum not matching; -1 = nothing to do)

arePackageIdsAvailable(self, package_ids)

source code 

Return whether list of package identifiers are available. They must be all available to return True

Parameters:
  • package_ids (iterable) - list of package indentifiers
Returns: bool
availability (True if all are available)

atomMatch(self, atom, matchSlot=None, multiMatch=False, maskFilter=True, extendedResults=False, useCache=True)

source code 

Match given atom (or dependency) in repository and return its package identifer and execution status.

Parameters:
  • atom (unicode string) - atom or dependency to match in repository
  • matchSlot (string) - match packages with given slot
  • multiMatch (bool) - match all the available packages, not just the best one
  • maskFilter (bool) - enable package masking filter
  • extendedResults (bool) - return extended results
  • useCache (bool) - use on-disk cache
Returns: tuple or set
tuple of length 2 composed by (package_id or -1, command status (0 means found, 1 means error)) or, if extendedResults is True, also add versioning information to tuple. If multiMatch is True, a tuple composed by a set (containing package identifiers) and command status is returned.

atomMatchCacheKey(self)

source code 

Return a string that shall be used as part of the atomMatch cache key string generation.

This method is intended to be used by subclasses. The base implementation returns an empty string.

bumpTreeUpdatesActions(self, updates)

source code 

This method should be considered internal and not suited for general audience. This method rewrites "treeupdates" metadata in repository.

Parameters:
  • updates (list) - new treeupdates metadata

caching(self)

source code 

Return whether caching is enabled in this repository.

Returns: bool
True, if caching is enabled

checksum(self, do_order=False, strict=True, include_signatures=False, include_dependencies=False)

source code 

Get Repository metadata checksum, useful for integrity verification. Note: result is cached in EntropyRepository.live_cache (dict).

Parameters:
  • do_order (bool) - order metadata collection alphabetically
  • strict (bool) - improve checksum accuracy
  • include_signatures (bool) - also include packages signatures (GPG, SHA1, SHA2, etc) into the returned hash
  • include_dependencies (bool) - also include package dependencies into the returned hash
Returns: string
repository checksum

clearCache(self)

source code 

Clear repository cache. Attention: call this method from your subclass, otherwise EntropyRepositoryPlugins won't be notified.

clearTreeupdatesEntries(self, repository)

source code 

This method should be considered internal and not suited for general audience. Clear "treeupdates" metadata for given repository identifier.

Parameters:
  • repository (string) - repository identifier

close(self, safe=False)

source code 

Close repository storage communication and open disk files. You can still use this instance, but closed files will be reopened. Attention: call this method from your subclass, otherwise EntropyRepositoryPlugins won't be notified of a repo close.

Parameters:
  • safe (bool) - if True, the MainThread resources won't be released. This is vital if both MainThread and a random thread access the Repository concurrently. With safe=False (original behaviour) MainThread cursors may become invalid and cause random exceptions in a racey fashion. But on the other hand, if closing all the resources is what is really wanted, safe must be False, or the MainThread ones will be never released.

commit(self, force=False, no_plugins=False)

source code 

Commit actual changes and make them permanently stored. Attention: call this method from your subclass, otherwise EntropyRepositoryPlugins won't be notified.

Parameters:
  • force (bool) - force commit, despite read-only bit being set
  • no_plugins (bool) - disable EntropyRepository plugins execution

contentDiff(self, package_id, dbconn, dbconn_package_id, extended=False)

source code 

Return content metadata difference between two packages.

Parameters:
  • package_id (int) - package indentifier available in this repository
  • dbconn (EntropyRepository) - other repository class instance
  • dbconn_package_id (int) - package identifier available in other repository
  • extended (bool) - also return filetype (it is not considered in the comparison)
Returns: frozenset
content difference
Raises:
  • AttributeError - when self instance and dbconn are the same

direct(*args, **kwds)

source code 

Avoid acquiring any kind of lock, disable caches and access directly to the underlying repository data.

In latency sensitive code paths, acquiring locks (especially file locks) and blocking may be impractical. This context manager makes possible to avoid that, at the price of returning stale or null data.

This method uses Thread Local Storage. In order to determine if direct mode is enabled, just call directed(). memory cache is not cleared by this method, but both shared() and exclusive() do that. Nested calls are reference counted, so it's possible to enter the direct() context more than once (in a nested way) without problems.

This method exists because some subclasses may have implemented their own in-memory caches and if the locks aren't acquired, they may contain stale data. However, keeping the cache clear may result in a big performance penalty due to the fact that cold caches kill latency.

Decorators:
  • @contextlib.contextmanager

directed(self)

source code 

Return whether direct mode is enabled or not for the current thread. See direct() for more information.

dropAllIndexes(self)

source code 

Drop all repository metadata indexes. Not cache!

dropContent(self)

source code 

Drop all "content" metadata from repository, usually a memory hog. Content metadata contains files and directories owned by packages.

dropContentSafety(self)

source code 

Drop all "contentsafety" metadata from repository, usually a memory hog. ContentSafety metadata contains mtime and sha256 hashes of files owned by package.

dropInstalledPackageFromStore(self, package_id)

source code 

Note: this is used by installed packages repository (also known as client db). Remove installed package metadata from "installed packages table". Note: this just removes extra metadata information such as repository identifier from where package has been installed and its install request source (user, pulled in dependency, etc). This method DOES NOT remove package from repository (see removePackage() instead).

Parameters:
  • package_id (int) - package indentifier

exclusive(*args, **kwds)

source code 

Acquire an exclusive file lock for this repository (context manager). This is used for inter-process synchronization only.

This locking infrastructure assumes that resources initialized during object instantiation are valid throughout the whole object lifecycle. If this is not the case, please synchronize using the Entropy Resources Lock.

If direct mode is enabled, this method is a no-op.

Decorators:
  • @contextlib.contextmanager

exportRepository(self, dumpfile)

source code 

Export running database to file.

Parameters:
  • dumpfile (file object (hint: open())) - dump file object to write to

filterTreeUpdatesActions(self, actions)

source code 

This method should be considered internal and not suited for general audience. Given a raw package name/slot updates list, it returns the action that should be really taken because not applied.

Parameters:
  • actions (list) - list of raw treeupdates actions, for example: ['move x11-foo/bar app-foo/bar', 'slotmove x11-foo/bar 2 3']
Returns: list
list of raw treeupdates actions that should be really worked out

getApi(self)

source code 

Get Entropy repository API.

Returns: int
Entropy repository API

getBaseData(self, package_id)

source code 

Get a set of basic package metadata for provided package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: tuple
tuple of length 19 composed by (atom, name, version, tag, description, category name, CHOST, CFLAGS, CXXFLAGS, homepage, license, branch, download path, digest, slot, api, creation date, package size, revision,) belonging to package_id

getDependency(self, iddependency)

source code 

Return dependency string for given dependency identifier.

Parameters:
  • iddependency (int) - dependency identifier
Returns: string or None
dependency string

getFakeSpmUid(self)

source code 

Obtain auto-generated available negative Source Package Manager package identifier.

Returns: int
new negative spm uid

getInstalledPackageRepository(self, package_id)

source code 

Return repository identifier from where package has been installed from.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
repository identifier

getInstalledPackageSource(self, package_id)

source code 

Return installed package source id (corresponding to "as dependency", "by user", in other words, the reason why the package is installed). Its value can be either one of the etpConst['install_sources'] values. In case of unavailable information, None is returned.

Parameters:
  • package_id (int) - package indentifier
Returns: int or None
install source identifier

getPackageData(self, package_id, get_content=True, content_insert_formatted=False, get_changelog=True, get_content_safety=True)

source code 

Reconstruct all the package metadata belonging to provided package identifier into a dict object.

Parameters:
  • package_id (int) - package indentifier
  • get_content (bool)
  • content_insert_formatted (bool)
  • get_changelog (bool) - return ChangeLog text metadatum or None
  • get_content_safety (bool) - return content_safety metadata or {}
Returns: dict
package metadata in dict() form
>>> data = {
    'atom': atom,
    'name': name,
    'version': version,
    'versiontag':versiontag,
    'description': description,
    'category': category,
    'chost': chost,
    'cflags': cflags,
    'cxxflags': cxxflags,
    'homepage': homepage,
    'license': mylicense,
    'branch': branch,
    'download': download,
    'digest': digest,
    'slot': slot,
    'etpapi': etpapi,
    'datecreation': datecreation,
    'size': size,
    'revision': revision,
    'counter': self.retrieveSpmUid(package_id),
    'trigger': self.retrieveTrigger(package_id),
    'disksize': self.retrieveOnDiskSize(package_id),
    'changelog': self.retrieveChangelog(package_id),
    'injected': self.isInjected(package_id),
    'systempackage': self.isSystemPackage(package_id),
    'config_protect': self.retrieveProtect(package_id),
    'config_protect_mask': self.retrieveProtectMask(package_id),
    'useflags': self.retrieveUseflags(package_id),
    'keywords': self.retrieveKeywords(package_id),
    'sources': sources,
    'needed_libs': self.retrieveNeededLibraries(package_id)
    'provided_libs': self.retrieveProvidedLibraries(package_id),
    'provide_extended': self.retrieveProvide(package_id),
    'conflicts': self.retrieveConflicts(package_id),
    'licensedata': self.retrieveLicenseData(package_id),
    'content': content,
    'content_safety': {},
    'pkg_dependencies': self.retrieveDependencies(package_id,
                                                  extended = True),
    'mirrorlinks': [[x,self.retrieveMirrorData(x)] for x in mirrornames],
    'signatures': signatures,
    'spm_phases': self.retrieveSpmPhases(package_id),
    'spm_repository': self.retrieveSpmRepository(package_id),
    'desktop_mime': [],
    'provided_mime': [],
    'original_repository': self.getInstalledPackageRepository(package_id),
    'extra_download': self.retrieveExtraDownload(package_id),
}

getPackageIdFromDownload(self, download_relative_path, endswith=False)

source code 

Obtain repository package identifier from its relative download path string.

Parameters:
  • download_relative_path (string) - relative download path string returned by "retrieveDownloadURL" method
  • endswith (bool) - search for package_id which download metadata ends with the one provided by download_relative_path
Returns: int
package_id in repository or -1 if not found

getPackageIds(self, atom)

source code 

Obtain repository package identifiers from atom string.

Parameters:
  • atom (string) - package atom
Returns: frozenset
list of matching package_ids found

getPackageXmlData(self, package_ids, get_content=True, get_changelog=True, get_content_safety=True)

source code 

Generate the XML of the packages passed through package_ids. It is possible to validate the schema using either package.dtd or package.xsd. The returned string does not contain any xml header and the root tag is <packages>. Please note that the current implementation generates the XML tree in RAM and doesn't do any kind of "streaming".

Parameters:
  • package_ids (list) - list of package identifiers
  • get_content (bool) - include the package content in the XML
  • get_changelog (bool) - include the package changelog in the XML
  • get_content_safety (bool) - include the content safety metadata in the XML
Returns: string
valid XML data

getPackagesToRemove(self, name, category, slot, injected)

source code 

Return a list of packages that would be removed given name, category, slot and injection status.

Parameters:
  • name (string) - package name
  • category (string) - package category
  • slot (string) - package slot
  • injected (bool) - injection status (packages marked as injected are always considered not automatically removable)
Returns: set
list (set) of removable packages (package_ids)

getScopeData(self, package_id)

source code 
Get a set of package metadata for provided identifier that can be
used to determine the scope of package.

@param package_id: package indentifier
@type package_id: int
@return: tuple of length 9 composed by
    (atom, category name, name, version,
        slot, tag, revision, branch, api,)
    belonging to package_id
@rtype: tuple

getSetting(self, setting_name)

source code 

Return stored Repository setting. For currently supported setting_name values look at EntropyRepository.SETTING_KEYS.

Parameters:
  • setting_name (string) - name of repository setting
Returns: string
setting value
Raises:
  • KeyError - if setting_name is not valid or available

getStrictData(self, package_id)

source code 

Get a restricted (optimized) set of package metadata for provided package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: tuple
tuple of length 6 composed by (package key, slot, version, tag, revision, atom) belonging to package_id

getStrictScopeData(self, package_id)

source code 

Get a restricted (optimized) set of package metadata for provided identifier that can be used to determine the scope of package.

Parameters:
  • package_id (int) - package indentifier
Returns: tuple
tuple of length 3 composed by (atom, slot, revision,) belonging to package_id

getTriggerData(self, package_id, content=True)

source code 
Get a set of basic package metadata for provided package identifier.
This method is optimized to work with Entropy Client installation
triggers returning only what is strictly needed.

@param package_id: package indentifier
@type package_id: int
@keyword content: if True, grabs the "content" metadata too, othewise
    such dict key value will be shown as empty set().
@type content: bool
@return: dictionary containing package metadata

    data = {
        'atom': atom,
        'category': category,
        'name': name,
        'version': version,
        'slot': slot,
        'versiontag': versiontag,
        'revision': revision,
        'branch': branch,
        'chost': chost,
        'cflags': cflags,
        'cxxflags': cxxflags,
        'etpapi': etpapi,
        'trigger': self.retrieveTrigger(package_id),
        'content': pkg_content,
        'spm_phases': self.retrieveSpmPhases(package_id),
    }

@rtype: dict or None

getVersioningData(self, package_id)

source code 

Get package version information for provided package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: tuple
tuple of length 3 composed by (version, tag, revision,) belonging to package_id

handlePackage(self, pkg_data, revision=None, formattedContent=False)

source code 
Update or add a package to repository automatically handling
its scope and thus removal of previous versions if requested by
the given metadata.
pkg_data is a dict() containing all the information bound to
a package:

    {
        'signatures':
            {
                'sha256': 'zzz',
                'sha1': 'zzz',
                'sha512': 'zzz'
         },
        'slot': '0',
        'datecreation': '1247681752.93',
        'description': 'Standard (de)compression library',
        'useflags': set(['kernel_linux']),
        'config_protect_mask': 'string string', 'etpapi': 3,
        'mirrorlinks': [],
        'cxxflags': '-Os -march=x86-64 -pipe',
        'injected': False,
        'licensedata': {'ZLIB': u"lictext"},
        'pkg_dependencies': tuple(),
        'chost': 'x86_64-pc-linux-gn',
        'config_protect': 'string string',
        'download': 'packages/amd64/4/sys-libs:zlib-1.2.3-r1.tbz2',
        'conflicts': set([]),
        'digest': 'fd54248ae060c287b1ec939de3e55332',
        'size': '136302',
        'category': 'sys-libs',
        'license': 'ZLIB',
        'sources': set(),
        'name': 'zlib',
        'versiontag': '',
        'changelog': u"text",
        'provide_extended': set([]),
        'trigger': 'text',
        'counter': 22331,
        'branch': '4',
        'content': {},
        'content_safety': {},
        'needed_libs': [('/usr/bin/foo', 'foo', 'libc.so.6', 2, '')],
        'version': '1.2.3-r1',
        'keywords': set(),
        'cflags': '-Os -march=x86-64 -pipe',
        'disksize': 932206, 'spm_phases': None,
        'homepage': 'http://www.zlib.net/',
        'systempackage': True,
        'revision': 0
    }

@param pkg_data: Entropy package metadata dict
@type pkg_data: dict
@keyword revision: force a specific package revision
@type revision: int
@keyword formattedContent: tells whether content metadata is already
    formatted for insertion
@type formattedContent: bool
@return: package identifier
@rtype: int

importRepository(dumpfile, db, data=None)
Static Method

source code 

Import dump file to this database.

Parameters:
  • dumpfile (string) - dump file to read
  • dbfile (string) - database file path or reference name
  • data (dict or None) - connection data (dict object)
Returns: int
import return code (0 = OK)
Raises:
  • AttributeError - if given paths are invalid

initializeRepository(self)

source code 

This method (re)initializes the repository, dropping all its content. Attention: call this method from your subclass, otherwise EntropyRepositoryPlugins won't be notified (AT THE END).

insertAutomergefiles(self, package_id, automerge_data)

source code 

Insert configuration files automerge information for package. "automerge_data" contains configuration files paths and their belonging md5 hash. This features allows entropy.client to "auto-merge" or "auto-remove" configuration files never touched by user. This method expects Unicode strings. Passing 8-bit raw strings will cause unpredictable results.

Parameters:
  • package_id (int) - package indentifier
  • automerge_data (list) - list of tuples of length 2. [('/path/to/conf/file', 'md5_checksum_string',) ... ]

insertBranchMigration(self, repository, from_branch, to_branch, post_migration_md5sum, post_upgrade_md5sum)

source code 

Insert Entropy Client "branch migration" scripts hash metadata. When upgrading from a branch to another, it can happen that repositories ship with scripts aiming to ease the upgrade. This method stores in the repository information on such scripts.

Parameters:
  • repository (string) - repository identifier
  • from_branch (string) - original branch
  • to_branch (string) - destination branch
  • post_migration_md5sum (string) - md5 hash related to "post-migration" branch script file
  • post_upgrade_md5sum (string) - md5 hash related to "post-upgrade on new branch" script file

insertConflicts(self, package_id, conflicts)

source code 

Insert dependency conflicts for package.

Parameters:
  • package_id (int) - package indentifier
  • conflicts (list) - list of dep. conflicts

insertContent(self, package_id, content, already_formatted=False)

source code 

Insert content metadata for package. "content" can either be a dict() or a list of triples (tuples of length 3, (package_id, path, type,)). This method expects Unicode strings. Passing 8-bit raw strings will cause unpredictable results.

Parameters:
  • package_id (int) - package indentifier
  • content (dict, list) - content metadata to insert. {'/path/to/foo': 'obj(content type)',} or [(package_id, path, type,) ...]
  • already_formatted (bool) - if True, "content" is expected to be already formatted for insertion, this means that "content" must be a list of tuples of length 3.

insertDependencies(self, package_id, depdata)

source code 

Insert dependencies for package. "depdata" is a dict() with dependency strings as keys and dependency type as values or a sequence of tuples composed by (dep, dep type).

Parameters:
  • package_id (int) - package indentifier
  • depdata (dict) - dependency dictionary {'app-foo/foo': dep_type_integer, ...}

insertPackageSets(self, sets_data)

source code 

Insert Package sets metadata into repository.

Parameters:
  • sets_data (dict) - dictionary containing package set names as keys and list (set) of dependencies as value

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

source code 

Mark a library as preserved.

Parameters:
  • library (string) - the library name (SONAME)
  • elfclass (int) - the ELF class of the library
  • path - the path where the library is currently stored
  • atom (string) - the atom string of the package providing the library

insertSpmUid(self, package_id, spm_package_uid)

source code 

Insert Source Package Manager unique package identifier and bind it to Entropy package identifier given (package_id). This method is used by Entropy Client and differs from "_bindSpmPackageUid" because any other colliding package_id<->uid binding is overwritten by design.

Parameters:
  • package_id (int) - package indentifier
  • spm_package_uid (int) - Source package Manager unique package identifier

insertTreeUpdatesActions(self, updates, repository)

source code 

This method should be considered internal and not suited for general audience. This method insert "treeupdates" metadata in repository.

Parameters:
  • updates (list) - new treeupdates metadata
  • repository (string) - insert treeupdates metadata for provided repository

integrity_check(self)

source code 

Validates Entropy repository by doing advanced integrity checks.

Raises:

isBranchMigrationAvailable(self, repository, from_branch, to_branch)

source code 

Returns whether branch migration metadata given by the provided key (repository, from_branch, to_branch,) is available.

Parameters:
  • repository (string) - repository identifier
  • from_branch (string) - original branch
  • to_branch (string) - destination branch
Returns: tuple
tuple composed by (1)post migration script md5sum and (2)post upgrade script md5sum

isFileAvailable(self, path, get_id=False)

source code 

Return whether given file path is available in repository (owned by one or more packages).

Parameters:
  • path (string) - path to file or directory
  • get_id (bool) - return list (set) of package_ids owning myfile
Returns: bool or frozenset
availability (True if available), when get_id is True, it returns a list (frozenset) of package_ids owning myfile

isInjected(self, package_id)

source code 

Return whether package has been injected into repository (means that will be never ever removed due to colliding scope when other packages will be added).

Parameters:
  • package_id (int) - package indentifier
Returns: bool
injection status (True if injected)

isLicenseAccepted(self, license_name)

source code 

Return whether given license (through its name) has been accepted by user.

Parameters:
  • license_name (string) - license name
Returns: bool
if license name has been accepted by user

isLicenseDataKeyAvailable(self, license_name)

source code 

Return whether license name is available in License database, which is the one containing actual license texts.

Parameters:
  • license_name (string) - license name which license text is available
Returns: bool
availability (True, if available)

isPackageIdAvailable(self, package_id)

source code 

Return whether given package identifier is available in repository.

Parameters:
  • package_id (int) - package indentifier
Returns: bool
availability (True if available)

isPackageScopeAvailable(self, atom, slot, revision)

source code 

Return whether given package scope is available. Also check if package found is masked and return masking reason identifier.

Parameters:
  • atom (string) - package atom string
  • slot (string) - package slot string
  • revision (int) - entropy package revision
Returns: tuple
tuple composed by (package_id or -1, idreason or 0,)

isSpmUidAvailable(self, spm_uid)

source code 

Return whether Source Package Manager package identifier is available in repository.

Parameters:
  • spm_uid (int) - Source Package Manager package identifier
Returns: bool
availability (True, if available)

isSpmUidTrashed(self, spm_uid)

source code 

Return whether Source Package Manager package identifier has been trashed. One is trashed when it gets removed from a repository while still sitting there in place on live system. This is a trick to allow multiple-repositories management to work fine when shitting around.

Parameters:
  • spm_uid (int) - Source Package Manager package identifier
Returns: bool
availability (True, if available)

isSystemPackage(self, package_id)

source code 

Return whether package is part of core system (though, a system package).

Parameters:
  • package_id (int) - package indentifier
Returns: bool
if True, package is part of core system

listAllCategories(self, order_by=None)

source code 

List all categories available in repository.

Parameters:
  • order_by (string) - order by "category"
Returns: frozenset
list (frozenset) of available package categories
Raises:
  • AttributeError - if order_by value is invalid

listAllDependencies(self)

source code 

List all dependencies available in repository.

Returns: list
list of tuples of length 2 containing (dependency id, dependency,)

listAllDownloads(self, do_sort=True, full_path=False)

source code 

List all package download URLs stored in repository.

Parameters:
  • do_sort (bool) - sort by name
  • full_path (bool) - return full URL (not just package file name)
Returns: tuple or frozenset
tuple (or set if do_sort is True) of package download URLs

listAllExtraDownloads(self, do_sort=True)

source code 

List all package extra download URLs stored in repository. All the extra download file names must end with etpConst['packagesextraext'] extension.

Parameters:
  • do_sort (bool) - sort by name
  • full_path (bool) - return full URL (not just package file name)
Returns: tuple or frozenset
tuple (or set if do_sort is True) of package download URLs

listAllFiles(self, clean=False, count=False)

source code 

List all file paths owned by packaged stored in repository.

Parameters:
  • clean (bool) - return a clean list (not duplicates)
  • count (bool) - count elements and return number
Returns: int or tuple or frozenset
tuple of files available or their count

listAllInjectedPackageIds(self)

source code 

List all injected package identifiers available in repository.

Injected packages are those not tracking any Source Package Manager packages.

Returns: frozenset
frozenset of package identifiers

listAllPackageIds(self, order_by=None)

source code 

List all package identifiers available in repository.

Parameters:
  • order_by (string) - order by "atom", "idpackage", "package_id", "branch", "name", "version", "versiontag", "revision", "slot", "date"
Returns: tuple or frozenset
tuple (if order_by) or frozenset of package identifiers
Raises:
  • AttributeError - if order_by value is invalid

listAllPackages(self, get_scope=False, order_by=None)

source code 

List all packages in repository.

Parameters:
  • get_scope (bool) - return also entropy package revision
  • order_by (string) - order by "atom", "idpackage", "package_id", "branch", "name", "version", "versiontag", "revision", "slot"
Returns: tuple
tuple of tuples of length 3 (or 4 if get_scope is True), containing (atom, package_id, branch,) if get_scope is False and (package_id, atom, slot, revision,) if get_scope is True
Raises:
  • AttributeError - if order_by value is invalid

listAllPreservedLibraries(self)

source code 

Return a list of all the recorded preserved libraries.

Returns: tuple
a list (tuple) of tuples composed by (library, elfclass, path, atom).

listAllSpmUids(self)

source code 

List all Source Package Manager unique package identifiers bindings with packages in repository.

Returns: tuple
tuple of tuples of length 2 composed by (spm_uid, package_id,)

listAllSystemPackageIds(self)

source code 

List all system package identifiers available in repository.

System packages are those directly marked as part of the base system.

Returns: frozenset
frozenset of package identifiers

listAllTrashedSpmUids(self)

source code 

List all Source Package Manager unique package identifiers that have been marked as "trashed" by Entropy Server.

Returns: tuple
list of identifiers

listAllTreeUpdatesActions(self, no_ids_repos=False)

source code 
This method should be considered internal and not suited for general
audience.
List all the available "treeupdates" (package names/slots changes
    directives) actions.
Actions must be sorted by date (FLOAT).

@keyword no_ids_repos: if True, it will just return a tuple of 3-length
    tuples containing ((command, branch, unix_time,), ...)
@type no_ids_repos: bool
@return: tuple of tuples
@rtype: tuple

listConfigProtectEntries(self, mask=False)

source code 

List CONFIG_PROTECT* entries (configuration file/directories protection).

Parameters:
  • mask (bool) - return CONFIG_PROTECT_MASK metadata instead of CONFIG_PROTECT
Returns: list
list of protected/masked directories

listPackageIdsInCategory(self, category, order_by=None)

source code 

List package identifiers available in given category name.

Parameters:
  • category_id (int) - cateogory name
  • order_by (string) - order by "atom", "idpackage", "package_id", "branch", "name", "version", "versiontag", "revision", "slot"
Returns: frozenset
list (frozenset) of available package identifiers in category.
Raises:
  • AttributeError - if order_by value is invalid

maskFilter(self, package_id, live=True)

source code 

Return whether given package identifier is available to user or not, reading package masking metadata stored in SystemSettings. NOTE: by default, this method doesn't filter any package. Subclasses have to reimplement this and setup a filtering logic in order to apply some filtering.

Parameters:
  • package_id (int) - package indentifier
  • live (bool) - use live masking feature
Returns: tuple
tuple composed by package_id and masking reason. If package_id returned package_id value == -1, it means that package is masked and a valid masking reason identifier is returned as second value of the tuple (see SystemSettings['pkg_masking_reasons'])

moveSpmUidsToBranch(self, to_branch)

source code 

Note: this is not intended for general audience. Move "branch" metadata contained in Source Package Manager package identifiers binding metadata to new value given by "from_branch" argument.

Parameters:
  • to_branch (string) - new branch string
  • from_branch (string) - old branch string

mtime(self)

source code 

Return last modification time of given repository.

Returns: float
mtime
Raises:
  • IOError - if mtime cannot be retrieved
  • OSError - if mtime cannot be retrieved (Operating System error)

readonly(self)

source code 

Return whether the repository is read-only. This method shall always check real access permissions.

Returns: bool
True, if repository is read-only

regenerateSpmUidMapping(self)

source code 

Regenerate Source Package Manager <-> Entropy package identifiers mapping. This method will use the Source Package Manger interface.

release_exclusive(self, opaque)

source code 

Release the previously acquired exclusive file lock for this repository. This is used for inter-process synchronization only.

Make sure to commit any pending transaction before releasing the lock.

The only effect of not using these synchronization methods is that stale results, incomplete results, None (in case of using a no longer valid package id, for instance) could be returned by methods. If your code can deal with such conditions, it is perfectly fine to avoid locking.

If direct mode is enabled, this method is a no-op.

This method can raise entropy.db.exceptions.LockAcquireError in case of lock acquisition errors.

Parameters:
  • opaque (object) - the opaque object returned by *acquire_exclusive methods.

release_shared(self, opaque)

source code 

Release the previously acquired shared file lock for this repository. This is used for inter-process synchronization only.

Make sure to commit any pending transaction before releasing the lock.

The only effect of not using these synchronization methods is that stale results, incomplete results, None (in case of using a no longer valid package id, for instance) could be returned by methods. If your code can deal with such conditions, it is perfectly fine to avoid locking.

If direct mode is enabled, this method is a no-op.

Parameters:
  • opaque (object) - the opaque object returned by *acquire_shared methods.

remote_revision(repository_id)
Static Method

source code 

Returns the repository remote revision in int format or None, if no revision is available.

Parameters:
  • repository_id (string) - repository identifier
Returns: int or None
repository revision
Raises:
  • KeyError - if repository is not available

removeConflicts(self, package_id)

source code 

Remove all the conflicts of package.

Parameters:
  • package_id (int) - package indentifier

removeDependencies(self, package_id)

source code 

Remove all the dependencies of package.

Parameters:
  • package_id (int) - package indentifier

removePackage(self, package_id, from_add_package=False)

source code 

Remove package from this Entropy repository using it's identifier (package_id). Attention: call this method from your subclass, otherwise EntropyRepositoryPlugins won't be notified.

Parameters:
  • package_id (int) - Entropy repository package indentifier
  • from_add_package (bool) - inform function that it's being called from inside addPackage().

removePreservedLibrary(self, library, elfclass, path)

source code 

Remove a previously library marked as preserved.

Parameters:
  • library (string) - the library name (SONAME)
  • elfclass (int) - the ELF class of the library
  • path - the path where the library is currently stored

removeTrashedUids(self, spm_package_uids)

source code 

Remove given Source Package Manager unique package identifiers from the "trashed" list. This is only used by Entropy Server.

removeTreeUpdatesActions(self, repository)

source code 

This method should be considered internal and not suited for general audience. This method removes "treeupdates" metadata in repository.

Parameters:
  • repository (string) - remove treeupdates metadata for provided repository

repository_id(self)

source code 

Return the repository identifier assigned to this instance.

Returns: string
the repository identifier

resetTreeupdatesDigests(self)

source code 

This method should be considered internal and not suited for general audience. Reset "treeupdates" digest metadata.

resolveNeeded(self, needed, elfclass=-1, extended=False)

source code 

Resolve NEEDED ELF entry (a library name) to package_ids owning given needed (stressing, needed = library name)

Parameters:
  • needed (string) - library name
  • elfclass (int) - look for library name matching given ELF class
  • extended (bool) - return a frozenset of tuple of length 2, first element is package_id, second is actual library path
Returns: frozenset
list of packages owning given library

retrieveApi(self, package_id)

source code 

Return Entropy API in use when given package identifier was added.

Parameters:
  • package_id (int) - package indentifier
Returns: int or None
Entropy API for given package identifier

retrieveAtom(self, package_id)

source code 

Return "atom" metadatum for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
atom string

retrieveAutomergefiles(self, package_id, get_dict=False)

source code 

Return previously merged protected configuration files list and their md5 hashes for given package identifier. This is part of the "automerge" feature which uses file md5 checksum to determine if a protected configuration file can be merged auto- matically.

Parameters:
  • package_id (int) - package indentifier
  • get_dict (bool) - return a dictionary with configuration file as key and md5 hash as value
Returns: frozenset or dict
automerge metadata for given package identifier

retrieveBranch(self, package_id)

source code 

Return "branch" metadatum for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
branch metadatum

retrieveBranchMigration(self, to_branch)

source code 

This method returns branch migration metadata stored in Entropy Client database (installed packages database). It is used to determine whether to run per-repository branch migration scripts.

Parameters:
  • to_branch (string) - usually the current branch string
Returns: dict
branch migration metadata contained in database

retrieveBuildDependencies(self, package_id, extended=False, resolve_conditional_deps=True)

source code 

Return list of build time package dependencies for given package identifier. Note: this function is just a wrapper of retrieveDependencies() providing deptype (dependency type) = post-dependencies.

Parameters:
  • package_id (int) - package indentifier
  • extended (bool) - return in extended format
  • resolve_conditional_deps (bool) - resolve conditional dependencies automatically by default, stuff like ( app-foo/foo | app-foo/bar ) & bar-baz/foo
Returns: frozenset
list (frozenset) of build dependencies of package

retrieveCategory(self, package_id)

source code 

Return category name for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
category where package is in

retrieveCategoryDescription(self, category)

source code 

Return description text for given category.

Parameters:
  • category (string) - category name
Returns: dict
category description dict, locale as key, description as value

retrieveChangelog(self, package_id)

source code 

Return Source Package Manager ChangeLog for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
ChangeLog content

retrieveChangelogByKey(self, category, name)

source code 

Return Source Package Manager ChangeLog content for given package category and name.

Parameters:
  • category (string) - package category
  • name (string) - package name
Returns: string or None
ChangeLog content

retrieveCompileFlags(self, package_id)

source code 
Return Compiler flags during building of package.
    (CHOST, CXXFLAGS, LDFLAGS)

@param package_id: package indentifier
@type package_id: int
@return: tuple of length 3 composed by (CHOST, CFLAGS, CXXFLAGS)
@rtype: tuple

retrieveConflicts(self, package_id)

source code 

Return list of conflicting dependencies for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: frozenset
list (frozenset) of conflicting package dependencies

retrieveContent(self, package_id, extended=False, formatted=False, insert_formatted=False, order_by=None)

source code 

Return files contained in given package.

Parameters:
  • package_id (int) - package indentifier
  • extended (bool) - return in extended format
  • formatted (bool) - return in dict() form
  • insert_formatted - return in list of tuples form, ready to be added with insertContent()
  • order_by (string) - order by string, valid values are: "type" (if extended is True), "file" or "package_id"
Returns: dict or tuple or frozenset
content metadata
Raises:
  • AttributeError - if order_by value is invalid

retrieveContentIter(self, package_id, order_by=None, reverse=False)

source code 

Return an iterator that makes possible to retrieve the files contained in given package. Please note that the iterator returned will fail if the EntropyRepository object is closed (call to close()). The iterator thus becomes invalid. Moreover, do not execute any other call that could invalidate the cursor object state before being done with it.

Parameters:
  • package_id (int) - package indentifier
  • order_by (string) - order by string, valid values are: "type" (if extended is True), "file" or "package_id"
  • reverse (bool) - return elements in reverse order
Returns: iterator
content metadata
Raises:
  • AttributeError - if order_by value is invalid

retrieveContentSafety(self, package_id)

source code 

Return supported content safety metadata for given package. Data returned is a dictionary, using package file path as key and dictionary as value. The latter, contains supported SPM content safety metadata, such as "sha256" (string) checksum, and "mtime" (float). The barely minimum is in fact, supporting sha256 and mtime of package files.

Parameters:
  • package_id (int) - package indentifier
Returns: dict
content safety metadata

retrieveContentSafetyIter(self, package_id)

source code 

Return supported content safety metadata for given package in iterator form. Each iterator item is composed by a (path, sha256, mtime) tuple. Please note that the iterator returned will fail if the EntropyRepository object is closed (call to close()). The iterator thus becomes invalid. Moreover, do not execute any other call that could invalidate the cursor object state before being done with it.

Parameters:
  • package_id (int) - package indentifier
  • order_by - order by string, valid values are: "type" (if extended is True), "file" or "package_id"
Returns: iterator
contentsafety metadata

retrieveCreationDate(self, package_id)

source code 

Return creation date for given package identifier. Creation date returned is a string representation of UNIX time format.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
creation date for given package identifier

retrieveDependencies(self, package_id, extended=False, deptype=None, exclude_deptypes=None, resolve_conditional_deps=True)

source code 

Return dependencies for given package identifier.

Parameters:
  • package_id (int) - package indentifier
  • extended (bool) - return in extended format (list of tuples of length 2 composed by dependency name and dependency type)
  • deptype (bool) - return only given type of dependencies see etpConst['dependency_type_ids']['*depend_id'] for dependency type identifiers
  • exclude_deptypes (list) - exclude given dependency types from returned data. Please see etpConst['dependency_type_ids'] for valid values. Anything != int will raise AttributeError
  • resolve_conditional_deps (bool) - resolve conditional dependencies automatically by default, stuff like ( app-foo/foo | app-foo/bar ) & bar-baz/foo
Returns: tuple or frozenset
dependencies of given package
Raises:
  • AttributeError - if exclude_deptypes contains illegal values

retrieveDependenciesList(self, package_id, exclude_deptypes=None, resolve_conditional_deps=True)

source code 

Return list of dependencies, including conflicts for given package identifier.

Parameters:
  • package_id (int) - package indentifier
  • exclude_deptypes (list) - exclude given dependency types from returned data. Please see etpConst['dependency_type_ids'] for valid values. Anything != int will raise AttributeError
  • resolve_conditional_deps (bool) - resolve conditional dependencies automatically by default, stuff like ( app-foo/foo | app-foo/bar ) & bar-baz/foo
Returns: frozenset
list (frozenset) of dependencies of package
Raises:
  • AttributeError - if exclude_deptypes contains illegal values

retrieveDescription(self, package_id)

source code 

Return "description" metadatum for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
package description

retrieveDesktopMime(self, package_id)

source code 

Return file association metadata for package.

Parameters:
  • package_id (int) - package indentifier
Returns: list
list of dict() containing file association information

retrieveDigest(self, package_id)

source code 

Return "digest" metadatum for given package identifier. "digest" refers to Entropy package file md5 checksum bound to given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
md5 checksum for given package identifier

retrieveDownloadURL(self, package_id)

source code 

Return "download URL" metadatum for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
download url metadatum

retrieveExtraDownload(self, package_id, down_type=None)

source code 

Retrieve a list of extra package file URLs for package identifier. These URLs usually contain extra files that can be optionally installed by Entropy Client, for example: debug files. All the extra download file names must end with etpConst['packagesextraext'] extension.

Parameters:
  • package_id (int) - package indentifier
  • down_type (string) - retrieve data for a given entry type. Currently supported entry types are: "debug", "data".
Returns: tuple
list (tuple) of dict containing "download", "type", "size", "disksize, "md5", "sha1","sha256", "sha512", "gpg" keys. "download" contains the relative URL (like the one returned by retrieveDownloadURL())
Raises:
  • AttributeError - if provided down_type value is invalid

retrieveHomepage(self, package_id)

source code 

Return "homepage" metadatum for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
package homepage

retrieveKeySlot(self, package_id)

source code 

Return a tuple composed by package key and slot for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns:
tuple of length 2 composed by (package_key, package_slot,)

retrieveKeySlotAggregated(self, package_id)

source code 

Return package key and package slot string (aggregated form through ":", for eg.: app-foo/foo:2). This method has been implemented for performance reasons.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
package key + ":" + slot string

retrieveKeySlotTag(self, package_id)

source code 

Return package key, slot and tag tuple for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: tuple
tuple of length 3 providing (package_key, slot, package_tag,)

retrieveKeySplit(self, package_id)

source code 

Return a tuple composed by package category and package name for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns:
tuple of length 2 composed by (package_category, package_name,)

retrieveKeywords(self, package_id)

source code 

Return package SPM keyword list for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: frozenset
list (frozenset) of keywords for given package identifier

retrieveLicense(self, package_id)

source code 

Return "license" metadatum for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
license string

retrieveLicenseData(self, package_id)

source code 

Return license metadata for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: dict
dictionary composed by license name as key and license text as value

retrieveLicenseDataKeys(self, package_id)

source code 

Return license names available for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: frozenset
list (frozenset) of license names which text is available in repository

retrieveLicenseText(self, license_name)

source code 

Return license text for given license name.

Parameters:
  • license_name (string) - license name (for eg. GPL-2)
Returns: string (raw format) or None
license text

retrieveManualDependencies(self, package_id, extended=False, resolve_conditional_deps=True)

source code 

Return manually added dependencies for given package identifier. Note: this function is just a wrapper of retrieveDependencies() providing deptype (dependency type) = manual-dependencies.

Parameters:
  • package_id (int) - package indentifier
  • extended (bool) - return in extended format
  • resolve_conditional_deps (bool) - resolve conditional dependencies automatically by default, stuff like ( app-foo/foo | app-foo/bar ) & bar-baz/foo
Returns: frozenset
list (frozenset) of manual dependencies of package

retrieveMirrorData(self, mirrorname)

source code 

Return available mirror URls for given mirror name.

Parameters:
  • mirrorname (string) - mirror name (for eg. "openoffice")
Returns: frozenset
list (frozenset) of URLs providing the "openoffice" mirroring service

retrieveName(self, package_id)

source code 

Return "name" metadatum for given package identifier. Attention: package name != atom, the former is just a subset of the latter.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
"name" metadatum for given package identifier

retrieveNeeded(self, package_id, extended=False, formatted=False)

source code 

Return "NEEDED" elf metadata for libraries contained in given package. Deprecated, use retrieveNeededLibraries.

Parameters:
  • package_id (int) - package indentifier
  • extended (bool) - also return ELF class information for every library name
  • formatted (bool) - properly format output, returning a dictionary with library name as key and ELF class as value
Returns: tuple or dict
"NEEDED" metadata for libraries contained in given package.

retrieveNeededLibraries(self, package_id)

source code 

Return the needed libraries for a given package.

Parameters:
  • package_id (int) - package indentifier
Returns: frozenset
list (frozenset) of tuples composed by library user path, library user soname, soname, elf class, rpath.

retrieveOnDiskSize(self, package_id)

source code 

Return "on disk size" metadatum for given package identifier. "on disk size" refers to unpacked Entropy package file size in bytes, which is in other words, the amount of space required on live system to have it installed (simplified explanation).

Parameters:
  • package_id (int) - package indentifier
Returns: int
on disk size metadatum

retrievePackageSet(self, setname)

source code 

Return dependencies belonging to given package set name. This method does not check if the given package set name is available and returns an empty list (set) in these cases.

Parameters:
  • setname (string) - Package set name
Returns: frozenset
list (set) of dependencies belonging to given package set name

retrievePackageSets(self)

source code 

Return Package sets metadata stored in repository.

Returns: dict
dictionary containing package set names as keys and list (set) of dependencies as value

retrievePostDependencies(self, package_id, extended=False, resolve_conditional_deps=True)

source code 

Return list of post-merge package dependencies for given package identifier. Note: this function is just a wrapper of retrieveDependencies() providing deptype (dependency type) = post-dependencies.

Parameters:
  • package_id (int) - package indentifier
  • extended (bool) - return in extended format
  • resolve_conditional_deps (bool) - resolve conditional dependencies automatically by default, stuff like ( app-foo/foo | app-foo/bar ) & bar-baz/foo
Returns: frozenset
list (frozenset) of post dependencies of package

retrievePreservedLibraries(self, library, elfclass)

source code 

Return a list of paths associated with the given preserved library, if any.

Returns: frozenset
the list (tuple) of paths associated with a SONAME and its ELF class.

retrieveProtect(self, package_id)

source code 

Return CONFIG_PROTECT (configuration file protection) string (containing a list of space reparated paths) metadata for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string
CONFIG_PROTECT string

retrieveProtectMask(self, package_id)

source code 

Return CONFIG_PROTECT_MASK (mask for configuration file protection) string (containing a list of space reparated paths) metadata for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string
CONFIG_PROTECT_MASK string

retrieveProvide(self, package_id)

source code 

Return list of dependencies/atoms are provided by the given package identifier (see Portage documentation about old-style PROVIDEs).

Parameters:
  • package_id (int) - package indentifier
Returns: frozenset
list (frozenset) of atoms provided by package

retrieveProvidedLibraries(self, package_id)

source code 

Return list of library names (from NEEDED ELF metadata) provided by given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: frozenset
list (frozenset) of tuples of length 3 composed by library name, path and ELF class

retrieveProvidedMime(self, package_id)

source code 

Return mime types associated to package. Mimetypes whose package can handle.

Parameters:
  • package_id (int) - package indentifier
Returns: frozenset
list (frozenset) of mimetypes

retrieveRepositoryUpdatesDigest(self, repository)

source code 

This method should be considered internal and not suited for general audience. Return digest (md5 hash) bound to repository package names/slots updates.

Parameters:
  • repository (string) - repository identifier
Returns: string
digest string

retrieveReverseDependencies(self, package_id, atoms=False, key_slot=False, exclude_deptypes=None, extended=False)

source code 

Return reverse (or inverse) dependencies for given package.

Parameters:
  • package_id (int) - package indentifier
  • atoms (bool) - if True, method returns list of atoms
  • key_slot (bool) - if True, method returns list of dependencies in key:slot form, example: (('app-foo/bar','2',), ...)
  • exclude_deptypes (iterable of ints) - exclude given dependency types from returned data. Please see etpConst['dependency_type_ids'] for valid values. Anything != int will raise AttributeError
  • extended (bool) - if True, the original dependency string will be returned along with the rest of information. So, if data returned would be a list of package identifiers (int), if extended = True this method will return a list of tuples composed by (package_id, dep_string). Same for atoms = True and key_slot = True.
Returns: tuple or frozenset
reverse dependency list (tuple) (or list of lists in case of extended = True)
Raises:
  • AttributeError - if exclude_deptypes contains illegal values

retrieveRevision(self, package_id)

source code 

Return package Entropy-revision for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: int or None
Entropy-revision for given package indentifier

retrieveRuntimeDependencies(self, package_id, extended=False, resolve_conditional_deps=True)

source code 

Return list of runtime package dependencies for given package identifier. Note: this function is just a wrapper of retrieveDependencies() providing deptype (dependency type) = runtime-dependencies.

Parameters:
  • package_id (int) - package indentifier
  • extended (bool) - return in extended format
  • resolve_conditional_deps (bool) - resolve conditional dependencies automatically by default, stuff like ( app-foo/foo | app-foo/bar ) & bar-baz/foo
Returns: frozenset
list (frozenset) of build dependencies of package

retrieveSignatures(self, package_id)

source code 

Return package file extra hashes (sha1, sha256, sha512) for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: tuple
tuple of length 3, sha1, sha256, sha512 package extra hashes if available, otherwise the same but with None as values.

retrieveSize(self, package_id)

source code 

Return "size" metadatum for given package identifier. "size" refers to Entropy package file size in bytes.

Parameters:
  • package_id (int) - package indentifier
Returns: int or None
size of Entropy package for given package identifier

retrieveSlot(self, package_id)

source code 

Return "slot" metadatum for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
package slot

retrieveSources(self, package_id, extended=False)

source code 

Return source package URLs for given package identifier. "source" as in source code.

Parameters:
  • package_id (int) - package indentifier
  • extended (bool)
Returns: dict or frozenset
if extended is True, dict composed by source URLs as key and list of mirrors as value, otherwise just a list (frozenset) of source package URLs.

retrieveSpmMetadata(self, package_id)

source code 

This method retrieves Source Package Manager package metadata stored inside repository.

Parameters:
  • package_id (int) - package indentifier
Returns: buffer
stored metadata

retrieveSpmPhases(self, package_id)

source code 

Return "Source Package Manager install phases" for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
"Source Package Manager available install phases" string

retrieveSpmRepository(self, package_id)

source code 

Return Source Package Manager source repository used at compile time.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
Source Package Manager source repository

retrieveSpmUid(self, package_id)

source code 

Return Source Package Manager unique identifier bound to Entropy package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: int
Spm UID or -1 (if not bound, valid for injected packages)

retrieveTag(self, package_id)

source code 

Return "tag" metadatum for given package identifier. Tagging packages allows, for example, to support multiple different, colliding atoms in the same repository and still being able to exactly reference them. It's actually used to provide versions of external kernel modules for different kernels.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
tag string

retrieveTreeUpdatesActions(self, repository)

source code 
This method should be considered internal and not suited for general
audience.
Return all the available "treeupdates (package names/slots changes
    directives) actions for provided repository.
Actions must be sorted by date (FLOAT).

@param repository: repository identifier
@type repository: string
@return: tuple of raw-string commands to run
@rtype: tuple

retrieveTrigger(self, package_id)

source code 

Return "trigger" script content for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
trigger script content

retrieveUnusedPackageIds(self)

source code 

Return packages (through their identifiers) not referenced by any other as dependency (unused packages).

Returns: tuple
unused package_ids ordered by atom

retrieveUseflags(self, package_id)

source code 

Return "USE flags" metadatum for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: frozenset
list (frozenset) of USE flags for given package identifier.

retrieveVersion(self, package_id)

source code 

Return package version for given package identifier.

Parameters:
  • package_id (int) - package indentifier
Returns: string or None
package version

revision(repository_id)
Static Method

source code 

Returns the repository local revision in int format or None, if no revision is available.

Parameters:
  • repository_id (string) - repository identifier
Returns: int or None
repository revision
Raises:
  • KeyError - if repository is not available

runTreeUpdatesActions(self, actions)

source code 

Method not suited for general purpose usage. Executes package name/slot update actions passed.

Parameters:
  • actions (list) - list of raw treeupdates actions, for example: ['move x11-foo/bar app-foo/bar', 'slotmove x11-foo/bar 2 3']
Returns: set
list (set) of packages that should be repackaged

searchBelongs(self, bfile, like=False)

source code 

Search packages which given file path belongs to.

Parameters:
  • bfile (string) - file path to search
  • like (bool) - do not match exact case
Returns: frozenset
list (frozenset) of package identifiers owning given file

searchCategory(self, keyword, like=False, just_id=False)

source code 

Search packages by category name.

Parameters:
  • keyword (string) - category name
  • like (bool) - do not match exact case
  • just_id (bool) - return list of package identifiers (set()) otherwise return a list of tuples of length 2 containing atom and package_id values
Returns: frozenset
list (frozenset) of tuples of length 2 containing atom and package_id values

searchConflict(self, conflict, strings=False)

source code 
Search conflict dependency among packages.

@param conflict:
@type conflict: string
@keyword strings: return a list of conflict names instead of a tuple of
    tuples of entropy package identifier and conflict dependency.
@type strings: bool
@return: if "strings" is False, a tuple of tuples of entropy package
    identifier and conflict dependency. if "strings" is True, a list
    (tuple) of conflict dependencies.
@rtype tuple

searchContentSafety(self, sfile)

source code 

Search content safety metadata (usually, sha256 and mtime) related to given file path. A list of dictionaries is returned, each dictionary item contains at least the following fields "package_id", "path", "sha256", "mtime").

Parameters:
  • sfile (string) - file path to search
Returns: tuple
content safety metadata list (tuple)

searchDependency(self, dep, like=False, multi=False, strings=False)

source code 

Search dependency name in repository. Returns dependency identifier (iddependency) or dependency strings (if strings argument is True).

Parameters:
  • dep (string) - dependency name
  • like (bool) - do not match exact case
  • multi (bool) - return all the matching dependency names
  • strings (bool) - return dependency names rather than dependency identifiers
Returns: int or frozenset
list (frozenset) of dependency identifiers (if multi is True) or strings (if strings is True) or dependency identifier

searchDescription(self, keyword, just_id=False)

source code 

Search packages using given description string as keyword.

Parameters:
  • keyword (string) - description sub-string to search
  • just_id (bool) - if True, only return a list of Entropy package identifiers
Returns: frozenset
frozenset of tuples of length 2 containing atom and package_id values. While if just_id is True, return a list (frozenset) of package_ids

searchHomepage(self, keyword, just_id=False)

source code 

Search packages using given homepage string as keyword.

Parameters:
  • keyword (string) - description sub-string to search
  • just_id (bool) - if True, only return a list of Entropy package identifiers
Returns: frozenset
frozenset of tuples of length 2 containing atom and package_id values. While if just_id is True, return a list (frozenset) of package_ids

searchKeySlot(self, key, slot)

source code 

Search package with given key and slot

Parameters:
  • key (string) - package key
  • slot (string) - package slot
Returns: frozenset
list (frozenset) of package identifiers

searchKeySlotTag(self, key, slot, tag)

source code 

Search package with given key, slot and tag.

Parameters:
  • key (string) - package key
  • slot (string) - package slot
  • tag (string) - restrict search using tag, if provided
Returns: frozenset
list (frozenset) of package identifiers

searchLicense(self, keyword, just_id=False)

source code 

Search packages using given license (mylicense).

Parameters:
  • keyword (string) - license name to search
  • just_id (bool) - just return package identifiers, otherwise a frozenset of tuples of length 2 is returned
Returns: frozenset
list (frozenset) of packages using given license

searchName(self, keyword, sensitive=False, just_id=False)

source code 

Search packages by package name.

Parameters:
  • keyword (string) - package name to search
  • sensitive (bool) - case sensitive?
  • just_id (bool) - return list of package identifiers (set()) otherwise return a list of tuples of length 2 containing atom and package_id values
Returns: frozenset
list (frozenset) of packages found

searchNameCategory(self, name, category, just_id=False)

source code 

Search packages matching given name and category strings. The search is always considered case sensitive.

Parameters:
  • name (string) - package name to search
  • category (string) - package category to search
  • just_id (bool) - return list of package identifiers (set()) otherwise return a list of tuples of length 2 containing atom and package_id values
Returns: frozenset
list (frozenset) of packages found

searchNeeded(self, needed, elfclass=-1, like=False)

source code 

Search packages that need given NEEDED ELF entry (library name). You must implement "*" wildcard support if like is True.

Parameters:
  • needed (string) - NEEDED ELF entry (shared object library name)
  • elfclass (int) - search NEEDEDs only with given ELF class
  • like (bool) - do not match exact case
Returns: frozenset
list (frozenset) of package identifiers

searchPackageIdFromDependencyId(self, dependency_id)

source code 

Search package identifiers owning dependency given (in form of dependency identifier).

Parameters:
  • dependency_id (int) - dependency identifier
Returns: frozenset
list (frozenset) of package identifiers owning given dependency identifier

searchPackages(self, keyword, sensitive=False, slot=None, tag=None, order_by=None, just_id=False)

source code 

Search packages using given package name "keyword" argument.

Parameters:
  • keyword (string) - package string
  • sensitive (bool) - case sensitive?
  • slot (string) - search matching given slot
  • tag (string) - search matching given package tag
  • order_by (string) - order results by "atom", "package_id", "branch", "name", "version", "versiontag", "revision", "slot"
  • just_id (bool) - just return package identifiers
Returns: tuple
packages found matching given search criterias
Raises:
  • AttributeError - if order_by value is invalid

searchProvidedMime(self, mimetype)

source code 

Search package identifiers owning given mimetype. Results are returned sorted by package name.

Parameters:
  • mimetype (string) - mimetype to search
Returns: tuple
list (tuple) of package indentifiers owning given mimetype.

searchProvidedVirtualPackage(self, keyword)

source code 

Search in old-style Portage PROVIDE metadata.

Parameters:
  • keyword (string) - search term
Returns: list
found PROVIDE metadata

To Do: rewrite docstring :-)

searchRevisionedPackages(self, revision)

source code 

Search packages which "revision" metadatum matches the given one.

Parameters:
  • revision (string) - Entropy revision to search
Returns: frozenset
list (frozenset) of packages using given tag

searchSets(self, keyword)

source code 

Search package sets in repository using given search keyword.

Parameters:
  • keyword (string) - package set name to search
Returns: frozenset
list (frozenset) of package sets available matching given keyword

searchSimilarPackages(self, keyword, atom=False)

source code 

Search similar packages (basing on package string given by mystring argument) using SOUNDEX algorithm.

Parameters:
  • keyword (string) - package string to search
  • atom (bool) - return full atoms instead of package names
Returns: tuple
list (tuple) of similar package names

searchSlotted(self, keyword, just_id=False)

source code 

Search packages with given slot string.

Parameters:
  • keyword (string) - slot to search
  • just_id (bool) - just return package identifiers, otherwise a frozenset of tuples of length 2 is returned
Returns: frozenset
list (frozenset) of packages using given slot

searchTaggedPackages(self, tag, atoms=False)

source code 

Search packages which "tag" metadatum matches the given one.

Parameters:
  • tag (string) - tag name to search
  • atoms (bool) - return list of atoms instead of package identifiers
Returns: frozenset
list of packages using given tag

searchUseflag(self, keyword, just_id=False)

source code 

Search packages using given use flag string as keyword. An exact search will be performed (keyword must match use flag)

Parameters:
  • keyword (string) - use flag to search
  • just_id (bool) - if True, only return a list of Entropy package identifiers
Returns: frozenset
frozenset of tuples of length 2 containing atom and package_id values. While if just_id is True, return a list (frozenset) of package_ids

setAtom(self, package_id, atom)

source code 

Set atom string for package. "Atom" is the full, unique name of a package.

Parameters:
  • package_id (int) - package indentifier
  • atom (string) - atom string

setBranchMigrationPostUpgradeMd5sum(self, repository, from_branch, to_branch, post_upgrade_md5sum)

source code 

Update "post-upgrade on new branch" script file md5 hash. When upgrading from a branch to another, it can happen that repositories ship with scripts aiming to ease the upgrade. This method stores in the repository information on such scripts.

Parameters:
  • repository (string) - repository identifier
  • from_branch (string) - original branch
  • to_branch (string) - destination branch
  • post_upgrade_md5sum (string) - md5 hash related to "post-upgrade on new branch" script file

setCategory(self, package_id, category)

source code 

Set category name for package.

Parameters:
  • package_id (int) - package indentifier
  • category (string) - category to set

setCategoryDescription(self, category, description_data)

source code 

Set description for given category name.

Parameters:
  • category (string) - category name
  • description_data (dict) - category description for several locales. {'en': "This is blah", 'it': "Questo e' blah", ... }

setContentSafety(self, package_id, content_safety)

source code 

Set (overwriting previous entries) new content safety metadata.

Parameters:
  • package_id (int) - package indentifier
  • content_safety (dict) - dictionary with the same data structure of the one returned by retrieveContentSafety()

setCreationDate(self, package_id, date)

source code 

Update the creation date for package. Creation date is stored in string based unix time format.

Parameters:
  • package_id (int) - package indentifier
  • date (string) - unix time in string form

setDependency(self, iddependency, dependency)

source code 

Set dependency string for iddependency (dependency identifier).

Parameters:
  • iddependency (int) - dependency string identifier
  • dependency (string) - dependency string

setDigest(self, package_id, digest)

source code 

Set package file md5sum for package. This information is used by entropy.client when downloading packages.

Parameters:
  • package_id (int) - package indentifier
  • digest (string) - md5 hash for package file

setDownloadURL(self, package_id, url)

source code 

Set download URL prefix for package.

Parameters:
  • package_id (int) - package indentifier
  • url (string) - URL prefix to set

setInjected(self, package_id)

source code 

Mark package as injected, injection is usually set for packages manually added to repository. Injected packages are not removed automatically even when featuring conflicting scope with other that are being added. If a package is injected, it means that maintainers have to handle it manually.

Parameters:
  • package_id (int) - package indentifier

setInstalledPackageSource(self, package_id, source)

source code 

Set package source. Please refer to getInstalledPackageSource() for more details about this field.

Parameters:
  • package_id (int) - package indentifier
  • source - install source identified
  • slot (int)

setName(self, package_id, name)

source code 

Set name for package.

Parameters:
  • package_id (int) - package indentifier
  • name (string) - package name

setRepositoryUpdatesDigest(self, repository, digest)

source code 

This method should be considered internal and not suited for general audience. Set "treeupdates" checksum (digest) for provided repository.

Parameters:
  • repository (string) - repository identifier
  • digest (string) - treeupdates checksum string (md5)

setRevision(self, package_id, revision)

source code 

Set Entropy revision for package.

Parameters:
  • package_id (int) - package indentifier
  • revision (int) - new revision

setSignatures(self, package_id, sha1, sha256, sha512, gpg=None)

source code 

Set package file extra hashes (sha1, sha256, sha512) for package.

Parameters:
  • package_id (int) - package indentifier
  • sha1 (string) - SHA1 hash for package file
  • sha256 (string) - SHA256 hash for package file
  • sha512 (string) - SHA512 hash for package file
  • gpg (string) - GPG signature file content

setSlot(self, package_id, slot)

source code 

Set slot string for package. Please refer to Portage SLOT documentation for more info.

Parameters:
  • package_id (int) - package indentifier
  • slot (string) - slot string

setSpmUid(self, package_id, spm_package_uid, branch=None)

source code 

Update Source Package Manager unique package identifier for given Entropy package identifier (package_id). This method *only* updates a currently available binding setting a new "spm_package_uid"

Parameters:
  • package_id (int) - package indentifier
  • spm_package_uid (int) - Source package Manager unique package identifier
  • branch (string) - current Entropy repository branch

setTrashedUid(self, spm_package_uid)

source code 

Mark given Source Package Manager unique package identifier as "trashed". This is a trick to allow Entropy Server to support multiple repositories and parallel handling of them without make it messing with removed packages from the underlying system.

Parameters:
  • spm_package_uid (int) - Source package Manager unique package identifier

shared(*args, **kwds)

source code 

Acquire a shared file lock for this repository (context manager). This is used for inter-process synchronization only.

This locking infrastructure assumes that resources initialized during object instantiation are valid throughout the whole object lifecycle. If this is not the case, please synchronize using the Entropy Resources Lock.

If direct mode is enabled, this method is a no-op.

Decorators:
  • @contextlib.contextmanager

storeInstalledPackage(self, package_id, repoid, source=0)

source code 

Note: this is used by installed packages repository (also known as client db). Add package identifier to the "installed packages table", which contains repository identifier from where package has been installed and its install request source (user, pulled in dependency, etc).

Parameters:
  • package_id (int) - package indentifier
  • repoid (string) - repository identifier
  • source (int) - source identifier (pleas see: etpConst['install_sources'])

storeSpmMetadata(self, package_id, blob)

source code 

This method stores Source Package Manager package metadata inside repository.

Parameters:
  • package_id (int) - package indentifier
  • blob (string or buffer) - metadata blob

switchBranch(self, package_id, tobranch)

source code 

Switch branch string in repository to new value.

Parameters:
  • package_id (int) - package identifier
  • tobranch (string) - new branch value

temporary(self)

source code 

Return wheter the repository is temporary (in-memory, for example).

Returns: bool
True, if repository is temporary

try_acquire_exclusive(self)

source code 

Try to acquire an exclusive file lock for this repository. This is used for inter-process synchronization only.

This locking infrastructure assumes that resources initialized during object instantiation are valid throughout the whole object lifecycle. If this is not the case, please synchronize using the Entropy Resources Lock.

The only effect of not using these synchronization methods is that stale results, incomplete results, None (in case of using a no longer valid package id, for instance) could be returned by methods. If your code can deal with such conditions, it is perfectly fine to avoid locking.

If direct mode is enabled, this method is a no-op.

This method can raise entropy.db.exceptions.LockAcquireError in case of lock acquisition errors.

Returns: object or None
an opaque object that must be used to release the lock, None otherwise.

try_acquire_shared(self)

source code 

Try to acquire a shared file lock for this repository. This is used for inter-process synchronization only.

This locking infrastructure assumes that resources initialized during object instantiation are valid throughout the whole object lifecycle. If this is not the case, please synchronize using the Entropy Resources Lock.

The only effect of not using these synchronization methods is that stale results, incomplete results, None (in case of using a no longer valid package id, for instance) could be returned by methods. If your code can deal with such conditions, it is perfectly fine to avoid locking.

If direct mode is enabled, this method is a no-op.

This method can raise entropy.db.exceptions.LockAcquireError in case of lock acquisition errors.

Returns: object or None
an opaque object that must be used to release the lock, None otherwise.

update(entropy_client, repository_id, force, gpg)
Static Method

source code 

Update the content of this repository. Every subclass can implement its own update way. This method must return a status code that can be either EntropyRepositoryBase.REPOSITORY_ALREADY_UPTODATE or EntropyRepositoryBase.REPOSITORY_NOT_AVAILABLE or EntropyRepositoryBase.REPOSITORY_GENERIC_ERROR or EntropyRepositoryBase.REPOSITORY_CHECKSUM_ERROR or EntropyRepositoryBase.REPOSITORY_UPDATED_OK If your repository is not supposed to be remotely updated, just ignore this method. Otherwise, if you intend to implement this method, make sure that any unprivileged call raises entropy.exceptions.PermissionDenied(). Only superuser should call this method.

Parameters:
  • entropy_client (entropy.client.interfaces.Client) - Entropy Client based object
  • repository_id (string) - repository identifier
  • force (bool) - force update anyway
  • gpg (bool) - GPG feature enable
Returns: int
status code

validate(self)

source code 

Validates Entropy repository by doing basic integrity checks.

Raises: