Skip to main content

Binary delta encoding utility.

Project description

buildstatus coverage codecov

About

Binary delta encoding in Python 3 and C.

Based on http://www.daemonology.net/bsdiff/, with the following differences:

  • LZMA or CRLE compression instead of BZ2.

  • Linear patch file access pattern to allow streaming.

  • SA-IS instead of qsufsort.

  • Variable length size fields.

  • Incremental apply patch implemented in C, suitable for memory constrained embedded devices.

Planned functionality:

  • CRC of patched to-data.

  • CRLE support in C.

  • Make the in-place patch type resumable.

Project homepage: https://github.com/eerimoq/detools

Documentation: http://detools.readthedocs.org/en/latest

Installation

pip install detools

Statistics

“LZMA reference” is the target binary compressed with lzma --best.

All sizes are in bytes.

Update

To size

LZMA reference

LZMA compression

CRLE compression

Size

Ratio

Patch size

Ratio

Patch size

Ratio

upy v1.9.4 -> v1.10

615388

367500

59.8 %

71802

11.7 %

161403

26.2 %

python 3.5 -> 3.6

4568920

1402663

30.7 %

1451510

31.8 %

-

-

foo old -> new

2780

1934

69.5 %

126

4.5 %

189

6.8 %

Example usage

Command line tool

The create patch subcommand

Create a patch foo.patch from tests/files/foo.old to tests/files/foo.new.

$ detools create_patch tests/files/foo.old tests/files/foo.new foo.patch
$ ls -l foo.patch
-rw-rw-r-- 1 erik erik 126 Mar  1 19:18 foo.patch

Create the same patch as above, but without compression.

$ detools create_patch --compression none tests/files/foo.old tests/files/foo.new foo-no-compression.patch
$ ls -l foo-no-compression.patch
-rw-rw-r-- 1 erik erik 2791 Mar  1 19:18 foo-no-compression.patch

The apply patch subcommand

Apply the patch foo.patch to tests/files/foo.old to create foo.new.

$ detools apply_patch tests/files/foo.old foo.patch foo.new
$ ls -l foo.new
-rw-rw-r-- 1 erik erik 2780 Mar  1 19:18 foo.new

The patch info subcommand

Print information about the patch foo.patch.

$ detools patch_info foo.patch
Type:               normal
Patch size:         126 bytes
To size:            2.71 KiB
Patch/to ratio:     4.5 % (lower is better)
Diff/extra ratio:   9828.6 % (higher is better)
Size/data ratio:    0.3 % (lower is better)
Compression:        lzma

Number of diffs:    2
Total diff size:    2.69 KiB
Average diff size:  1.34 KiB
Median diff size:   1.34 KiB

Number of extras:   2
Total extra size:   28 bytes
Average extra size: 14 bytes
Median extra size:  14 bytes

Contributing

  1. Fork the repository.

  2. Install prerequisites.

    pip install -r requirements.txt
  3. Implement the new feature or bug fix.

  4. Implement test case(s) to ensure that future changes do not break legacy.

  5. Run the tests.

    make test
  6. Create a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

detools-0.14.0.tar.gz (2.0 MB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page