pkgcore.fs.ops module

default fs ops.

Shouldn’t be accessed directly for the most part, use pkgcore.plugins to get at these ops.

exception pkgcore.fs.ops.CannotOverwrite(obj, existing)[source]

Bases: FailedCopy

exception pkgcore.fs.ops.FailedCopy(obj, msg)[source]

Bases: TypeError

pkgcore.fs.ops.copyfile(obj, mkdirs=False)[source]

copy a pkgcore.fs.fs.fsBase to its stated location.

Parameters:

objpkgcore.fs.fs.fsBase instance, exempting fsDir

Returns:

true if success, else an exception is thrown

Raises:

EnvironmentError – permission errors

pkgcore.fs.ops.ensure_perms(d1, d2=None)[source]

Enforce a fs objects attributes on the livefs.

Attributes enforced are permissions, mtime, uid, gid.

Parameters:

d2 – if not None, an fs object for what’s on the livefs now

Returns:

True on success, else an exception is thrown

Raises:

EnvironmentError – if fs object attributes can’t be enforced

pkgcore.fs.ops.merge_contents(cset, offset=None, callback=None)[source]

merge a pkgcore.fs.contents.contentsSet instance to the livefs

Parameters:
  • csetpkgcore.fs.contents.contentsSet instance

  • offset – if not None, offset to prefix all locations with. Think of it as target dir.

  • callback – callable to report each entry being merged; given a single arg, the fs object being merged.

Raises:

EnvironmentError – Thrown for permission failures.

pkgcore.fs.ops.mkdir(d)[source]

mkdir for a fsDir object

Parameters:

dpkgcore.fs.fs.fsDir instance

Returns:

true if success, else an exception is thrown

Raises:

EnvironmentError – if can’t complete

pkgcore.fs.ops.unmerge_contents(cset, offset=None, callback=None)[source]

unmerge a pkgcore.fs.contents.contentsSet instance to the livefs

Parameters:
  • csetpkgcore.fs.contents.contentsSet instance

  • offset – if not None, offset to prefix all locations with. Think of it as target dir.

  • callback – callable to report each entry being unmerged

Returns:

True, or an exception is thrown on failure (OSError, although see copyfile for specifics).

Raises:

EnvironmentError – see copyfile() and mkdir()