chromium/third_party/puffin/README.chromium

Name: Puffin deterministic deflate recompressor
Short Name: Puffin
URL: https://android.googlesource.com/platform/external/puffin
Version: 1.0.0
Date: 2022-10-05
Revision: e0820dcfebfb4df925be2e37ad8f56c00dc624f5
License: BSD 3-Clause
License File: LICENSE
Security Critical: yes
Shipped: yes
License Android Compatible: yes

Description:
Puffin is a deterministic deflate recompressor. It is mainly used for patching
deflate compressed images (zip, gzip, etc.) because patches created from deflate
files/streams are usually large (deflate has a bit-aligned format, hence,
changing one byte in the raw data can cause the entire deflate stream to change
drastically.) Specifically in chromium/src, this library is needed in order for
Omaha, chrome's auto-updater client, to support puffin-generated diffs created
by Omaha Server.

Local Modifications:
- Updated OWNERS to reflect our team as the owners.
- Removed BUILD.gn taken from AOSP as it doesn't build in chromium.
- removed PRESUBMIT.cfg and PREUPLOAD.cfg
- Adding a DEPS file so we can pass presubmit checks.
- removed BSDiff as we only require the zucchini version of puffdiff/puffpatch
- rewrote the commandline usage for the puffin binary as we only need to support
    and test puffdiff and puffpatch.
- Replaced POSIX file IO with chromium/src's base::File/base::FilePath methods
    so it will build and run cross-platform.
- Removed dependence of libpuffpatch on libpuffdiff as the puffin patching
    service we plant to implement only requires libpuffpatch.
- Added puffin::Status enum to help disambiguate errors from puffin::PuffPatch
- Added puffin::ApplyPuffPatch API which allows chromium libraries to call
    puffin::PuffPatch without having worry about UniqueStreamPtr's and Buffer's.
- Added ApplyPuffPatchTest to patching_unittest to test the new method.
- Updated puffin/BUILD.gn to grab the new puffin_patch_test_files target under
components
- Updated puffin::ApplyPuffPatch test to use the new patch files under
components.
- Updated puffin::ApplyPuffPatch test to make sure the output files are deleted
so the tests will pass in back-to-back runs.
- Updated puffin::ApplyPuffPatch test to use base::ContentsEqual rather than
manually reading each file and comparing the results.
- Added puffin::PuffDiff definition that only requires source, destination,
and output patch filepaths as arguments.
- Updated puffin::PuffDiff to return puffin::Status rather than a generic
pass/fail bool.
- Removing Requirement to find deflates; in puffin::PuffDiff if a file doesn't
have deflates, we can still generate a raw patch.
- Updating puffdiff.cc, puffpatch.cc, and puffin_stream.cc to close streams properly.
This is an existing bug in the AOSP implementation, will notify the owners.
- Removing unnecessary symlink at third_party/puffin/src.
- Fixing one case where a stream is closed early.
- Updating patching_unittest with zucchini v2 patches to fix broken tests.
- missed one stream close in puffdiff.cc.
- Making sure to call FindDeflateSubBlocks in PuffDiff to prepopulate deflate
subblocks.
- Removing complete_static_lib = true from libpuffpatch to fix duplicate symbol
issue in nonembedded android component_updater.
- Removing logs to reduce chromium binary size.
- Fixed missing cstring includes for memcpy calls.
- Using base::numerics to do big endian conversion in puffpatch.cc.
- Updated puffdiff.cc to use spans for endian conversion and memcpy.
- Replaced LOG with VLOG to avoid unnecessary logging unless logging is enabled.