Package entropy :: Module db :: Class EntropyRepository

Class EntropyRepository

source code

EntropyRepository implements SQLite3 based storage. In a Model-View based pattern, it can be considered the "model". Actually it's the only one available but more model backends will be supported in future (which will inherit this class directly).

Every Entropy repository storage interface MUST inherit from this base class.


To Do: refactoring and generalization needed

Nested Classes
  Schema
Instance Methods
 
__init__(self, readOnly=False, noUpload=False, dbFile=None, clientDatabase=False, xcache=False, dbname='etpdb:', indexing=True, OutputInterface=None, skipChecks=False, useBranch=None, lockRemote=True)
EntropyRepository constructor.
source code
 
setCacheSize(self, size)
Change low-level, storage engine based cache size.
source code
 
setDefaultCacheSize(self, size)
Change default low-level, storage engine based cache size.
source code
 
__del__(self) source code
 
closeDB(self)
Close repository storage communication.
source code
 
vacuum(self)
Repository storage cleanup and optimization function.
source code
 
commitChanges(self, force=False)
Commit actual changes and make them permanently stored.
source code
 
taintDatabase(self)
Server-side method that render your repository storage tainted, modified.
source code
 
untaintDatabase(self)
Server-side method that render your repository storage NOT tainted, modified.
source code
bool
isDatabaseTainted(self)
Server-side function used to determine whether repository database has been modified.
source code
 
initializeDatabase(self)
WARNING: it will erase your database.
source code
list
filterTreeUpdatesActions(self, actions)
This method should be considered internal and not suited for general audience.
source code
set
runTreeUpdatesActions(self, actions)
Method not suited for general purpose usage.
source code
list
runTreeUpdatesMoveAction(self, move_command, quickpkg_queue)
Method not suited for general purpose usage.
source code
list
runTreeUpdatesSlotmoveAction(self, slotmove_command, quickpkg_queue)
Method not suited for general purpose usage.
source code
 
doTreeupdatesSpmCleanup(self, spm_moves)
Erase dead Source Package Manager db entries.
source code
 
handlePackage(self, pkg_data, forcedRevision=-1, 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
set
retrieve_packages_to_remove(self, name, category, slot, injected)
Return a list of packages that would be removed given name, category, slot and injection status.
source code
tuple
addPackage(self, pkg_data, revision=-1, idpackage=None, do_commit=True, formatted_content=False)
Add package to this Entropy repository.
source code
 
removePackage(self, idpackage, do_cleanup=True, do_commit=True, do_rss=True)
Remove package from this Entropy repository using it's identifier (idpackage).
source code
 
removeMirrorEntries(self, mirrorname)
Remove source packages mirror entries from database for the given mirror name.
source code
 
addMirrors(self, mirrorname, mirrorlist)
Add source package mirror entry to database.
source code
int
addCategory(self, category)
Add package category string to repository.
source code
int
addProtect(self, protect)
Add a single, generic CONFIG_PROTECT (not defined as _MASK/whatever here) path.
source code
int
addSource(self, source)
Add source code package download path to repository.
source code
int
addDependency(self, dependency)
Add dependency string to repository.
source code
int
addKeyword(self, keyword)
Add package SPM keyword string to repository.
source code
int
addUseflag(self, useflag)
Add package USE flag string to repository.
source code
int
addEclass(self, eclass)
Add package SPM Eclass string to repository.
source code
int
addNeeded(self, needed)
Add package libraries' ELF object NEEDED string to repository.
source code
int
addLicense(self, pkglicense)
Add package license name string to repository.
source code
int
addCompileFlags(self, chost, cflags, cxxflags)
Add package Compiler flags used to repository.
source code
 
setSystemPackage(self, idpackage, do_commit=True)
Mark a package as system package, which means that entropy.client will deny its removal.
source code
 
setInjected(self, idpackage, do_commit=True)
Mark package as injected, injection is usually set for packages manually added to repository.
source code
 
setCreationDate(self, idpackage, date)
Update the creation date for package.
source code
 
setDigest(self, idpackage, digest)
Set package file md5sum for package.
source code
 
setSignatures(self, idpackage, sha1, sha256, sha512)
Set package file extra hashes (sha1, sha256, sha512) for package.
source code
 
setDownloadURL(self, idpackage, url)
Set download URL prefix for package.
source code
 
setCategory(self, idpackage, category)
Set category name for package.
source code
 
setCategoryDescription(self, category, description_data)
Set description for given category name.
source code
 
setName(self, idpackage, name)
Set name for package.
source code
 
setDependency(self, iddependency, dependency)
Set dependency string for iddependency (dependency identifier).
source code
 
setAtom(self, idpackage, atom)
Set atom string for package.
source code
 
setSlot(self, idpackage, slot)
Set slot string for package.
source code
 
removeLicensedata(self, license_name)
Remove license text for given license name identifier.
source code
 
removeDependencies(self, idpackage)
Remove all the dependencies of package.
source code
 
insertDependencies(self, idpackage, depdata)
Insert dependencies for package.
source code
 
insertManualDependencies(self, idpackage, manual_deps)
Insert manually added dependencies to dep.
source code
 
removeContent(self, idpackage)
Remove content metadata for package.
source code
 
insertContent(self, idpackage, content, already_formatted=False)
Insert content metadata for package.
source code
 
insertNeededPaths(self, library, paths)
Insert paths where given ELF obj (library) name can be located.
source code
 
insertAutomergefiles(self, idpackage, automerge_data)
Insert configuration files automerge information for package.
source code
 
removeAutomergefiles(self, idpackage)
Remove configuration files automerge information for package.
source code
 
removeSignatures(self, idpackage)
Remove extra package file hashes (SHA1, SHA256, SHA512) for package.
source code
 
removeSpmPhases(self, idpackage)
Remove Source Package Manager phases for package.
source code
 
insertChangelog(self, category, name, changelog_txt)
Insert package changelog for package (in this case using category + name as key).
source code
 
removeChangelog(self, category, name)
Remove ChangeLog for package (in this case using category + name as key)
source code
 
insertLicenses(self, licenses_data)
insert license data (license names and text) into repository.
source code
 
insertConfigProtect(self, idpackage, idprotect, mask=False)
Insert CONFIG_PROTECT (configuration files protection) entry identifier for package.
source code
 
insertMirrors(self, mirrors)
Insert list of "mirror name" and "mirror list" into repository.
source code
 
insertKeywords(self, idpackage, keywords)
Insert keywords for package.
source code
 
insertUseflags(self, idpackage, useflags)
Insert Source Package Manager USE (components build) flags for package.
source code
 
insertSignatures(self, idpackage, sha1, sha256, sha512)
Insert package file extra hashes (sha1, sha256, sha512) for package.
source code
 
insertSpmPhases(self, idpackage, phases)
Insert Source Package Manager phases for package.
source code
 
insertSources(self, idpackage, sources)
Insert source code package download URLs for idpackage.
source code
 
insertConflicts(self, idpackage, conflicts)
Insert dependency conflicts for package.
source code
 
insertMessages(self, idpackage, messages)
Insert user messages for package.
source code
 
insertProvide(self, idpackage, provides)
Insert PROVIDE metadata for idpackage.
source code
 
insertNeeded(self, idpackage, neededs)
Insert package libraries' ELF object NEEDED string for package.
source code
 
insertEclasses(self, idpackage, eclasses)
Insert Source Package Manager used build specification file classes.
source code
 
insertOnDiskSize(self, idpackage, mysize)
Insert on-disk size (bytes) for package.
source code
 
insertTrigger(self, idpackage, trigger)
Insert built-in trigger script for package, containing pre-install, post-install, pre-remove, post-remove hooks.
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
 
setBranchMigrationPostUpgradeMd5sum(self, repository, from_branch, to_branch, post_upgrade_md5sum)
Update "post-upgrade on new branch" script file md5 hash.
source code
int
bindSpmPackageUid(self, idpackage, spm_package_uid, branch)
Bind Source Package Manager package identifier ("COUNTER" metadata for Portage) to Entropy package.
source code
 
insertSpmUid(self, idpackage, spm_package_uid, branch=None)
Insert Source Package Manager unique package identifier and bind it to Entropy package identifier given (idpackage).
source code
 
setTrashedUid(self, spm_package_uid)
Mark given Source Package Manager unique package identifier as "trashed".
source code
 
setSpmUid(self, idpackage, spm_package_uid, branch=None)
Update Source Package Manager unique package identifier for given Entropy package identifier (idpackage).
source code
set
contentDiff(self, idpackage, dbconn, dbconn_idpackage)
Return content metadata difference between two packages.
source code
 
doCleanups(self)
Run repository metadata cleanup over unused references.
source code
 
cleanupUseflags(self)
Cleanup "USE flags" metadata unused references to save space.
source code
 
cleanupSources(self)
Cleanup "sources" metadata unused references to save space.
source code
 
cleanupEclasses(self)
Cleanup "eclass" metadata unused references to save space.
source code
 
cleanupNeeded(self)
Cleanup "needed" metadata unused references to save space.
source code
 
cleanupNeededPaths(self)
Cleanup "needed paths" metadata unused references to save space.
source code
 
cleanupDependencies(self)
Cleanup "dependencies" metadata unused references to save space.
source code
 
cleanupChangelogs(self)
Cleanup "changelog" metadata unused references to save space.
source code
int
getNewNegativeSpmUid(self)
Obtain auto-generated available negative Source Package Manager package identifier.
source code
int
getApi(self)
Get Entropy repository API.
source code
string or None
getDependency(self, iddependency)
Return dependency string for given dependency identifier.
source code
string
getCategory(self, idcategory)
Get category name from category identifier.
source code
int
getIDPackage(self, atom)
Obtain repository package identifier from its atom string.
source code
int
getIDPackageFromDownload(self, download_relative_path, endswith=False)
Obtain repository package identifier from its relative download path string.
source code
set
getIDPackagesFromFile(self, file)
Obtain repository package identifiers for packages owning the provided path string (file).
source code
int
getIDCategory(self, category)
Obtain category identifier from category name.
source code
tuple
getVersioningData(self, idpackage)
Get package version information for provided package identifier.
source code
tuple
getStrictData(self, idpackage)
Get a restricted (optimized) set of package metadata for provided package identifier.
source code
tuple
getStrictScopeData(self, idpackage)
Get a restricted (optimized) set of package metadata for provided identifier that can be used to determine the scope of package.
source code
 
getScopeData(self, idpackage)
Get a set of package metadata for provided identifier that can be used to determine the scope of package.
source code
tuple
getBaseData(self, idpackage)
Get a set of basic package metadata for provided package identifier.
source code
 
getTriggerInfo(self, idpackage, content=True)
Get a set of basic package metadata for provided package identifier.
source code
dict
getPackageData(self, idpackage, get_content=True, content_insert_formatted=False, trigger_unicode=True)
Reconstruct all the package metadata belonging to provided package identifier into a dict object.
source code
 
clearCache(self, depends=False)
Clear on-disk repository cache.
source code
string
retrieveRepositoryUpdatesDigest(self, repository)
This method should be considered internal and not suited for general audience.
source code
 
listAllTreeUpdatesActions(self, no_ids_repos=False)
This method should be considered internal and not suited for general audience.
source code
 
retrieveTreeUpdatesActions(self, repository, forbranch=None)
This method should be considered internal and not suited for general audience.
source code
 
bumpTreeUpdatesActions(self, updates)
This method should be considered internal and not suited for general audience.
source code
 
removeTreeUpdatesActions(self, repository)
This method should be considered internal and not suited for general audience.
source code
 
insertTreeUpdatesActions(self, updates, repository)
This method should be considered internal and not suited for general audience.
source code
 
setRepositoryUpdatesDigest(self, repository, digest)
This method should be considered internal and not suited for general audience.
source code
 
addRepositoryUpdatesActions(self, repository, actions, branch)
This method should be considered internal and not suited for general audience.
source code
bool
doesTreeupdatesActionExist(self, repository, command, branch)
This method should be considered internal and not suited for general audience.
source code
 
clearPackageSets(self)
Clear Package sets (group of packages) entries in repository.
source code
 
insertPackageSets(self, sets_data)
Insert Package sets metadata into repository.
source code
dict
retrievePackageSets(self)
Return Package sets metadata stored in repository.
source code
set
retrievePackageSet(self, setname)
Return dependencies belonging to given package set name.
source code
set
retrieveSystemPackages(self)
Return a list of package identifiers that are part of the base system (thus, marked as system packages).
source code
string or None
retrieveAtom(self, idpackage)
Return "atom" metadatum for given package identifier.
source code
string or None
retrieveBranch(self, idpackage)
Return "branch" metadatum for given package identifier.
source code
string or None
retrieveTrigger(self, idpackage, get_unicode=False)
Return "trigger" script content for given package identifier.
source code
string or None
retrieveDownloadURL(self, idpackage)
Return "download URL" metadatum for given package identifier.
source code
string or None
retrieveDescription(self, idpackage)
Return "description" metadatum for given package identifier.
source code
string or None
retrieveHomepage(self, idpackage)
Return "homepage" metadatum for given package identifier.
source code
int
retrieveSpmUid(self, idpackage)
Return Source Package Manager unique identifier bound to Entropy package identifier.
source code
list
retrieveMessages(self, idpackage)
Return "messages" metadatum for given package identifier.
source code
int or None
retrieveSize(self, idpackage)
Return "size" metadatum for given package identifier.
source code
int
retrieveOnDiskSize(self, idpackage)
Return "on disk size" metadatum for given package identifier.
source code
string or None
retrieveDigest(self, idpackage)
Return "digest" metadatum for given package identifier.
source code
tuple
retrieveSignatures(self, idpackage)
Return package file extra hashes (sha1, sha256, sha512) for given package identifier.
source code
string or None
retrieveName(self, idpackage)
Return "name" metadatum for given package identifier.
source code
 
retrieveKeySlot(self, idpackage)
Return a tuple composed by package key and slot for given package identifier.
source code
string or None
retrieveKeySlotAggregated(self, idpackage)
Return package key and package slot string (aggregated form through ":", for eg.: app-foo/foo:2).
source code
tuple
retrieveKeySlotTag(self, idpackage)
Return package key, slot and tag tuple for given package identifier.
source code
string or None
retrieveVersion(self, idpackage)
Return package version for given package identifier.
source code
int or None
retrieveRevision(self, idpackage)
Return package Entropy-revision for given package identifier.
source code
string or None
retrieveCreationDate(self, idpackage)
Return creation date for given package identifier.
source code
int or None
retrieveApi(self, idpackage)
Return Entropy API in use when given package identifier was added.
source code
set
retrieveUseflags(self, idpackage)
Return "USE flags" metadatum for given package identifier.
source code
set
retrieveEclasses(self, idpackage)
Return "eclass" metadatum for given package identifier.
source code
string or None
retrieveSpmPhases(self, idpackage)
Return "Source Package Manager install phases" for given package identifier.
source code
set
retrieveNeededRaw(self, idpackage)
Return (raw format) "NEEDED" ELF metadata for libraries contained in given package.
source code
list or set
retrieveNeeded(self, idpackage, extended=False, format=False)
Return "NEEDED" elf metadata for libraries contained in given package.
source code
dict
retrieveNeededPaths(self, idpackage)
Return library linker paths available at the time package entered repository.
source code
set
retrieveNeededLibraryPaths(self, needed_library_name, elfclass)
Return registered library paths for given library name needed_library_name and ELF class.
source code
 
retrieveNeededLibraryIdpackages(self)
Return raw list of packages containing library with given ELF class.
source code
 
clearNeededLibraryIdpackages(self)
Clear package and library names binding metadata.
source code
 
setNeededLibraryIdpackages(self, library_map)
Inject given package <-> library name <-> ELF class map into repository.
source code
set
retrieveConflicts(self, idpackage)
Return list of conflicting dependencies for given package identifier.
source code
set
retrieveProvide(self, idpackage)
Return list of dependencies/atoms are provided by the given package identifier (see Portage documentation about old-style PROVIDEs).
source code
set
retrieveDependenciesList(self, idpackage)
Return list of dependencies, including conflicts for given package identifier.
source code
 
retrievePostDependencies(self, idpackage, extended=False)
Return list of post-merge package dependencies for given package identifier.
source code
 
retrieveManualDependencies(self, idpackage, extended=False)
Return manually added dependencies for given package identifier.
source code
list or set
retrieveDependencies(self, idpackage, extended=False, deptype=None, exclude_deptypes=None)
Return dependencies for given package identifier.
source code
set
retrieveIdDependencies(self, idpackage)
Return list of dependency identifiers for given package identifier.
source code
set
retrieveKeywords(self, idpackage)
Return package SPM keyword list for given package identifier.
source code
string
retrieveProtect(self, idpackage)
Return CONFIG_PROTECT (configuration file protection) string (containing a list of space reparated paths) metadata for given package identifier.
source code
string
retrieveProtectMask(self, idpackage)
Return CONFIG_PROTECT_MASK (mask for configuration file protection) string (containing a list of space reparated paths) metadata for given package identifier.
source code
dict or set
retrieveSources(self, idpackage, extended=False)
Return source package URLs for given package identifier.
source code
list or set
retrieveAutomergefiles(self, idpackage, get_dict=False)
Return previously merged protected configuration files list and their md5 hashes for given package identifier.
source code
dict or list or set
retrieveContent(self, idpackage, extended=False, contentType=None, formatted=False, insert_formatted=False, order_by='')
Return files contained in given package.
source code
string or None
retrieveChangelog(self, idpackage)
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
string or None
retrieveSlot(self, idpackage)
Return "slot" metadatum for given package identifier.
source code
string or None
retrieveVersionTag(self, idpackage)
Return "tag" metadatum for given package identifier.
source code
set
retrieveMirrorInfo(self, mirrorname)
Return available mirror URls for given mirror name.
source code
string or None
retrieveCategory(self, idpackage)
Return category name for given package identifier.
source code
dict
retrieveCategoryDescription(self, category)
Return description text for given category.
source code
dict
retrieveLicensedata(self, idpackage)
Return license metadata for given package identifier.
source code
set
retrieveLicensedataKeys(self, idpackage)
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
string or None
retrieveLicense(self, idpackage)
Return "license" metadatum for given package identifier.
source code
 
retrieveCompileFlags(self, idpackage)
Return Compiler flags during building of package.
source code
list or set
retrieveReverseDependencies(self, idpackage, atoms=False, key_slot=False, exclude_deptypes=None)
Return reverse (or inverse) dependencies for given package.
source code
list
retrieveUnusedIdpackages(self)
Return packages (through their identifiers) not referenced by any other as dependency (unused packages).
source code
int
isAtomAvailable(self, atom)
Return whether given atom is available in repository.
source code
bool
areIdpackagesAvailable(self, idpackages)
Return whether list of package identifiers are available.
source code
bool
isIdpackageAvailable(self, idpackage)
Return whether given package identifier is available in repository.
source code
bool
isCategoryAvailable(self, category)
Return whether given category is available in repository.
source code
bool
isProtectAvailable(self, protect)
Return whether given CONFIG_PROTECT* entry is available in repository.
source code
bool or set
isFileAvailable(self, myfile, get_id=False)
Return whether given file path is available in repository (owned by one or more packages).
source code
list or set
resolveNeeded(self, needed, elfclass=-1, extended=False)
Resolve NEEDED ELF entry (a library name) to idpackages owning given needed (stressing, needed = library name)
source code
int
isSourceAvailable(self, source)
Return whether given source package URL is available in repository.
source code
int
isDependencyAvailable(self, dependency)
Return whether given dependency string is available in repository.
source code
int
isKeywordAvailable(self, keyword)
Return whether keyword string is available in repository.
source code
int
isUseflagAvailable(self, useflag)
Return whether USE flag name is available in repository.
source code
int
isEclassAvailable(self, eclass)
Return whether eclass name is available in repository.
source code
int
isNeededAvailable(self, needed)
Return whether NEEDED ELF entry (library name) is available in repository.
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
isLicensedataKeyAvailable(self, license_name)
Return whether license name is available in License database, which is the one containing actual license texts.
source code
bool
isLicenseAccepted(self, license_name)
Return whether given license (through its name) has been accepted by user.
source code
 
acceptLicense(self, license_name)
Mark license name as accepted by user.
source code
int
isLicenseAvailable(self, pkglicense)
Return whether license metdatatum (NOT license name) is available in repository.
source code
bool
isSystemPackage(self, idpackage)
Return whether package is part of core system (though, a system package).
source code
bool
isInjected(self, idpackage)
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
areCompileFlagsAvailable(self, chost, cflags, cxxflags)
Return whether given Compiler FLAGS are available in repository.
source code
set
searchBelongs(self, file, like=False)
Search packages which given file path belongs to.
source code
set or list
searchEclassedPackages(self, eclass, atoms=False)
Search packages which their Source Package Manager counterpar are using given eclass.
source code
set or list
searchTaggedPackages(self, tag, atoms=False)
Search packages which "tag" metadatum matches the given one.
source code
set or list
searchLicenses(self, mylicense, caseSensitive=False, atoms=False)
Search packages using given license (mylicense).
source code
set or list
searchSlottedPackages(self, slot, atoms=False)
Search packages with given slot string.
source code
set
searchKeySlot(self, key, slot)
Search package with given key and slot
source code
set
searchNeeded(self, needed, like=False)
Search packages that need given NEEDED ELF entry (library name).
source code
int or set
searchDependency(self, dep, like=False, multi=False, strings=False)
Search dependency name in repository.
source code
set
searchIdpackageFromIddependency(self, iddep)
Search package identifiers owning dependency given (in form of dependency identifier).
source code
set
searchSets(self, keyword)
Search package sets in repository using given search keyword.
source code
set
searchSimilarPackages(self, mystring, atom=False)
Search similar packages (basing on package string given by mystring argument) using SOUNDEX algorithm (ahhh Google...).
source code
set or list
searchPackages(self, keyword, sensitive=False, slot=None, tag=None, order_by='atom', just_id=False)
Search packages using given package name "keyword" argument.
source code
list or set
searchProvide(self, keyword, slot=None, tag=None, justid=False)
Search in old-style Portage PROVIDE metadata.
source code
list
searchPackagesByDescription(self, keyword)
Search packages using given description string as keyword.
source code
list or set
searchPackagesByName(self, keyword, sensitive=False, justid=False)
Search packages by package name.
source code
list
searchPackagesByCategory(self, keyword, like=False, branch=None)
Search packages by category name.
source code
list or set
searchPackagesByNameAndCategory(self, name, category, sensitive=False, justid=False)
Search packages matching given name and category strings.
source code
tuple
isPackageScopeAvailable(self, atom, slot, revision)
Return whether given package scope is available.
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
list
listAllPackages(self, get_scope=False, order_by=None)
List all packages in repository.
source code
set
listAllInjectedPackages(self, just_files=False)
List all the "injected" package download URLs in repository.
source code
list
listAllSpmUids(self)
List all Source Package Manager unique package identifiers bindings with packages in repository.
source code
list or set
listAllIdpackages(self, order_by=None)
List all package identifiers available in repository.
source code
list
listAllDependencies(self)
List all dependencies available in repository.
source code
set
listIdPackagesInIdcategory(self, idcategory, order_by='atom')
List package identifiers available in given category identifier.
source code
list or set
listAllDownloads(self, do_sort=True, full_path=False)
List all package download URLs stored in repository.
source code
int or list or set
listAllFiles(self, clean=False, count=False)
List all file paths owned by packaged stored in repository.
source code
list
listAllCategories(self, order_by='')
List all categories available in repository.
source code
list
listConfigProtectEntries(self, mask=False)
List CONFIG_PROTECT* entries (configuration file/directories protection).
source code
 
switchBranch(self, idpackage, tobranch)
Switch branch string in repository to new value.
source code
string
getSetting(self, setting_name)
Return stored Repository setting.
source code
 
validateDatabase(self)
Validates Entropy repository by doing basic integrity checks.
source code
tuple
getIdpackagesDifferences(self, foreign_idpackages)
Return differences between in-repository package identifiers and list provided.
source code
 
uniformBranch(self, branch)
Enforce given branch string to all currently available packages.
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
 
checkDatabaseApi(self)
Check if repository EAPI (Entropy API) is not greater than the one that entropy.const ships.
source code
int
doDatabaseImport(self, dumpfile, dbfile)
Import SQLite3 dump file to this database.
source code
 
doDatabaseExport(self, dumpfile, gentle_with_tables=True, exclude_tables=None)
Export running SQLite3 database to file.
source code
list
listAllTables(self)
List all available tables in this repository database.
source code
string
checksum(self, do_order=False, strict=True, strings=False)
Get Repository metadata checksum, useful for integrity verification.
source code
 
storeInstalledPackage(self, idpackage, repoid, source=0)
Note: this is used by installed packages repository (also known as client db).
source code
string or None
getInstalledPackageRepository(self, idpackage)
Note: this is used by installed packages repository (also known as client db).
source code
 
dropInstalledPackageFromStore(self, idpackage)
Note: this is used by installed packages repository (also known as client db).
source code
 
storeXpakMetadata(self, idpackage, blob)
Xpak metadata is Source Package Manager package metadata.
source code
buffer
retrieveXpakMetadata(self, idpackage)
Xpak metadata is Source Package Manager package metadata.
source code
dict
retrieveBranchMigration(self, to_branch)
This method returns branch migration metadata stored in Entropy Client database (installed packages database).
source code
 
dropContent(self)
Drop all "content" metadata from repository, usually a memory hog.
source code
 
dropAllIndexes(self)
Drop all repository metadata indexes.
source code
set
listAllIndexes(self, only_entropy=True)
List all the available repository metadata index names.
source code
 
createAllIndexes(self)
Create all the repository metadata indexes internally available.
source code
 
dropContentIndex(self, only_file=False)
Drop "content" metadata index.
source code
 
regenerateSpmUidTable(self, verbose=False)
Regenerate Source Package Manager package identifiers table.
source code
 
clearTreeupdatesEntries(self, repository)
This method should be considered internal and not suited for general audience.
source code
 
resetTreeupdatesDigests(self)
This method should be considered internal and not suited for general audience.
source code
 
createCategoriesdescriptionTable(self) source code
 
createLicensedataTable(self) source code
 
taintReverseDependenciesMetadata(self)
Taint reverse (or inverse) dependencies metadata so that will be generated during the next request.
source code
 
regenerateReverseDependenciesMetadata(self, verbose=True)
Regenerate reverse (or inverse) dependencies metadata.
source code
 
regenerateLibrarypathsidpackageTable(self, verbose=True)
Note: this is not intended for general audience.
source code
 
moveSpmUidsToBranch(self, to_branch, from_branch=None)
Note: this is not intended for general audience.
source code
tuple
idpackageValidator(self, idpackage, live=True)
Return whether given package identifier is available to user or not, reading package masking metadata stored in SystemSettings.
source code
tuple or set
atomMatch(self, atom, caseSensitive=True, matchSlot=None, multiMatch=False, matchTag=None, matchUse=(), packagesFilter=True, matchRevision=None, extendedResults=False, useCache=True)
Match given atom (or dependency) in repository and return its package identifer and execution status.
source code
Class Variables
  SETTING_KEYS = ['arch']
Method Details

__init__(self, readOnly=False, noUpload=False, dbFile=None, clientDatabase=False, xcache=False, dbname='etpdb:', indexing=True, OutputInterface=None, skipChecks=False, useBranch=None, lockRemote=True)
(Constructor)

source code 

EntropyRepository constructor.

Parameters:
  • readOnly (bool) - open file in read-only mode
  • noUpload (bool) - server-side setting for not allowing database uploads when remote revision is lower than local
  • dbFile (string) - path to database to open
  • clientDatabase (bool) - state that EntropyRepository instance is a client-side one
  • xcache (bool) - enable on-disk cache
  • dbname (string) - EntropyRepository instance identifier
  • indexing (bool) - enable database indexes
  • OutputInterface (entropy.output.TextInterface based instance) - interface used to communicate with the user. must inherit entropy.output.TextInterface
  • skipChecks (bool) - if True, skip integrity checks
  • useBranch (string) - if True, it won't use SystemSettings' branch setting but rather the one provided
  • lockRemote (bool) - determine whether remote server-side database should be locked when updating the local version

setCacheSize(self, size)

source code 

Change low-level, storage engine based cache size.

Parameters:
  • size (int) - new size

setDefaultCacheSize(self, size)

source code 

Change default low-level, storage engine based cache size.

Parameters:
  • size (int) - new default size

closeDB(self)

source code 

Close repository storage communication. Note: once issues this, you won't be able to use such instance anymore.

commitChanges(self, force=False)

source code 

Commit actual changes and make them permanently stored.

Parameters:
  • force (bool) - force commit, despite read-only bit being set

isDatabaseTainted(self)

source code 

Server-side function used to determine whether repository database has been modified.

Returns: bool
taint status

initializeDatabase(self)

source code 

WARNING: it will erase your database. This method (re)initialize the repository, dropping all its content.

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

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

runTreeUpdatesMoveAction(self, move_command, quickpkg_queue)

source code 

Method not suited for general purpose usage. Executes package name move action passed.

Parameters:
  • move_command (string) - raw treeupdates move action, for example: 'move x11-foo/bar app-foo/bar'
  • quickpkg_queue (list) - current package regeneration queue
Returns: list
updated package regeneration queue

runTreeUpdatesSlotmoveAction(self, slotmove_command, quickpkg_queue)

source code 

Method not suited for general purpose usage. Executes package slot move action passed.

Parameters:
  • slotmove_command (string) - raw treeupdates slot move action, for example: 'slotmove x11-foo/bar 2 3'
  • quickpkg_queue (list) - current package regeneration queue
Returns: list
updated package regeneration queue

doTreeupdatesSpmCleanup(self, spm_moves)

source code 

Erase dead Source Package Manager db entries.

Parameters:
  • spm_moves (list) - list of raw package name/slot update actions.

To Do: make more Portage independent (create proper entropy.spm methods for dealing with this)

handlePackage(self, pkg_data, forcedRevision=-1, 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': u'zzz',
                'sha1': u'zzz',
                'sha512': u'zzz'
         },
        'slot': u'0',
        'datecreation': u'1247681752.93',
        'description': u'Standard (de)compression library',
        'useflags': set([u'kernel_linux']),
        'eclasses': set([u'multilib']),
        'config_protect_mask': u'string string', 'etpapi': 3,
        'mirrorlinks': [],
        'cxxflags': u'-Os -march=x86-64 -pipe',
        'injected': False,
        'licensedata': {u'ZLIB': u"lictext"},
        'dependencies': {},
        'chost': u'x86_64-pc-linux-gnu',
        'config_protect': u'string string',
        'download': u'packages/amd64/4/sys-libs:zlib-1.2.3-r1.tbz2',
        'conflicts': set([]),
        'digest': u'fd54248ae060c287b1ec939de3e55332',
        'size': u'136302',
        'category': u'sys-libs',
        'license': u'ZLIB',
        'needed_paths': {},
        'sources': set(),
        'name': u'zlib',
        'versiontag': u'',
        'changelog': u"text",
        'provide': set([]),
        'trigger': u'text',
        'counter': 22331,
        'messages': [],
        'branch': u'4',
        'content': {},
        'needed': [(u'libc.so.6', 2)],
        'version': u'1.2.3-r1',
        'keywords': set(),
        'cflags': u'-Os -march=x86-64 -pipe',
        'disksize': 932206, 'spm_phases': None,
        'homepage': u'http://www.zlib.net/',
        'systempackage': True,
        'revision': 0
    }

@param pkg_data: Entropy package metadata dict
@type pkg_data: dict
@keyword forcedRevision: force a specific package revision
@type forcedRevision: int
@keyword formattedContent: tells whether content metadata is already
    formatted for insertion
@type formattedContent: bool
@return: tuple composed by
    - idpackage: unique Entropy Repository package identifier
    - revision: final package revision selected
    - pkg_data: new Entropy package metadata dict
@rtype: tuple

retrieve_packages_to_remove(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 (idpackages)

addPackage(self, pkg_data, revision=-1, idpackage=None, do_commit=True, 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().

Parameters:
  • pkg_data (dict) - Entropy package metadata
  • revision (int) - force a specific Entropy package revision
  • idpackage (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.
  • do_commit (bool) - if True, automatically commits the executed transaction (could cause slowness)
  • formatted_content (bool) - if True, determines whether the content metadata (usually the biggest part) in pkg_data is already prepared for insertion
Returns: tuple
tuple composed by
  • idpackage: unique Entropy Repository package identifier
  • revision: final package revision selected
  • pkg_data: new Entropy package metadata dict

removePackage(self, idpackage, do_cleanup=True, do_commit=True, do_rss=True)

source code 

Remove package from this Entropy repository using it's identifier (idpackage).

Parameters:
  • idpackage (int) - Entropy repository package indentifier
  • do_cleanup (bool) - if True, executes repository metadata cleanup at the end
  • do_commit (bool) - if True, commits the transaction (could cause slowness)
  • do_rss (bool) - triggered only for server-side repositories, if True, generates information about the removal in RSS form, dumping data to cache (used internally to handle RSS support for repositories).

removeMirrorEntries(self, mirrorname)

source code 

Remove source packages mirror entries from database for the given mirror name. This is a representation of Portage's "thirdpartymirrors".

Parameters:
  • mirrorname (string) - mirror name

addMirrors(self, mirrorname, mirrorlist)

source code 

Add source package mirror entry to database. This is a representation of Portage's "thirdpartymirrors".

Parameters:
  • mirrorname (string) - name of the mirror from which "mirrorlist" belongs
  • mirrorlist (list) - list of URLs belonging to the given mirror name

addCategory(self, category)

source code 

Add package category string to repository. Return its identifier (idcategory).

Parameters:
  • category (string) - name of the category to add
Returns: int
category identifier (idcategory)

addProtect(self, protect)

source code 

Add a single, generic CONFIG_PROTECT (not defined as _MASK/whatever here) path. Return its identifier (idprotect).

Parameters:
  • protect (string) - CONFIG_PROTECT path to add
Returns: int
protect identifier (idprotect)

addSource(self, source)

source code 

Add source code package download path to repository. Return its identifier (idsource).

Parameters:
  • source (string) - source package download path
Returns: int
source identifier (idprotect)

addDependency(self, dependency)

source code 

Add dependency string to repository. Return its identifier (iddependency).

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

addKeyword(self, keyword)

source code 

Add package SPM keyword string to repository. Return its identifier (idkeyword).

Parameters:
  • keyword (string) - keyword string
Returns: int
keyword identifier (idkeyword)

addUseflag(self, useflag)

source code 

Add package USE flag string to repository. Return its identifier (iduseflag).

Parameters:
  • useflag (string) - useflag string
Returns: int
useflag identifier (iduseflag)

addEclass(self, eclass)

source code 

Add package SPM Eclass string to repository. Return its identifier (ideclass).

Parameters:
  • eclass (string) - eclass string
Returns: int
eclass identifier (ideclass)

addNeeded(self, needed)

source code 

Add package libraries' ELF object NEEDED string to repository. Return its identifier (idneeded).

Parameters:
  • needed (string) - NEEDED string (as shown in `readelf -d elf.so`)
Returns: int
needed identifier (idneeded)

addLicense(self, pkglicense)

source code 

Add package license name string to repository. Return its identifier (idlicense).

Parameters:
  • pkglicense (string) - license name string
Returns: int
license name identifier (idlicense)

addCompileFlags(self, chost, cflags, cxxflags)

source code 

Add package Compiler flags used to repository. Return its identifier (idflags).

Parameters:
  • chost (string) - CHOST string
  • cflags (string) - CFLAGS string
  • cxxflags (string) - CXXFLAGS string
Returns: int
Compiler flags triple identifier (idflags)

setSystemPackage(self, idpackage, do_commit=True)

source code 

Mark a package as system package, which means that entropy.client will deny its removal.

Parameters:
  • idpackage (int) - package identifier
  • do_commit (bool) - determine whether executing commit or not

setInjected(self, idpackage, do_commit=True)

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:
  • idpackage (int) - package indentifier
  • do_commit (bool) - determine whether executing commit or not

setCreationDate(self, idpackage, date)

source code 

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

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

setDigest(self, idpackage, digest)

source code 

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

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

setSignatures(self, idpackage, sha1, sha256, sha512)

source code 

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

Parameters:
  • idpackage (int) - package indentifier
  • sha1 (string) - SHA1 hash for package file
  • sha256 (string) - SHA256 hash for package file
  • sha512 (string) - SHA512 hash for package file

setDownloadURL(self, idpackage, url)

source code 

Set download URL prefix for package.

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

setCategory(self, idpackage, category)

source code 

Set category name for package.

Parameters:
  • idpackage (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", ... }

setName(self, idpackage, name)

source code 

Set name for package.

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

setDependency(self, iddependency, dependency)

source code 

Set dependency string for iddependency (dependency identifier).

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

setAtom(self, idpackage, atom)

source code 

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

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

setSlot(self, idpackage, slot)

source code 

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

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

removeLicensedata(self, license_name)

source code 

Remove license text for given license name identifier.

Parameters:
  • license_name (string) - available license name identifier

removeDependencies(self, idpackage)

source code 

Remove all the dependencies of package.

Parameters:
  • idpackage (int) - package indentifier

insertDependencies(self, idpackage, depdata)

source code 

Insert dependencies for package. "depdata" is a dict() with dependency strings as keys and dependency type as values.

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

insertManualDependencies(self, idpackage, manual_deps)

source code 

Insert manually added dependencies to dep. list of package.

Parameters:
  • idpackage (int) - package indentifier
  • manual_deps (list) - list of dependency strings

removeContent(self, idpackage)

source code 

Remove content metadata for package.

Parameters:
  • idpackage (int) - package indentifier

insertContent(self, idpackage, 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, (idpackage, path, type,)).

Parameters:
  • idpackage (int) - package indentifier
  • content (dict, list) - content metadata to insert. {'/path/to/foo': 'obj(content type)',} or [(idpackage, 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.

insertNeededPaths(self, library, paths)

source code 

Insert paths where given ELF obj (library) name can be located. "library" is an ELF object name.

Parameters:
  • library (string) - library name
  • paths (list) - list of paths (list of strings)

insertAutomergefiles(self, idpackage, 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.

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

removeAutomergefiles(self, idpackage)

source code 

Remove 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.

Parameters:
  • idpackage (int) - package indentifier

removeSignatures(self, idpackage)

source code 

Remove extra package file hashes (SHA1, SHA256, SHA512) for package. Entropy package files metadata contains up to 4 hashes: md5, sha1, sha256, sha512 While md5 is here for historical reasons (being the first supported) sha1, sha256, sha512 have been added recently and located into a separate database table called "packagesignatures". Such hashes can be not available for older packages, so don't be scared, aliens are not to blame.

Parameters:
  • idpackage (int) - package indentifier

removeSpmPhases(self, idpackage)

source code 

Remove Source Package Manager phases for package. Entropy can call several Source Package Manager (the PM which Entropy relies on) package installation/removal phases. Such phase names are listed here.

Parameters:
  • idpackage (int) - package indentifier

insertChangelog(self, category, name, changelog_txt)

source code 

Insert package changelog for package (in this case using category + name as key).

Parameters:
  • category (string) - package category
  • name (string) - package name
  • changelog_txt (string) - changelog text

removeChangelog(self, category, name)

source code 

Remove ChangeLog for package (in this case using category + name as key)

Parameters:
  • category (string) - package category
  • name (string) - package name

insertLicenses(self, licenses_data)

source code 

insert license data (license names and text) into repository.

Parameters:
  • licenses_data (dict) - dictionary containing license names as keys and text as values

insertConfigProtect(self, idpackage, idprotect, mask=False)

source code 

Insert CONFIG_PROTECT (configuration files protection) entry identifier for package. This entry is usually a space separated string of directory and files which are used to handle user-protected configuration files or directories, those that are going to be stashed in separate paths waiting for user merge decisions.

Parameters:
  • idpackage (int) - package indentifier
  • idprotect (int) - configuration files protection identifier
  • mask (bool) - if True, idproctect will be considered a "mask" entry, meaning that configuration files starting with paths referenced by idprotect will be forcefully merged.

insertMirrors(self, mirrors)

source code 

Insert list of "mirror name" and "mirror list" into repository. The term "mirror" in this case references to Source Package Manager package download mirrors. Argument format is like this for historical reasons and may change in future.

Parameters:
  • mirrors (list) - list of tuples of length 2 containing string as first item and list as second. [('openoffice', ['http://openoffice1', 'http://..."],), ...]

To Do: change argument format

insertKeywords(self, idpackage, keywords)

source code 

Insert keywords for package. Keywords are strings contained in package metadata stating what architectures or subarchitectures are supported by package. It is historically used also for masking packages (making them not available).

Parameters:
  • idpackage (int) - package indentifier
  • keywords (list) - list of keywords

insertUseflags(self, idpackage, useflags)

source code 

Insert Source Package Manager USE (components build) flags for package.

Parameters:
  • idpackage (int) - package indentifier
  • useflags (list) - list of use flags strings

insertSignatures(self, idpackage, sha1, sha256, sha512)

source code 

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

Parameters:
  • idpackage (int) - package indentifier
  • sha1 (string) - SHA1 hash for package file
  • sha256 (string) - SHA256 hash for package file
  • sha512 (string) - SHA512 hash for package file

insertSpmPhases(self, idpackage, phases)

source code 

Insert Source Package Manager phases for package. Entropy can call several Source Package Manager (the PM which Entropy relies on) package installation/removal phases. Such phase names are listed here.

Parameters:
  • idpackage (int) - package indentifier
  • phases (list) - list of available Source Package Manager phases

insertSources(self, idpackage, sources)

source code 

Insert source code package download URLs for idpackage.

Parameters:
  • idpackage (int) - package indentifier
  • sources (list) - list of source URLs

insertConflicts(self, idpackage, conflicts)

source code 

Insert dependency conflicts for package.

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

insertMessages(self, idpackage, messages)

source code 

Insert user messages for package.

Parameters:
  • idpackage (int) - package indentifier
  • messages (list) - list of messages

insertProvide(self, idpackage, provides)

source code 

Insert PROVIDE metadata for idpackage. This has been added for supporting Portage Source Package Manager old-style meta-packages support. Packages can provide extra atoms, you can see it like aliases, where these can be given by multiple packages. This allowed to make available multiple applications providing the same functionality which depending packages can reference, without forcefully being bound to a single package.

Parameters:
  • idpackage (int) - package indentifier
  • provides (list) - list of atom strings

insertNeeded(self, idpackage, neededs)

source code 

Insert package libraries' ELF object NEEDED string for package. Return its identifier (idneeded).

Parameters:
  • idpackage (int) - package indentifier
  • neededs (string) - list of NEEDED string (as shown in `readelf -d elf.so`)

insertEclasses(self, idpackage, eclasses)

source code 

Insert Source Package Manager used build specification file classes. The term "eclasses" is derived from Portage.

Parameters:
  • idpackage (int) - package indentifier
  • eclasses (list) - list of classes

insertOnDiskSize(self, idpackage, mysize)

source code 

Insert on-disk size (bytes) for package.

Parameters:
  • idpackage (int) - package indentifier
  • mysize (int) - package size (bytes)

insertTrigger(self, idpackage, trigger)

source code 

Insert built-in trigger script for package, containing pre-install, post-install, pre-remove, post-remove hooks. This feature should be considered DEPRECATED, and kept for convenience. Please use Source Package Manager features if possible.

Parameters:
  • idpackage (int) - package indentifier
  • trigger (string) - trigger file dump

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

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

bindSpmPackageUid(self, idpackage, spm_package_uid, branch)

source code 

Bind Source Package Manager package identifier ("COUNTER" metadata for Portage) to Entropy package. If uid <= -2, a new negative UID will be allocated and returned. Negative UIDs are considered auto-allocated by Entropy. This is mainly used for binary packages not belonging to any SPM packages which are just "injected" inside the repository.

Parameters:
  • idpackage (int) - package indentifier
  • spm_package_uid (int) - Source package Manager unique package identifier
  • branch (string) - current running Entropy branch
Returns: int
uid set

insertSpmUid(self, idpackage, spm_package_uid, branch=None)

source code 

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

Parameters:
  • idpackage (int) - package indentifier
  • spm_package_uid (int) - Source package Manager unique package identifier
  • branch (string) - current running Entropy 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

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

source code 

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

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

contentDiff(self, idpackage, dbconn, dbconn_idpackage)

source code 

Return content metadata difference between two packages.

Parameters:
  • idpackage (int) - package indentifier available in this repository
  • dbconn (EntropyRepository) - other repository class instance
  • dbconn_idpackage (int) - package identifier available in other repository
Returns: set
content difference
Raises:
  • AttributeError - when self instance and dbconn are the same

getNewNegativeSpmUid(self)

source code 

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

Returns: int
new negative spm uid

getApi(self)

source code 

Get Entropy repository API.

Returns: int
Entropy repository API

getDependency(self, iddependency)

source code 

Return dependency string for given dependency identifier.

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

getCategory(self, idcategory)

source code 

Get category name from category identifier.

Parameters:
  • idcategory (int) - category identifier
Returns: string
category name

getIDPackage(self, atom)

source code 

Obtain repository package identifier from its atom string.

Parameters:
  • atom (string) - package atom
Returns: int
idpackage in repository or -1 if not found

getIDPackageFromDownload(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 idpackage which download metadata ends with the one provided by download_relative_path
Returns: int
idpackage in repository or -1 if not found

getIDPackagesFromFile(self, file)

source code 

Obtain repository package identifiers for packages owning the provided path string (file).

Parameters:
  • file (string) - path to file (or directory) to match
Returns: set
list (set) of idpackages found

getIDCategory(self, category)

source code 

Obtain category identifier from category name.

Parameters:
  • category (string) - category name
Returns: int
idcategory or -1 if not found

getVersioningData(self, idpackage)

source code 

Get package version information for provided package identifier.

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

getStrictData(self, idpackage)

source code 

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

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

getStrictScopeData(self, idpackage)

source code 

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

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

getScopeData(self, idpackage)

source code 

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

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

getBaseData(self, idpackage)

source code 

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

Parameters:
  • idpackage (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 idpackage

getTriggerInfo(self, idpackage, 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 idpackage: package indentifier
@type idpackage: 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,
        'versiontag': versiontag,
        'revision': revision,
        'branch': branch,
        'chost': chost,
        'cflags': cflags,
        'cxxflags': cxxflags,
        'etpapi': etpapi,
        'trigger': self.retrieveTrigger(idpackage),
        'eclasses': self.retrieveEclasses(idpackage),
        'content': pkg_content,
        'spm_phases': self.retrieveSpmPhases(idpackage),
    }

@rtype: dict

getPackageData(self, idpackage, get_content=True, content_insert_formatted=False, trigger_unicode=True)

source code 

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

Parameters:
  • idpackage (int) - package indentifier
  • get_content (bool)
  • content_insert_formatted (bool)
  • trigger_unicode (bool)
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(idpackage),
    'messages': self.retrieveMessages(idpackage),
    'trigger': self.retrieveTrigger(idpackage,
        get_unicode = trigger_unicode),
    'disksize': self.retrieveOnDiskSize(idpackage),
    'changelog': self.retrieveChangelog(idpackage),
    'injected': self.isInjected(idpackage),
    'systempackage': self.isSystemPackage(idpackage),
    'config_protect': self.retrieveProtect(idpackage),
    'config_protect_mask': self.retrieveProtectMask(idpackage),
    'useflags': self.retrieveUseflags(idpackage),
    'keywords': self.retrieveKeywords(idpackage),
    'sources': sources,
    'eclasses': self.retrieveEclasses(idpackage),
    'needed': self.retrieveNeeded(idpackage, extended = True),
    'needed_paths': self.retrieveNeededPaths(idpackage),
    'provide': self.retrieveProvide(idpackage),
    'conflicts': self.retrieveConflicts(idpackage),
    'licensedata': self.retrieveLicensedata(idpackage),
    'content': content,
    'dependencies': dict((x, y,) for x, y in                 self.retrieveDependencies(idpackage, extended = True)),
    'mirrorlinks': [[x,self.retrieveMirrorInfo(x)] for x in mirrornames],
    'signatures': signatures,
    'spm_phases': self.retrieveSpmPhases(idpackage),
}

clearCache(self, depends=False)

source code 

Clear on-disk repository cache.

Parameters:
  • depends (bool) - if True, clear reverse dependencies cache

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

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.

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

retrieveTreeUpdatesActions(self, repository, forbranch=None)

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.

@param repository: repository identifier
@type repository: string
@keyword forbranch: filter for specific Entropy branch, provide
    alternative branch string
@type forbranch: string
@return: list of raw-string commands to run
@rtype: list

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

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

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

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)

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

doesTreeupdatesActionExist(self, repository, command, branch)

source code 

This method should be considered internal and not suited for general audience. Return whether provided "treeupdates" action in repository with provided branch exists.

Parameters:
  • repository (string) - repository identifier
  • command (string) - treeupdates command
  • branch (string) - branch metadata bound to command argument value given
Returns: bool
if True, provided treeupdates action already exists

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

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

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: set
list (set) of dependencies belonging to given package set name

retrieveSystemPackages(self)

source code 

Return a list of package identifiers that are part of the base system (thus, marked as system packages).

Returns: set
list (set) of system package identifiers

retrieveAtom(self, idpackage)

source code 

Return "atom" metadatum for given package identifier.

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

retrieveBranch(self, idpackage)

source code 

Return "branch" metadatum for given package identifier.

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

retrieveTrigger(self, idpackage, get_unicode=False)

source code 

Return "trigger" script content for given package identifier.

Parameters:
  • idpackage (int) - package indentifier
  • get_unicode (bool) - return in unicode format
Returns: string or None
trigger script content

retrieveDownloadURL(self, idpackage)

source code 

Return "download URL" metadatum for given package identifier.

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

retrieveDescription(self, idpackage)

source code 

Return "description" metadatum for given package identifier.

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

retrieveHomepage(self, idpackage)

source code 

Return "homepage" metadatum for given package identifier.

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

retrieveSpmUid(self, idpackage)

source code 

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

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

retrieveMessages(self, idpackage)

source code 

Return "messages" metadatum for given package identifier.

Parameters:
  • idpackage (int) - package indentifier
Returns: list
list of package messages (for making user aware of stuff)

retrieveSize(self, idpackage)

source code 

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

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

retrieveOnDiskSize(self, idpackage)

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:
  • idpackage (int) - package indentifier
Returns: int
on disk size metadatum

retrieveDigest(self, idpackage)

source code 

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

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

retrieveSignatures(self, idpackage)

source code 

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

Parameters:
  • idpackage (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.

retrieveName(self, idpackage)

source code 

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

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

retrieveKeySlot(self, idpackage)

source code 

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

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

retrieveKeySlotAggregated(self, idpackage)

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:
  • idpackage (int) - package indentifier
Returns: string or None
package key + ":" + slot string

retrieveKeySlotTag(self, idpackage)

source code 

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

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

retrieveVersion(self, idpackage)

source code 

Return package version for given package identifier.

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

retrieveRevision(self, idpackage)

source code 

Return package Entropy-revision for given package identifier.

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

retrieveCreationDate(self, idpackage)

source code 

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

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

retrieveApi(self, idpackage)

source code 

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

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

retrieveUseflags(self, idpackage)

source code 

Return "USE flags" metadatum for given package identifier.

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

retrieveEclasses(self, idpackage)

source code 

Return "eclass" metadatum for given package identifier.

Parameters:
  • idpackage (int) - package indentifier
Returns: set
list (set) of eclasses for given package identifier

retrieveSpmPhases(self, idpackage)

source code 

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

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

retrieveNeededRaw(self, idpackage)

source code 

Return (raw format) "NEEDED" ELF metadata for libraries contained in given package.

Parameters:
  • idpackage (int) - package indentifier
Returns: set
list (set) of "NEEDED" entries contained in ELF objects packed into package file

retrieveNeeded(self, idpackage, extended=False, format=False)

source code 

Return "NEEDED" elf metadata for libraries contained in given package.

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

retrieveNeededPaths(self, idpackage)

source code 

Return library linker paths available at the time package entered repository.

Parameters:
  • idpackage (int) - package indentifier
Returns: dict
available linker paths (/etc/ld.so.conf content) metadata. Dictionary composed by library name as key and tuple of path and ELF class as values

retrieveNeededLibraryPaths(self, needed_library_name, elfclass)

source code 

Return registered library paths for given library name needed_library_name and ELF class.

Parameters:
  • needed_library_name (string) - library name (libfoo.so.1.2.3)
  • elfclass (int) - ELF class of library name
Returns: set
list (set) of paths in where library is available

retrieveNeededLibraryIdpackages(self)

source code 

Return raw list of packages containing library with given ELF class.
For example:
    [(123, u'libfoo.so.1.2.3', 2,), ...]
This is useful to determine which package provides a given library for
each ELF class available.

@return: list of tuples of length 3 (see description)
@rtype: list

clearNeededLibraryIdpackages(self)

source code 

Clear package and library names binding metadata. See retrieveNeededLibraryIdpackages() for more information.

setNeededLibraryIdpackages(self, library_map)

source code 

Inject given package <-> library name <-> ELF class map into repository.

Parameters:
  • library_map (list) - list of tuples of length 3, for example: [(123, u'libfoo.so.1.2.3', 2,), ...]

retrieveConflicts(self, idpackage)

source code 

Return list of conflicting dependencies for given package identifier.

Parameters:
  • idpackage (int) - package indentifier
Returns: set
list (set) of conflicting package dependencies

retrieveProvide(self, idpackage)

source code 

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

Parameters:
  • idpackage (int) - package indentifier
Returns: set
list (set) of atoms provided by package

retrieveDependenciesList(self, idpackage)

source code 

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

Parameters:
  • idpackage (int) - package indentifier
Returns: set
list (set) of dependencies of package

retrievePostDependencies(self, idpackage, extended=False)

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:
  • idpackage (int) - package indentifier
  • extended (bool) - return in extended format

retrieveManualDependencies(self, idpackage, extended=False)

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:
  • idpackage (int) - package indentifier
  • extended (bool) - return in extended format

retrieveDependencies(self, idpackage, extended=False, deptype=None, exclude_deptypes=None)

source code 

Return dependencies for given package identifier.

Parameters:
  • idpackage (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['spm']['*depend_id'] for dependency type identifiers
  • exclude_deptypes (list) - list of dependency types to exclude
Returns: list or set
dependencies of given package

retrieveIdDependencies(self, idpackage)

source code 

Return list of dependency identifiers for given package identifier.

Parameters:
  • idpackage (int) - package indentifier
Returns: set
list (set) of dependency identifiers

retrieveKeywords(self, idpackage)

source code 

Return package SPM keyword list for given package identifier.

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

retrieveProtect(self, idpackage)

source code 

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

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

retrieveProtectMask(self, idpackage)

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:
  • idpackage (int) - package indentifier
Returns: string
CONFIG_PROTECT_MASK string

retrieveSources(self, idpackage, extended=False)

source code 

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

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

retrieveAutomergefiles(self, idpackage, 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:
  • idpackage (int) - package indentifier
  • get_dict (bool) - return a dictionary with configuration file as key and md5 hash as value
Returns: list or set
automerge metadata for given package identifier

retrieveContent(self, idpackage, extended=False, contentType=None, formatted=False, insert_formatted=False, order_by='')

source code 

Return files contained in given package.

Parameters:
  • idpackage (int) - package indentifier
  • extended (bool) - return in extended format
  • contentType (int) - only return given entry type, which can be: "obj", "sym" or "dir"
  • 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 "idpackage"
Returns: dict or list or set
content metadata

retrieveChangelog(self, idpackage)

source code 

Return Source Package Manager ChangeLog for given package identifier.

Parameters:
  • idpackage (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

retrieveSlot(self, idpackage)

source code 

Return "slot" metadatum for given package identifier.

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

retrieveVersionTag(self, idpackage)

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:
  • idpackage (int) - package indentifier
Returns: string or None
tag string

retrieveMirrorInfo(self, mirrorname)

source code 

Return available mirror URls for given mirror name.

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

retrieveCategory(self, idpackage)

source code 

Return category name for given package identifier.

Parameters:
  • idpackage (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

retrieveLicensedata(self, idpackage)

source code 

Return license metadata for given package identifier.

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

retrieveLicensedataKeys(self, idpackage)

source code 

Return license names available for given package identifier.

Parameters:
  • idpackage (int) - package indentifier
Returns: set
list (set) 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

retrieveLicense(self, idpackage)

source code 

Return "license" metadatum for given package identifier.

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

retrieveCompileFlags(self, idpackage)

source code 

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

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

retrieveReverseDependencies(self, idpackage, atoms=False, key_slot=False, exclude_deptypes=None)

source code 

Return reverse (or inverse) dependencies for given package.

Parameters:
  • idpackage (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) - exclude given dependency types from returned data
Returns: list or set
reverse dependency list

retrieveUnusedIdpackages(self)

source code 

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

Returns: list
unused idpackages ordered by atom

isAtomAvailable(self, atom)

source code 

Return whether given atom is available in repository.

Parameters:
  • atom (string) - package atom
Returns: int
idpackage or -1 if not found

areIdpackagesAvailable(self, idpackages)

source code 

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

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

isIdpackageAvailable(self, idpackage)

source code 

Return whether given package identifier is available in repository.

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

isCategoryAvailable(self, category)

source code 

Return whether given category is available in repository.

Parameters:
  • category (string) - category name
Returns: bool
availability (True if available)

isProtectAvailable(self, protect)

source code 

Return whether given CONFIG_PROTECT* entry is available in repository.

Parameters:
  • protect (string) - CONFIG_PROTECT* entry (path to a protected directory or file that won't be overwritten by Entropy Client during package merge)
Returns: bool
availability (True if available)

isFileAvailable(self, myfile, get_id=False)

source code 

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

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

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

source code 

Resolve NEEDED ELF entry (a library name) to idpackages 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 list of tuple of length 2, first element is idpackage, second is actual library path
Returns: list or set
list of packages owning given library

isSourceAvailable(self, source)

source code 

Return whether given source package URL is available in repository. Returns source package URL identifier (idsource).

Parameters:
  • source (string) - source package URL
Returns: int
source package URL identifier (idsource) or -1 if not found

isDependencyAvailable(self, dependency)

source code 

Return whether given dependency string is available in repository. Returns dependency identifier (iddependency).

Parameters:
  • dependency (string) - dependency string
Returns: int
dependency identifier (iddependency) or -1 if not found

isKeywordAvailable(self, keyword)

source code 

Return whether keyword string is available in repository. Returns keyword identifier (idkeyword)

Parameters:
  • keyword (string) - keyword string
Returns: int
keyword identifier (idkeyword) or -1 if not found

isUseflagAvailable(self, useflag)

source code 

Return whether USE flag name is available in repository. Returns USE flag identifier (idflag).

Parameters:
  • useflag (string) - USE flag name
Returns: int
USE flag identifier or -1 if not found

isEclassAvailable(self, eclass)

source code 

Return whether eclass name is available in repository. Returns Eclass identifier (idclass)

Parameters:
  • eclass (string) - eclass name
Returns: int
Eclass identifier or -1 if not found

isNeededAvailable(self, needed)

source code 

Return whether NEEDED ELF entry (library name) is available in repository. Returns NEEDED entry identifier

Parameters:
  • needed (string) - NEEDED ELF entry (library name)
Returns: int
NEEDED entry identifier or -1 if not found

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)

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)

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

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
Parameters:
  • license_name (string) - license name
To Do:
  • check if readOnly is really required
  • check if is_user_in_entropy_group is really required

isLicenseAvailable(self, pkglicense)

source code 

Return whether license metdatatum (NOT license name) is available in repository.

Parameters:
  • pkglicense (string) - "license" package metadatum (returned by retrieveLicense)
Returns: int
"license" metadatum identifier (idlicense)

isSystemPackage(self, idpackage)

source code 

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

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

isInjected(self, idpackage)

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:
  • idpackage (int) - package indentifier
Returns: bool
injection status (True if injected)

areCompileFlagsAvailable(self, chost, cflags, cxxflags)

source code 

Return whether given Compiler FLAGS are available in repository.

Parameters:
  • chost (string) - CHOST flag
  • cflags (string) - CFLAGS flag
  • cxxflags (string) - CXXFLAGS flag
Returns: bool
availability (True if available)

searchBelongs(self, file, like=False)

source code 

Search packages which given file path belongs to.

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

searchEclassedPackages(self, eclass, atoms=False)

source code 

Search packages which their Source Package Manager counterpar are using given eclass.

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

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: set or list
list of packages using given tag

searchLicenses(self, mylicense, caseSensitive=False, atoms=False)

source code 

Search packages using given license (mylicense).

Parameters:
  • mylicense (string) - license name to search
  • caseSensitive (bool) - search in case sensitive mode (default off)
  • atoms (bool) - return list of atoms instead of package identifiers
Returns: set or list
list of packages using given license

To Do: check if is_valid_string is really required

searchSlottedPackages(self, slot, atoms=False)

source code 

Search packages with given slot string.

Parameters:
  • slot (string) - slot to search
  • atoms (bool) - return list of atoms instead of package identifiers
Returns: set or list
list of packages using given slot

searchKeySlot(self, key, slot)

source code 

Search package with given key and slot

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

searchNeeded(self, needed, like=False)

source code 

Search packages that need given NEEDED ELF entry (library name).

Parameters:
  • needed (string) - NEEDED ELF entry (shared object library name)
  • like (bool) - do not match exact case
Returns: set
list (set) of package identifiers

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 set
list of dependency identifiers (if multi is True) or strings (if strings is True) or dependency identifier

searchIdpackageFromIddependency(self, iddep)

source code 

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

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

searchSets(self, keyword)

source code 

Search package sets in repository using given search keyword.

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

searchSimilarPackages(self, mystring, atom=False)

source code 

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

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

searchPackages(self, keyword, sensitive=False, slot=None, tag=None, order_by='atom', 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", "name" or "version"
  • just_id (bool) - just return package identifiers (returning set())
Returns: set or list
packages found matching given search criterias

searchProvide(self, keyword, slot=None, tag=None, justid=False)

source code 

Search in old-style Portage PROVIDE metadata. WARNING: this method is deprecated and will be removed someday.

Parameters:
  • keyword (string) - search term
  • slot (string) - match given package slot
  • tag (string) - match given package tag
  • justid (bool) - return list of package identifiers (set())
Returns: list or set
found PROVIDE metadata

searchPackagesByDescription(self, keyword)

source code 

Search packages using given description string as keyword.

Parameters:
  • keyword (string) - description sub-string to search
Returns: list
list of tuples of length 2 containing atom and idpackage values

searchPackagesByName(self, keyword, sensitive=False, justid=False)

source code 

Search packages by package name.

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

searchPackagesByCategory(self, keyword, like=False, branch=None)

source code 

Search packages by category name.

Parameters:
  • keyword (string) - category name
  • like (bool) - do not match exact case
  • branch (string) - search in given package branch
Returns: list
list of tuples of length 2 containing atom and idpackage values

searchPackagesByNameAndCategory(self, name, category, sensitive=False, justid=False)

source code 

Search packages matching given name and category strings.

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

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 (idpackage or -1, idreason or 0,)

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

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 given metadatum, "atom", "slot", "revision" or "idpackage"
Returns: list
list of tuples of length 3 (or 4 if get_scope is True), containing (atom, idpackage, branch,) if get_scope is False and (idpackage, atom, slot, revision,) if get_scope is True

listAllInjectedPackages(self, just_files=False)

source code 

List all the "injected" package download URLs in repository.

Parameters:
  • just_files (bool) - just return download URLs
Returns: set
list (set) of download URLs (if just_files) otherwise list of tuples of length 2 composed by (download URL, idpackage,)

listAllSpmUids(self)

source code 

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

Returns: list
list of tuples of length 2 composed by (spm_uid, idpackage,)

listAllIdpackages(self, order_by=None)

source code 

List all package identifiers available in repository.

Parameters:
  • order_by (string) - order by "atom", "idpackage", "version", "name", "idcategory"
Returns: list or set
list (if order_by) or set of package identifiers

listAllDependencies(self)

source code 

List all dependencies available in repository.

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

listIdPackagesInIdcategory(self, idcategory, order_by='atom')

source code 

List package identifiers available in given category identifier.

Parameters:
  • idcategory (int) - cateogory identifier
  • order_by (string) - order by "atom", "name", "version"
Returns: set
list (set) of available package identifiers in category.

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: list or set
list (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 list or set
list of files available or their count

listAllCategories(self, order_by='')

source code 

List all categories available in repository.

Parameters:
  • order_by (string) - order by "category", "idcategory"
Returns: list
list of tuples of length 2 composed by (idcategory, category,)

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

switchBranch(self, idpackage, tobranch)

source code 

Switch branch string in repository to new value.

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

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

validateDatabase(self)

source code 

Validates Entropy repository by doing basic integrity checks.

Raises:

getIdpackagesDifferences(self, foreign_idpackages)

source code 

Return differences between in-repository package identifiers and list provided.

Parameters:
  • foreign_idpackages (iterable) - list of foreign idpackages
Returns: tuple
tuple composed by idpackages that would be added and idpackages that would be removed

uniformBranch(self, branch)

source code 

Enforce given branch string to all currently available packages.

Parameters:
  • branch (string) - branch string to enforce

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)

doDatabaseImport(self, dumpfile, dbfile)

source code 

Import SQLite3 dump file to this database.

Parameters:
  • dumpfile (string) - SQLite3 dump file to read
  • dbfile (string) - database file to write to
Returns: int
sqlite3 import return code

To Do: remove /usr/bin/sqlite3 dependency

doDatabaseExport(self, dumpfile, gentle_with_tables=True, exclude_tables=None)

source code 

Export running SQLite3 database to file.

Parameters:
  • dumpfile (file object (hint: open())) - dump file object to write to
  • gentle_with_tables (bool) - append "IF NOT EXISTS" to "CREATE TABLE" statements

To Do: when Python 2.6, look ad Connection.iterdump and replace this :)

listAllTables(self)

source code 

List all available tables in this repository database.

Returns: list
available tables

checksum(self, do_order=False, strict=True, strings=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
  • strings (bool) - return checksum in md5 hex form
Returns: string
repository checksum

storeInstalledPackage(self, idpackage, 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:
  • idpackage (int) - package indentifier
  • repoid (string) - repository identifier
  • source (int) - source identifier (pleas see: etpConst['install_sources'])

getInstalledPackageRepository(self, idpackage)

source code 

Note: this is used by installed packages repository (also known as client db). Return repository identifier stored inside the "installed packages table".

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

dropInstalledPackageFromStore(self, idpackage)

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:
  • idpackage (int) - package indentifier

storeXpakMetadata(self, idpackage, blob)

source code 

Xpak metadata is Source Package Manager package metadata. This method stores such metadata inside repository.

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

retrieveXpakMetadata(self, idpackage)

source code 

Xpak metadata is Source Package Manager package metadata. This method returns such stored metadata inside repository.

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

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

dropContent(self)

source code 

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

listAllIndexes(self, only_entropy=True)

source code 

List all the available repository metadata index names.

Parameters:
  • only_entropy (bool) - if True, return only entropy related indexes
Returns: set
list (set) of index names

dropContentIndex(self, only_file=False)

source code 

Drop "content" metadata index.

Parameters:
  • only_file (bool) - drop only "file" index

regenerateSpmUidTable(self, verbose=False)

source code 

Regenerate Source Package Manager package identifiers table. This method will use the Source Package Manger interface.

Parameters:
  • verbose (bool) - run in verbose mode

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

resetTreeupdatesDigests(self)

source code 

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

regenerateReverseDependenciesMetadata(self, verbose=True)

source code 

Regenerate reverse (or inverse) dependencies metadata.

Parameters:
  • verbose (bool) - enable verbosity

regenerateLibrarypathsidpackageTable(self, verbose=True)

source code 

Note: this is not intended for general audience. Regenerate ELF object linker paths table.

Parameters:
  • verbose (bool) - enable verbosity

moveSpmUidsToBranch(self, to_branch, from_branch=None)

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 ()
  • from_branch ()

idpackageValidator(self, idpackage, live=True)

source code 

Return whether given package identifier is available to user or not, reading package masking metadata stored in SystemSettings.

Parameters:
  • idpackage (int) - package indentifier
  • live (bool) - use live masking feature
Returns: tuple
tuple composed by idpackage and masking reason. If idpackage returned idpackage 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'])

atomMatch(self, atom, caseSensitive=True, matchSlot=None, multiMatch=False, matchTag=None, matchUse=(), packagesFilter=True, matchRevision=None, extendedResults=False, useCache=True)

source code 

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

Parameters:
  • atom (string) - atom or dependency to match in repository
  • caseSensitive (bool) - match in case sensitive mode
  • matchSlot (string) - match packages with given slot
  • multiMatch (bool) - match all the available packages, not just the best one
  • matchTag (string) - match packages with given tag
  • matchUse (list or tuple or set) - match packages with given use flags
  • packagesFilter (bool) - enable package masking filter
  • matchRevision (int) - match packages with given entropy revision
  • extendedResults (bool) - return extended results
  • useCache (bool) - use on-disk cache
Returns: tuple or set
tuple of length 2 composed by (idpackage 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.

To Do: improve documentation here