non-AB code will be moved to bootable/deprecated-ota , so add necessary
visibility rules.
Test: th
Bug: 324360816
Change-Id: Icc56f020ab1470c797cad0d62e4bd027fcfcd703
bsdiff_unittest is marked host_supported:true but use
a AndroidTest.xml config that can only work for device.
Deleting the explict config to rely on the auto-gen ones.
Adding unit_tests:true to run in presubmit
Change-Id: Ia3a23149ccdc2efa2c880436e30fcff4acf9ddd9
Test: presubmit, atest bsdiff_unittest --host
Bug: 179092189
Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
Android.bp
Bug: 68860345
Bug: 151177513
Bug: 151953481
Test: m all
Exempt-From-Owner-Approval: janitorial work
Change-Id: Ic407d90ef0cf787a41786d3775653c5a1e831df8
As part of fixing b/68319577, some libraries were made vendor_available: true.
To minimize new dependencies from vendor on these libraries, this change
restricts the visibility of the libraries to only the framework projects that
currently use them.
Bug: 141649008
Test: Targets build successfully.
Change-Id: I675f5d74bb6d1bf06ae5ebd8ae5bfdd5653485a3
This change is part of a topic that moves the recovery resources from the
system partition to the vendor partition, if it exists, or the vendor directory
on the system partition otherwise. The recovery resources are moving from the
system image to the vendor partition so that a single system image may be used
with either an A/B or a non-A/B vendor image. The topic removes a delta in the
system image that prevented such reuse in the past.
The recovery resources that are moving are involved with updating the recovery
partition after an update. In a non-A/B configuration, the system boots from
the recovery partition, updates the other partitions (system, vendor, etc.)
Then, the next time the system boots normally, a script updates the recovery
partition (if necessary). This script, the executables it invokes, and the data
files that it uses were previously on the system partition. The resources that
are moving include the following.
* install-recovery.sh
* applypatch
* recovery-resource.dat (if present)
* recovery-from-boot.p (if present)
This change supports making a direct or transitive dependency of the applypatch
executable available to applypatch, which is now on vendor.
Bug: 68319577
Test: Ensure that recovery partition is updated correctly.
Change-Id: I66059c3cfe2f65eca990b29609fd2c5f52e17266
All the users should use libbspatch instead. The host rule stays for
easier testing.
Test: m checkbuild
Change-Id: I4a23a7383ebda8b7bf61508ffe3cf47cc573ad29
Bortli returns BROTLI_DECODER_RESULT_SUCCESS only when the whole file
was already decompressed, otherwise it will keep returning
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT until enough output space was
provided overall.
This patch fixes the infinite loop caused when trying to decompress
more bytes than available in the uncompressed stream.
Bug: None
Test: Added unittests.
Change-Id: I3a17dc2e9a0b90659161a9315ce27cdb5e90a894
The bz2 decompressor expects to read from the input until there's enough
output produced. This patch makes the read fail if we get stuck without
making any progress in the decompression.
Bug: chromium:818174
Test: Added unittest.
Change-Id: Iaee8a2184ec1c5a7dbbe261ec77a39ce247965a3
Add a parser of format, type and quality in the bsdiff main function.
This allow the bsdiff binary to choose between the BSDFF40|BSDF2 patch
format and compress the patch with desired algorithms.
Bug: 34220646
Test: unittest pass; generate brotli compressed patches with bsdiff
binary
Change-Id: Ia4f7941e4eca7e6047e2749315127d1cf4a988ee
The logger supports LOG & PLOG. It also adds a std::endl at the end of
the stream so that we don't need to add it manually at the callsite.
Test: run bsdiff and check the logs.
Change-Id: Ice94902a501532ceaeb480c3576e752e435cab70
This CL implements the brotli decompressor used in PatchReader. Also
extract the CompressorType and patch's MagicHeader to a common header file.
Bug: 34220646
Test: Run bsdiff/bspatch with brotli compressor/decompressor over a list
of files from angler's system image.
Change-Id: I76e11168075c6481490ffbc025ec4ca81e828732
Android's Play Store uses, among other options, a bsdiff patch format
similar to Matthew Endsley's bsdiff implementation. The main difference
is that Play Store's version doesn't do any compression in the patch
format itself, but instead the compression is handled at a higher
level.
This CL introduces a new PatchWriterInterface derived class to write to
this (uncompressed) format.
See https://github.com/mendsley/bsdiff for the original implementation
of this format. See also Google's APK patch size estimator for more
information on the file-by-file format used by Play Store:
https://github.com/googlesamples/apk-patch-size-estimator
Bug: 67458097
Test: Added simple unittests for the generated files.
Change-Id: I3b048abf2220e2cb3af0a95e27efe1c0f241046a
All clients now include "bsdiff/bsdiff.h" so no need for this export
path anymore.
Bug: None
Test: `make checkbuild`
Change-Id: I0cc7882a58905fcd276600ee2efa01620a7ab378
Add a new compressor interface; and the brotli compressor which is
similar to the existing bz2 one.
Also add a new CompressorType argument to PatchWriter's init function;
this allows us to choose the right compressor based on the input option
in the future.
Bug: 34220646
Test: Run bsdiff/bspatch with brotli compressor/decompressor over a
list of files from angler's system image. Make succeeds.
Change-Id: Id9a3db2d7d051dcb751a1fc362f4c3b9226e878b
We want to expose the patch writers constructors in the public API
without necesarily exposing the internal details. For that, we use a
factory in the public API so callers can create the PatchWriters they
need.
We will extend this file with new patch formats.
Bug: 34220646
Test: Used this interface from the bsdiff_main.cc (see follow up CL).
Change-Id: I1f005f103886579eacf37b7d9767b713e066030c
Add a wrapper class to separate the patch read from data stream
decompression. Therefore, bspatch will be able to process the patch
that is compressed with various tools.
Test: unittest pass
Change-Id: I5214e0451bde80366e8a70b960703afb2b2a7d97
The suffix array is used to search for strings from the new file in the
old file. The size of each element of the suffix array must be big
enough to hold the length of the old file. In most of the cases we use,
if not all of them, the old file is smaller than 2 GiB, which allows to
use 32-bit integers for the suffix array.
The previous code decided whether to use 64-bit or 32-bit integers
based on the large-file surpport, even in 32-bit computers architectures
which would not work in those cases; and would also use twice as much
memory when constructing the suffix array of inputs smaller than 2 GiB.
This patch selects the suffix array size based on the input size,
effectively using half the memory in the most common case. This also
improves the runtime performance due to lower cache pressure.
As a side effect, this patch hides the suffix array implementation
details from the public interface. This removes the limitation where
the caller of libbsdiff and libbsdiff needed to be compiled with the
same large-file support flags; and also hides the dependency on
libdivsufsort from the public interface.
While doing so, instead of re-implementing the suffix array search
algorithm (which had a history of bugs and corner cases) we re-use the
one from libdivsufsort, adapted to the bsdiff algorithm use-case.
The result is about 40% faster when diffing 10MiB files, and the patch
size is within 0.1%, due to differences in the position selected
whenever more than one match is available.
Bug: 34220646
Test: Added unittests for the suffix array.
Change-Id: Ib9dc85a83bbf10157a3937c5687e5663ab0d20d5
This new PatchWriterInterface derived class allows to split the
output patch of a bsdiff run into multiple files of a fixed new file
size. This allows to split long operations with minimal loss of patch
size due to splitting the compression blocks. For large enough new file
sections, this patch size reduction should be minimal.
Bug: 34220646
Test: Added unittests.
Change-Id: Ib90fddd5c55a38c87ce396f2792aa558ecd07b22
The recently introduced PatchWriterInterface had both the patch file
format logic and the diff/extra streams selection from the control
entries. While this simplifies the bsdiff main algorithm and makes
invalid usages of the BsdiffPatchWriter evident, writing alternative
PatchWriterInterface classes required to replicate the diff/extra
stream selection logic.
This patch splits out the diff/extra stream generation and all the
checks around those to a new helper class DiffEncoder. The public
interface PatchWriterInterface now has two methods to accept the diff
and extra stream data, and does not compute them.
Bug: 34220646
Test: Added unittests. Ran bsdiff on some pairs of files obtaining the same result as before.
Change-Id: I5f303c06f1e10910eb00dcfda38c6811977a91cf
Split the unittest logic between bsdiff() function and the PatchWriter.
This patch now tests individually the PatchWriter logic that writes to
disk and the bsdiff() logic to create patches in the same very simple
cases.
We also update the Android.bp file to only pass -DBSDIFF_TARGET_UNITTEST
when building for the target.
Bug: 34220646
Test: ran unittests.
Change-Id: I9350157ee4a0b5a617f44bb187bd7652f6d6f017
This prevents accidentally including a header file from another project
that happens to have the same name.
Test: `make checkbuild`; emerge-${BOARD} bsdiff
Bug: None
Change-Id: I8af132ed388738c30a8e3d7434de70b1e9d2f924
bsdiff.cc had code to handle both the sub-streams compression and the
patch format. This CL moves the patch file format logic to a new class
in a separated file, and the bzip2 compression to another class. This
allows to replace the core bsdiff logic separatedly from the patch
format.
There are no changes to the functionality of bsdiff and the generated
patches. The code does a bit more of memcpy() since it doesn't write
the control stream to disk as it goes.
Bug: 34220646
Test: Ran bsdiff and compared results with previous version.
Change-Id: Ibdc1482e98cbd370cbed677c326008e19a217ef8