portage.manifest module

exception portage.manifest.FileNotInManifestException(value)

Bases: portage.exception.PortageException


Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class portage.manifest.Manifest(pkgdir, distdir=None, fetchlist_dict=None, manifest1_compat=<class 'DeprecationWarning'>, from_scratch=False, thin=False, allow_missing=False, allow_create=True, hashes=None, required_hashes=None, find_invalid_path_char=None, strict_misc_digests=True)

Bases: object

_apply_max_mtime(preserved_stats, entries)

Set the Manifest mtime to the max mtime of all relevant files and directories. Directory mtimes account for file renames and removals. The existing Manifest mtime accounts for eclass modifications that change DIST entries. This results in a stable/predictable mtime, which is useful when converting thin manifests to thick manifests for distribution via rsync. For portability, the mtime is set with 1 second resolution.

  • preserved_stats (dict) – maps paths to preserved stat results that should be used instead of os.stat() calls

  • entries (list) – list of current Manifest2Entry instances


Split a category and package, returning a list of [cat, pkg]. This is compatible with portage.catsplit()

_getAbsname(ftype, fname)

Get a list of all DIST files associated to the given cpv


create a hash dict for a specific list of files

_is_cpv(cat, pn, filename)
_parseDigests(mylines, myhashdict=None, mytype=None)

Parse manifest entries and store the data in myhashdict. If mytype is specified, it will override the type for all parsed entries.


Parse manifest lines and return a list of manifest entries.


Parse Manifest file for this instance

_readManifest(file_path, myhashdict=None, **kwargs)

Parse a manifest. If myhashdict is given then data will be added too it. Otherwise, a new dict will be created and returned.

_update_thick_pkgdir(cat, pn, pkgdir)
_update_thin_pkgdir(cat, pn, pkgdir)
addFile(ftype, fname, hashdict=None, ignoreMissing=False)

Add entry to Manifest optionally using hashdict to avoid recalculation of hashes

checkCpvHashes(cpv, checkDistfiles=True, onlyDistfiles=False, checkMiscfiles=False)

check the hashes for all files associated to the given cpv, include all AUX files and optionally all MISC files.

checkFileHashes(ftype, fname, ignoreMissing=False, hash_filter=None)
checkTypeHashes(idtype, ignoreMissingFiles=False, hash_filter=None)
create(checkExisting=False, assumeDistHashesSometimes=False, assumeDistHashesAlways=False, requiredDistfiles=[])

Recreate this Manifest from scratch. This will not use any existing checksums unless assumeDistHashesSometimes or assumeDistHashesAlways is true (assumeDistHashesSometimes will only cause DIST checksums to be reused if the file doesn’t exist in DISTDIR). The requiredDistfiles parameter specifies a list of distfiles to raise a FileNotFound exception for (if no file or existing checksums are available), and defaults to all distfiles when not specified.


Return entrytype of the given file if present in Manifest or None if not present


Compability function for old digest/manifest code, returns dict of filename:{hashfunction:hashvalue}

getFileData(ftype, fname, key)

Return the value of a specific (type,filename,key) triple, mainly useful to get the size for distfiles.


Returns the absolute path to the Manifest file for this instance


Similar to getDigests(), but restricted to files of the given type.


Returns a list of manifest versions present in the manifest file.

hasFile(ftype, fname)

Return whether the Manifest contains an entry for the given type,filename pair

parsers = (<function parseManifest2>,)
removeFile(ftype, fname)

Remove given entry from Manifest


Sign the Manifest

updateAllHashes(checkExisting=False, ignoreMissingFiles=True)

Regenerate all hashes for all files in this Manifest.

updateCpvHashes(cpv, ignoreMissingFiles=True)

Regenerate all hashes associated to the given cpv (includes all AUX and MISC files).

updateFileHashes(ftype, fname, checkExisting=True, ignoreMissing=True, reuseExisting=False)

Regenerate hashes for the given file

updateHashesGuessType(fname, *args, **kwargs)

Regenerate hashes for the given file (guesses the type and then calls updateFileHashes).

updateTypeHashes(idtype, checkExisting=False, ignoreMissingFiles=True)

Regenerate all hashes for all files of the given type


Validate signature on Manifest

write(sign=False, force=False)

Write Manifest instance to disk, optionally signing it. Returns True if the Manifest is actually written, and False if the write is skipped due to existing Manifest being identical.

class portage.manifest.Manifest2Entry(**kwargs)

Bases: portage.manifest.ManifestEntry

class portage.manifest.ManifestEntry(**kwargs)

Bases: object


Perform a best effort guess of which type the given filename is, avoid using this if possible