History log of /system/update_engine/payload_generator/payload_file.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c1651154a6df402069e2790801d650d2242ec630 05-Aug-2016 Alex Deymo <deymo@google.com> New setting to mark postinstall as optional.

This setting allows to mark a postinstall script as optional. This
allows the postinstall program to fail when it is not strictly required
to run for the update to succeed.

Bug: 27178350
TEST=Added unittest. Sideloaded an update with an optional postinstall.

(cherry picked from commit 5b91c6b141970c2b0095775a61e3f941417aa1ff)

Change-Id: I7bc36e2bf6e8363577adfc787d0fb6ddeeef8583
/system/update_engine/payload_generator/payload_file.cc
38818fbf1f2f937051b5bcc01ff74539a3c9b27d 23-Mar-2016 Alex Deymo <deymo@google.com> Introduce PayloadVersion struct for version information.

This new little struct encapsulates the version information (major and
minor version numbers) and the zlib fingerprint information. Now,
instead of querying throughout if the version number is certain value,
we ask the PayloadVersion struct whether certain operation is allowed in
that version or not. This moves the logic of what's supported and
what's not to a single place and eliminates the need to pass several
booleans to the helper functions.

Bug: 24578399
TEST=Unittest still pass.

(cherry picked from commit a4073ef63482fd08c3678982f7d153360b088094)

Change-Id: I756d0c2cc217d23df1822f961bb7d82f64974fa9
/system/update_engine/payload_generator/payload_file.cc
05feee0fc8f4f10b425f04e1f5cdd4831bbfb969 12-Nov-2015 Sen Jiang <senj@google.com> delta_generator: Include postinstall calls in the payload major version 2.

Added a new flag --new_postinstall_config_file which takes a path to a key
value store config file and saves this information to the PartitionUpdate
field.

The config file looks like this:
RUN_POSTINSTALL_root=true
POSTINSTALL_PATH_root=postinstall
FILESYSTEM_TYPE_root=ext4

"root" can be changed to any partition name.

Bug: 24537566
TEST=Generated a payload v2 with postinstall.
TEST=Added unittest.

Change-Id: Ied3c7bc2cfb54f4bcc69207f1e5bd473f72024fe
/system/update_engine/payload_generator/payload_file.cc
39910dcd1d68987ccee7c3031dc269233a8490bb 10-Nov-2015 Alex Deymo <deymo@google.com> Split payload application code into a subdirectory.

This patch splits from the main libupdate_engine code the part that
is strictly used to download and apply a payload into a new static
library, moving the code to subdirectories. The new library is divided
in two subdirectories: common/ and payload_consumer/, and should not
depend on other update_engine files outside those two subdirectories.
The main difference between those two is that the common/ tools are more
generic and not tied to the payload consumer process, but otherwise they
are both compiled together.

There are still dependencies from the new libpayload_consumer library
into the main directory files and DBus generated files. Those will be
addressed in follow up CLs.

Bug: 25197634
Test: FEATURES=test emerge-link update_engine; `mm` on Brillo.

Change-Id: Id8d0204ea573627e6e26ca9ea17b9592ca95bc23
/system/update_engine/payload_generator/payload_file.cc
3e728feb92bfd5514bff55aa7dc455da80e18906 05-Nov-2015 Sen Jiang <senj@google.com> Do not include signature dummy operation in major version 2.

It only exists for compatibility reason, for major version 2, there's no
point to add this any more.

Bug: None
TEST=Applied the new payload to a device.

Change-Id: I5803ab755415a1ba3d7460d82956bfe6e9fd4547
/system/update_engine/payload_generator/payload_file.cc
644f618b8bbaa096c1fcdcf7d6ed06e2538ea83c 07-Oct-2015 Sen Jiang <senj@google.com> delta_generator: Include metadata signature in major version 2.

--metadata_signature_file flag does what it should now.
Note that you should only pass this flag if the payload you are signing is
version 2.

Bug: 23981164
TEST=unit test added.

Change-Id: I613cd6a5fef188eca37c46c3f8a0a41d1c22f2fd
/system/update_engine/payload_generator/payload_file.cc
720df3eeaecfc9ad229440c59e08c8d52f13dc1e 01-Oct-2015 Sen Jiang <senj@google.com> Skip metadata signature when hashing payload in major version 2.

We should skip metadata signature when hashing the payload, so that the
payload signature won't depend on metadata signature.

VerifySignedPayload will also verify metadata signature now if it exist.

Bug: 23981164
TEST=cros_workon_make update_engine --test
Change-Id: I3e52b7bf8ddf1539bbb6934e8a5ec1112b94ae62
/system/update_engine/payload_generator/payload_file.cc
aef1c6f0b5a0059a103251a9a93bd0be43bd50a2 07-Oct-2015 Sen Jiang <senj@google.com> PayloadVerifier should not depend on DeltaPerformer to load payload.

The implementation in DeltaPerformer is designed for situation that payload
might only partially available, but in PayloadVerifier we already have the
whole payload. So I implemented LoadPayload in PayloadSigner which logic is
simpler and supports both version 1 and 2.

VerifySignedPayload is also moved to PayloadSigner since it's not used in
update engine daemon.
This patch also fixed wrong metadata size out in version 2 and misspelling
of metadata in WritePayload in PayloadFile.

Bug: 23981164
TEST=unit test added.

Change-Id: Id1917fc891dbf2075978a273d1a4ee3c4ecf0571
/system/update_engine/payload_generator/payload_file.cc
8241ffb63697b9ae7e91b52e71d36fe17470e43c 15-Oct-2015 Alex Deymo <deymo@google.com> Print operation names using InstallOperationTypeName().

PayloadFile had a local array to convert from the operation type enum
to a human-readable string name. Since the enum is converted to an int
this method will not fail to compile whenever new operations are added.

This patch removes such array and uses the existing
InstallOperationTypeName() function to convert the enum to string. This
fixes a buffer overflow in test code that generates new operations.

Bug: chromium:543593
Test: USE="clang asan" FEATURES=test emerge-link update_engine

Change-Id: Ib8d80711d039edf18a323aefaad4ce96e5dfc2e3
/system/update_engine/payload_generator/payload_file.cc
3f39d5cc753905874d8d93bef94f857b8808f19e 13-Oct-2015 Alex Vakulenko <avakulenko@google.com> update_engine: Rename "chromeos" -> "brillo" in include paths and namespaces

libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
Change-Id: I770659a95be380a50fe3b2ba9f91d65818f40945
/system/update_engine/payload_generator/payload_file.cc
b8060e435f0edb8efef4891a99fa18f642e01aa2 25-Sep-2015 Sen Jiang <senj@google.com> Parse metadata signature size in payload version 2.

This patch only parse the field and skip the signature without verifying it.

Bug: 23946683
TEST=unit test added.

Change-Id: I53e049c35f8c21d325aeb415ac9a2daf980fcda1
/system/update_engine/payload_generator/payload_file.cc
f4bb3e6fec85d1243d27c47af2a1778586c9919e 29-Sep-2015 Sen Jiang <senj@google.com> Add metadata signature size field in payload major version 2.

This field is always 0 for now.

Bug: 23981164
TEST=Generated a v2 payload, it has this field now.

Change-Id: Ie6cff3c7ff478e83cf46bf6ac378f95ef197cad3
/system/update_engine/payload_generator/payload_file.cc
b9ef491e87c17d809368ede0196569d8a106b963 22-Sep-2015 Sen Jiang <senj@google.com> Move partition info to PartitionUpdate in payload verison 2.

old_kernel_info, old_rootfs_info is now old_partition_info.
new_kernel_info, new_rootfs_info is now new_partition_info.

AddPartitionOperations is renamed to AddPartition because it now adds
partition info too.

Bug: 23694580
TEST=cros_workon_make update_engine --test
Generated a version 2 payload with delta_generator.

Change-Id: I07c7fc21198307e935679e62861cdac4b406c84f
/system/update_engine/payload_generator/payload_file.cc
70a6ab091beb261a501012bc09955de452dd4736 28-Aug-2015 Sen Jiang <senj@google.com> Move install operations to partitions field in major version 2.

install_operations and kernel_install_operations will be empty in major
version 2, they are now present in partitions field.

partition_info are still in old location, more refactoring are needed before
moving them.

This patch also moves the kLegancyPartitionName constants from install_plan.h
to payload_constants.h.

TEST=cros_generate_update_payload generate same payload version 1 as before.
Call delta_generator manually with --major_version=2, then cros payload show.
cros_workon_make update_engine --test

Bug: 23694580
Change-Id: If9e9531656480b1174e13b39af7ecb6a81060aac
/system/update_engine/payload_generator/payload_file.cc
6f20dd4fc8861d93d188cd27323d2f9746464aaf 19-Aug-2015 Alex Deymo <deymo@chromium.org> Fix includes and DBus headers to build on Android.

This patch include a set of small changes to includes and names in
order to be compatible with the Android build system.

First, the DBus .xml file needs to be renamed to .dbus-xml and the
output directory must match the soruce directory, since the headers are
generated with automatic Makefile rules.

Some headers required by bionic were missing, such as endian.h and
xattr.h. In the xattr.h case, we include the header from the glibc
(or bionic) instead of libattr, since libattr is not available in
AOSP in the first place, and we are not linking against it Chrome OS,
so we shold include the right headers.

Bug: 23084776
TEST=`FEATURES=test emerge-link update_engine` works; `mma` in AOSP doesn't have these errors anymore (but still doesn't build).

Change-Id: Ifeedfe9d894ca78baa03940ac55563cfcd464e76
/system/update_engine/payload_generator/payload_file.cc
46e9b1735a16518d563b3c7e7227408f8fc3e891 31-Aug-2015 Sen Jiang <senj@google.com> Add major_version flag in delta_generator.

Only affects major version number in the payload for now, actual implementation
of major version 2 will follow.

TEST=Call delta_generator manually with --major_version=2 then cros payload
show.

Bug: 23694580
Change-Id: I5baca5a868ec00dc2f6ea63d89e295d43283fd32
/system/update_engine/payload_generator/payload_file.cc
aea4c1cea20dda7ae7e85fc8924a2d784f70d806 20-Aug-2015 Alex Deymo <deymo@google.com> Re-license update_engine to Apache2

This patch automatically replaced the license on all text files from
Chromium OS (BSD style) to AOSP (Apache2), keeping the original year as
a reference.

The license header was added to .gyp and .gypi files, the NOTICE was
replaced with a copy of the Apache2 license and MODULE_LICENSE_* file
was updated.

BUG=b/23084294
TEST=grep 'Chromium OS Authors' doesn't find anything.

Change-Id: Ie5083750755f5180a8a785b24fe67dbf9195cd10
/system/update_engine/payload_generator/payload_file.cc
a12ee11c78ac6d7c2605921a4006b6a7416e0c35 13-Aug-2015 Alex Deymo <deymo@chromium.org> update_engine: Move InstallOperation to the top level.

The InstallOperation message in the protobuf is a nested message
inside the DeltaArchiveManifest message, making all references to
operation types be very long names like
DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ while most other
messages are not nested in the DeltaArchiveManifest message.

To improve readability and to prepare for future update metadata
changes, this patch moves the InstallOperation message to the top level
and replaces all references to operation types with the new shorter
version like InstallOperation::REPLACE_BZ.

This change only impacts the scope of the generated classes and the
serialized format of the protobuf. This exact same question was
addressed by protobuf maintainers here:

https://groups.google.com/forum/#!topic/protobuf/azWAPa6hP4A

Finally coding style and indentation was automatically updated due to
the shorter names.

BUG=b:23179128
TEST=Unittest still pass.

Change-Id: I55add54265934cd1fd3e9cb786c5d3f784902d17
Reviewed-on: https://chromium-review.googlesource.com/293504
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/payload_generator/payload_file.cc
14158570d3995008dc93a628004118b87a6bca01 13-Jun-2015 Alex Deymo <deymo@chromium.org> update_engine: Split delta_diff_generator file.

The DeltaDiffGenerator class includes both an OperationsGenerator using the
A-to-B operations and a set of common methods used also by the inplace generator.
The delta_diff_generator.{h,cc} files also include a single function to generate
the payload (GenerateUpdatePayloadFile) that centralizes the logic of generating
the operations and writing the payload.

This patch splits these three parts in different files. The common delta diff
function are moved to the delta_diff_utils.{h,cc} files. The operations generator
class that uses A-to-B operations is now in a new ab_generator.{h,cc} pair of files
that implement the ABGenerator() class. Finally, the payload file writing methods
are now in a single PayloadFile class.

This allow us to create payload files without the need to generate images and
their deltas. This will be used in a follow up CL to remove the image generation
logic from the unittests.

BUG=chromium:351589
TEST=Ran unittests. Regenerate a payload with and without this patch; got the same results.

Change-Id: I6816d2c805ba8c0c5c9423c720131a100a15ebaa
Reviewed-on: https://chromium-review.googlesource.com/280838
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/payload_generator/payload_file.cc