portage.manifest module

exception portage.manifest.FileNotInManifestException(value)

Bases: portage.exception.PortageException

args
with_traceback()

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.

Parameters
  • 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

_catsplit(pkg_key)

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

_createManifestEntries()
_getAbsname(ftype, fname)
_getCpvDistfiles(cpv)

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

_getDigestData(distlist)

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.

_parseManifestLines(mylines)

Parse manifest lines and return a list of manifest entries.

_pkgdir_category()
_read()

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

checkAllHashes(ignoreMissingFiles=False)
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)
checkIntegrity()
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.

findFile(fname)

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

getDigests()

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

getDistfilesSize(fetchlist)
getFileData(ftype, fname, key)

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

getFullname()

Returns the absolute path to the Manifest file for this instance

getTypeDigests(ftype)

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

getVersions()

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

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

validateSignature()

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

hashes
name
type
class portage.manifest.ManifestEntry(**kwargs)

Bases: object

hashes
name
type
portage.manifest.guessManifestFileType(filename)

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

portage.manifest.guessThinManifestFileType(filename)
portage.manifest.manifest2AuxfileFilter(filename)
portage.manifest.manifest2MiscfileFilter(filename)
portage.manifest.parseManifest2(line)