Package conary :: Module trove :: Class Trove
[hide private]
[frames] | no frames]

Class Trove

source code

             object --+    
                      |    
lib.cstreams'.StreamSet --+
                          |
                         Trove
Known Subclasses:
state.SourceState

Troves are groups of files and other troves, which are included by reference. By convention, "component" often refers to a trove with files but no other trove, while a "packages" means a trove with other troves but no files. While this object allows any mix of file and package inclusion, in practice conary doesn't allow it.

Trove is a stream primarily to allow it to be frozen and have a signature computed. It does provide a nice level of consistency as well. If it were a true stream, diff() would return a string instead of an object (a TroveChangeSet), but that string would be difficult to handle (and Conary often directly manipulates TroveChangeSet objects))

Instance Methods [hide private]
 
__repr__(self)
repr(x)
source code
 
_sigString(self, version) source code
 
addDigitalSignature(self, keyId, skipIntegrityChecks=False)
Signs all of the available digests for this trove and stores those signatures.
source code
 
addPrecomputedDigitalSignature(self, newSigs)
Adds a previously computed signature, allowing signatures to be added to troves.
source code
DigitalSignature
getDigitalSignature(self, keyId)
Returns the signature created by the key whose keyId is passed.
source code
(int, list)
verifyDigitalSignatures(self, threshold=0, keyCache=None)
Verifies the digial signature(s) for the trove against the keys contained in keyCache.
source code
 
invalidateDigests(self) source code
string
computeDigests(self, store=True)
Recomputes the sha1 signature of this trove.
source code
boolean
verifyDigests(self)
Verifies the digests trove.
source code
 
copy(self, classOverride=None) source code
 
getName(self)
PUBLIC API
source code
 
getVersion(self)
PUBLIC API
source code
 
getNameVersionFlavor(self)
PUBLIC API
source code
 
getMetadata(self, language=None)
PUBLIC API
source code
 
getAllMetadataItems(self) source code
 
copyMetadata(self, trv, skipSet=None)
Copy metadata from a different trove
source code
 
copyMetadataFromMetadata(self, metadata, skipSet=None)
Copy metadata from a different metadata object
source code
 
getFactory(self) source code
 
setFactory(self, val) source code
 
changeVersion(self, version) source code
 
changeChangeLog(self, cl) source code
 
changeFlavor(self, flavor) source code
 
getSigs(self) source code
 
isRedirect(self) source code
 
isRemoved(self) source code
 
getType(self) source code
 
addFile(self, pathId, path, version, fileId) source code
 
computePathHashes(self) source code
 
updateFile(self, pathId, path, version, fileId) source code
 
removeFile(self, pathId) source code
 
iterFileList(self) source code
 
emptyFileList(self) source code
 
getFile(self, pathId) source code
 
hasFile(self, pathId) source code
 
hasFiles(self) source code
 
fileCount(self) source code
 
addTrove(self, name, version, flavor, presentOkay=False, byDefault=True, weakRef=False)
Adds a single version of a trove.
source code
 
delTrove(self, name, version, flavor, missingOkay, weakRef=False)
Removes a single version of a trove.
source code
list
iterTroveList(self, strongRefs=False, weakRefs=False)
PUBLIC API
source code
list
iterTroveListInfo(self)
Returns a generator for (name, version, flavor), byDefault, isStrong
source code
 
isStrongReference(self, name, version, flavor) source code
 
includeTroveByDefault(self, name, version, flavor) source code
 
addRedirect(self, toName, toBranch, toFlavor) source code
 
iterRedirects(self) source code
 
compatibleWith(self, other) source code
 
hasTrove(self, name, version, flavor) source code
dict
applyChangeSet(self, trvCs, skipIntegrityChecks=False, allowIncomplete=False, skipFiles=False)
Updates the trove from the changes specified in a change set.
source code
 
mergeTroveListChanges(self, strongChangeList, weakChangeList, redundantOkay=False)
Merges a set of changes to the included trove list into this trove.
source code
 
__eq__(self, them)
Compare two troves for equality.
source code
 
__ne__(self, them) source code
(TroveChangeSet, fileChangeList, troveChangeList)
diff(self, them, absolute=0, getPathHashes=None)
PUBLIC API
source code
 
_diffPackages(self, addedDict, removedDict, getPathHashes)
Matches up the list of troves that have been added to those that were removed.
source code
 
setProvides(self, provides) source code
 
setRequires(self, requires) source code
 
getProvides(self) source code
 
getRequires(self) source code
 
getFlavor(self) source code
 
getChangeLog(self) source code
 
getTroveInfo(self) source code
 
getSize(self) source code
 
setSize(self, sz) source code
 
setCompatibilityClass(self, theClass) source code
 
getCompatibilityClass(self)
PUBLIC API
source code
 
setBuildFlavor(self, flavor) source code
 
getBuildFlavor(self) source code
 
getSourceName(self) source code
 
setSourceName(self, nm) source code
 
getBuildTime(self) source code
 
setBuildTime(self, nm) source code
 
getConaryVersion(self) source code
 
setConaryVersion(self, ver) source code
 
setIsCollection(self, b) source code
 
setIsDerived(self, b) source code
 
setIsMissing(self, b) source code
 
isCollection(self) source code
 
isDerived(self) source code
 
isMissing(self) source code
 
setLabelPath(self, labelPath) source code
 
getLabelPath(self) source code
 
setSearchPath(self, searchPath) source code
 
getSearchPath(self) source code
 
setBuildRequirements(self, itemList) source code
 
getBuildRequirements(self) source code
 
setPolicyProviders(self, itemList) source code
 
getPolicyProviders(self) source code
 
setLoadedTroves(self, itemList) source code
 
getLoadedTroves(self) source code
 
setDerivedFrom(self, itemList) source code
 
getDerivedFrom(self) source code
 
getPathHashes(self) source code
 
setTroveCopiedFrom(self, itemList) source code
list
getTroveCopiedFrom(self)
For groups, return the list of troves that were used when a statement like addAll or addCopy was used.
source code
 
__init__(self, name, version=None, flavor=None, changeLog=None, type=0, skipIntegrityChecks=False, setVersion=True)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code

Inherited from lib.cstreams'.StreamSet: __cmp__, __deepcopy__, __hash__, __new__, find, freeze, thaw, twm

Inherited from object: __delattr__, __getattribute__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Variables [hide private]
  streamDict = {0: (0, <type 'cstreams.StringStream'>, 'name'), ...
  ignoreUnknown = False
  v0SkipSet = {'buildFlavor': True, 'compatibilityClass': True, ...
Properties [hide private]
  changeLog
  flavor
  idMap
  name
  provides
  redirects
  requires
  strongTroves
  troveInfo
  type
  version
  weakTroves

Inherited from object: __class__

Method Details [hide private]

__repr__(self)
(Representation operator)

source code 
repr(x)
Overrides: object.__repr__
(inherited documentation)

addDigitalSignature(self, keyId, skipIntegrityChecks=False)

source code 
Signs all of the available digests for this trove and stores those signatures.
Parameters:
  • keyId (str) - ID of the key use for signing

addPrecomputedDigitalSignature(self, newSigs)

source code 
Adds a previously computed signature, allowing signatures to be added to troves. All digests must have already been computed.
Parameters:
  • newSigs (VersionedDigitalSignatureSet) - Signature to add

getDigitalSignature(self, keyId)

source code 
Returns the signature created by the key whose keyId is passed. The signature is returned as a VersionedSignaturesSet object containing only the signatures for the specified keyId.
Parameters:
  • keyId (str) - Id for the key whose signature is returns
Returns: DigitalSignature

verifyDigitalSignatures(self, threshold=0, keyCache=None)

source code 

Verifies the digial signature(s) for the trove against the keys contained in keyCache.

The highest trust level verified is return along with the list of keys which were unavailable. A trust level of zero means no trusted keys were available. Invalid signatures raise DigitalSignatureVerificationError.
Parameters:
  • threshold (int) - trust level required; trust levels below this result in DigitalSignatureVerificationError
  • keyCache (openpgpkey.OpenPGPKeyFileCache) - cache of keys to verify against
Returns: (int, list)
Raises:

computeDigests(self, store=True)

source code 
Recomputes the sha1 signature of this trove.
Parameters:
  • store (boolean) - The newly computed sha1 is stored as the sha1 for this trove.
Returns: string

getName(self)

source code 
PUBLIC API
Decorators:
  • @api.publicApi

getVersion(self)

source code 
PUBLIC API
Decorators:
  • @api.publicApi

getNameVersionFlavor(self)

source code 
PUBLIC API
Decorators:
  • @api.publicApi

getMetadata(self, language=None)

source code 
PUBLIC API
Decorators:
  • @api.publicApi

copyMetadata(self, trv, skipSet=None)

source code 
Copy metadata from a different trove
Parameters:
  • trv (Trove) - Trove object from which metadata items will be copied
  • skipSet (iterable) - Items that will not be copied

copyMetadataFromMetadata(self, metadata, skipSet=None)

source code 
Copy metadata from a different metadata object
Parameters:
  • metadata (Metadata) - Metadata object from which metadata items will be copied
  • skipSet (iterable) - Items that will not be copied

addTrove(self, name, version, flavor, presentOkay=False, byDefault=True, weakRef=False)

source code 
Adds a single version of a trove.
Parameters:
  • name (str) - name of the trove
  • version (versions.Version) - version of the trove
  • flavor (deps.deps.Flavor) - flavor of the trove to include
  • presentOkay (boolean) - replace if this is a duplicate, don't complain

delTrove(self, name, version, flavor, missingOkay, weakRef=False)

source code 
Removes a single version of a trove.
Parameters:
  • name (str) - name of the trove
  • version (versions.Version) - version of the trove
  • flavor (deps.deps.Flavor) - flavor of the trove to include
  • missingOkay (boolean) - should we raise an error if the version isn't part of this trove?

iterTroveList(self, strongRefs=False, weakRefs=False)

source code 

PUBLIC API

Returns a generator for (name, version, flavor) ordered pairs, listing all of the trove in the group, along with their versions.
Returns: list
Decorators:
  • @api.publicApi

applyChangeSet(self, trvCs, skipIntegrityChecks=False, allowIncomplete=False, skipFiles=False)

source code 
Updates the trove from the changes specified in a change set. Returns a dictionary, indexed by pathId, which gives the (path, version, troveName) for that file. This method assumes there are no conflicts.
Parameters:
  • trvCs (TroveChangeSet) - change set
  • skipIntegrityChecks (boolean) - Normally sha1 signatures are confirmed after a merge. In some cases (notably where version numbers are being changed), this check needs to be skipped.
Returns: dict

mergeTroveListChanges(self, strongChangeList, weakChangeList, redundantOkay=False)

source code 
Merges a set of changes to the included trove list into this trove.
Parameters:
  • strongChangeList ((name, list) tuple) - A list or generator specifying a set of trove changes; this is the same as returned by TroveChangeSet.iterChangedTroves(strongRefs=True, weakRefs=False)
  • weakChangeList ((name, list) tuple) - A list or generator specifying a set of trove changes; this is the same as returned by TroveChangeSet.iterChangedTroves(strongRefs=False, weakRefs=True)
  • redundantOkay (boolean) - Redundant changes are normally considered errors

__eq__(self, them)
(Equality operator)

source code 
Compare two troves for equality. This is an expensive operation, and shouldn't really be done. It's handy for testing the database though.
Overrides: lib.cstreams'.StreamSet.__eq__

diff(self, them, absolute=0, getPathHashes=None)

source code 

PUBLIC API

Generates a change set between them (considered the old version) and this instance. We return the change set, a list of other trove diffs which should be included for this change set to be complete, and a list of file change sets which need to be included. The list of trove changes is of the form (trvName, oldVersion, newVersion, oldFlavor, newFlavor). If absolute is True, oldVersion is always None and absolute diffs can be used. Otherwise, absolute versions are not necessary, and oldVersion of None means the trove is new. The list of file changes is a list of (pathId, oldVersion, newVersion, oldPath, newPath) tuples, where newPath is the path to the file in this trove.
Parameters:
  • them (Group) - object to generate a change set from (may be None)
  • absolute (boolean) - tells if this is a new group or an absolute change when them is None
Returns: (TroveChangeSet, fileChangeList, troveChangeList)
Decorators:
  • @api.publicApi
Overrides: lib.cstreams'.StreamSet.diff

_diffPackages(self, addedDict, removedDict, getPathHashes)

source code 
Matches up the list of troves that have been added to those that were removed. Matches are done by name first, then by heuristics based on labels, flavors, and path hashes.

getCompatibilityClass(self)

source code 
PUBLIC API
Decorators:
  • @api.publicApi

getTroveCopiedFrom(self)

source code 
For groups, return the list of troves that were used when a statement like addAll or addCopy was used.
Returns: list
list of (name, version, flavor) tuples.

__init__(self, name, version=None, flavor=None, changeLog=None, type=0, skipIntegrityChecks=False, setVersion=True)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: lib.cstreams'.StreamSet.__init__
(inherited documentation)

Class Variable Details [hide private]

streamDict

Value:
{0: (0, <type 'cstreams.StringStream'>, 'name'),
 1: (0, <class 'conary.streams.FrozenVersionStream'>, 'version'),
 2: (1, <class 'conary.streams.FlavorsStream'>, 'flavor'),
 3: (1, <class 'conary.changelog.ChangeLog'>, 'changeLog'),
 4: (1, <class 'conary.trove.TroveInfo'>, 'troveInfo'),
 5: (1, <class 'conary.streams.DependenciesStream'>, 'provides'),
 6: (1, <class 'conary.streams.DependenciesStream'>, 'requires'),
 7: (1, <class 'conary.trove.TroveRefsTrovesStream'>, 'strongTroves'),
...

v0SkipSet

Value:
{'buildFlavor': True,
 'compatibilityClass': True,
 'completeFixup': True,
 'derivedFrom': True,
 'dirHashes': True,
 'factory': True,
 'imageGroup': True,
 'incomplete': True,
...