daklib.pdiff

Functions

asyncio_check_call(*args, **kwargs)

async variant of subprocess.check_call

open_decompressed(file[, named_temp_file])

Classes

PDiffHashes(size, sha1, sha256)

PDiffIndex(patches_dir[, max, merge_pdiffs])

class daklib.pdiff.PDiffHashes(size, sha1, sha256)[source]
classmethod from_file(fd)[source]
class daklib.pdiff.PDiffIndex(patches_dir, max=56, merge_pdiffs=False)[source]
async _bump_merged_patches()[source]
async _convert_to_merged_patches()[source]
_convert_to_unmerged()[source]
dump(out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]
find_obsolete_patches()[source]
async generate_and_add_patch_file(original_file, new_file_uncompressed, patch_name)[source]
prune_patch_history()[source]
read_index_file(index_file_path)[source]
update_index(tmp_suffix='.new')[source]
class daklib.pdiff._PDiffHashes(size, sha1, sha256)
_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('size', 'sha1', 'sha256')
classmethod _make(iterable)

Make a new _PDiffHashes object from a sequence or iterable

_replace(**kwds)

Return a new _PDiffHashes object replacing specified fields with new values

sha1

Alias for field number 1

sha256

Alias for field number 2

size

Alias for field number 0

async daklib.pdiff._merge_pdiffs(patch_a, patch_b, resulting_patch_without_extension)[source]

Merge two pdiff in to a merged pdiff

While rred support merging more than 2, we only need support for merging two. In the steady state, we will have N merged patches plus 1 new patch. Here we need to do N pairwise merges (i.e. merge two patches N times). Therefore, supporting merging of 3+ patches does not help at all.

The setup state looks like it could do with a bulk merging. However, if you merge from “latest to earliest” then you will be building in optimal order and still only need to do N-1 pairwise merges (rather than N-1 merges between N, N-1, N-2, … 3, 2 patches).

Combined, supporting pairwise merges is sufficient for our use case.

async daklib.pdiff._pdiff_hashes_from_patch(path_without_extension)[source]
daklib.pdiff._prune_history(order, history, maximum)[source]
daklib.pdiff._read_hashes(history, history_order, ind, hashind, lines)[source]
async daklib.pdiff.asyncio_check_call(*args, **kwargs)[source]

async variant of subprocess.check_call

Parameters reflect that of asyncio.create_subprocess_exec or (if “shell=True”) that of asyncio.create_subprocess_shell with restore_signals=True being the default.

async daklib.pdiff.open_decompressed(file, named_temp_file=False)[source]