summaryrefslogtreecommitdiff
path: root/payload_generator/graph_utils.cc
AgeCommit message (Collapse)Author
2019-10-03update_engine: Deprecate minor version 1Amin Hassani
Minor version 1 was for the old days where we rewrite the signle partition with an update (no A/B partitions). But those days are long over and we don't think there is any device out that has this capability anymore. Even if there is, we can always serve full payloads along with the stepping stone we have in M53. So this is safe to go. BUG=chromium:1008553 TEST=sudo FEATURES=test emerge update_engine TEST=ran cros flash two times. Change-Id: Ib928ade36af5136cd4013a30dfb39ee7fd5b07b1 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1829160 Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2019-01-16update_engine: Run clang-format on payload_generator/Amin Hassani
BUG=none TEST=unittest Change-Id: I00cafb1fc709d8f02119cb0058cfcb0b573ef25d Reviewed-on: https://chromium-review.googlesource.com/1409927 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
2017-12-12update_engine: Remove the duplicate BlocksInExtentsAmin Hassani
This patch removes the duplicate BlocksInExtents from extent_utils.h and fixes the remainder of the code to reflect this change. BUG=none TEST=unittests pass; Change-Id: I76f5106f75072b20cd8f41f081b2f2b07aeac9a8 Reviewed-on: https://chromium-review.googlesource.com/812009 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Alex Deymo <deymo@google.com> Reviewed-by: Sen Jiang <senj@chromium.org>
2015-11-12Split payload application code into a subdirectory.Alex Deymo
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
2015-08-19Re-license update_engine to Apache2Alex Deymo
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
2015-07-17update_engine: Sort full operations by destination.Alex Deymo
The inplace generator moves all the full operations to the end of the list. This patch sorts those operations by the destination. This patch also cleans up the Vertex class by using the new AnnotatedOperation class instead of the operation and file_name separated. BUG=None TEST=Unittest still pass. minor_version=1 full operations appear in order according to "cros payload". Change-Id: Ia0c15939086cec52dc855cbc3afa913f8cbebf6b Reviewed-on: https://chromium-review.googlesource.com/286213 Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
2015-06-12update_engine: Use the FilesystemInterface to generate deltas.Alex Deymo
This patch removes the FilesystemIterator used to iterate the file data blocks, the metadata.{cc,h} files used to iterate the metadata blocks and the ReadUnwrittenBlocks() method used to process the rest of the blocks. Instead, these three cases are handled by the same DeltaReadFilesystem() method using the FilesystemInterface abstraction for ext2. The sub-file block handling was changed from (filename, offset, size) to just the list of blocks (or Extents) and the parsing of the filesystem was removed from the methods that produce operations. The filename is kept just as a label for logging purposes. This patch implies that the filesystem doesn't need to be mounted in order to generate the payload, as all the data is accessed as blocks in a partition. The mountpoint was removed from all the operations generators, but it is still required to mount the old filesystem to detect the minor version supported by the old update_engine. Also, since the list of blocks is never accessed using the FIGETBSZ ioctl, no payload_generator/ test require root privileges, nor the delta_generator binary. BUG=chromium:305832,chromium:331965 TEST=Updated unittest to use extents. Change-Id: Ia2ea9433190258f70e3bce09f896b18326a7abf9 Reviewed-on: https://chromium-review.googlesource.com/275804 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
2015-06-04update_engine: Split Extent utils from graph_utils.Alex Deymo
"Graph" related utils should only concern parts of the code using the inplace generator, since other generators don't use a dependency graph. This patch splits the Extent related utils from the graph related ones creating a new extent_utils.h file. BUG=None TEST=unittest still pass. Change-Id: I0941698b0a47a6cc222e8dc062fc54eb3cdf4de2 Reviewed-on: https://chromium-review.googlesource.com/274899 Reviewed-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
2015-03-27update_engine: Refactor OperationsGenerator into a base class.Alex Deymo
This refactor cleans up the interface of the algorithms that generate the list of rootfs and kernel operations removing the mention of a Graph from it. The Graph class is only used by the in-place generator because it requires to keep track of dependencies between operations reading or writting the same block. The full update generator, using only REPLACE or REPLACE_BZ doesn't need to use a graph to do that, but in order to reuse some code, the interface was hacked that way. This patch now uses two vectors of "AnnotatedOperations", which are a mere InstallOperation as defined by the .proto file plus a name used for logging purposes only. Both rootfs and kernel operations have now the same type on the interface, allowing to share common functions handling those. BUG=chromium:331965 TEST=FEATURES=test emerge-link update_engine Change-Id: I78566bbecb948634b7ecc8d086766ce67a79b43e Reviewed-on: https://chromium-review.googlesource.com/262281 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
2015-02-20update_engine: Add new operation codes for a to b operationsAllie Wood
Add SOURCE_COPY and SOURCE_BSDIFF operations to protobuf. These operations are for delta minor version 2 and their input is the source partition instead of the target partition. BUG=chromium:459363 TEST=`FEATURES=test emerge-link update_engine` Change-Id: I2c5c83ab5063ff6ce7fc2ec8acfe809d9526b6da Reviewed-on: https://chromium-review.googlesource.com/250951 Reviewed-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Allie Wood <alliewood@chromium.org> Tested-by: Allie Wood <alliewood@chromium.org>
2014-11-01update_engine: Fix all the "using" declaration usage.Alex Deymo
This patch removes unused "using" declarations, that is, declarations included in a .cc file at a global scope such that "using foo::bar" that later don't use the identifier "bar" at all. This also unifies the usage of these identifiers in the .cc files in favor of using the short name defined by the using declaration. For example, in several cases the .h refer to a type like "std::string" because using declarations are forbidden in header files while the .cc includes "using std::string;" with the purpose of just writting "string" in the .cc file. Very rarely, the full identifier is used when a local name ocludes it, for example, StringVectorToGStrv() and StringVectorToString() in utils.cc named its argument just "vector" need to refer to std::vector with the full name. This patch renames those arguments instead. Finally, it also sorts a few lists of using declarations that weren't in order. BUG=None TEST=FEATURES=test emerge-link update_engine Change-Id: I30f6b9510ecb7e03640f1951c48d5bb106309840 Reviewed-on: https://chromium-review.googlesource.com/226423 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
2014-09-03update_engine: Include base/macros.h instead of base/basictypes.hBen Chan
update_engine no longer uses the integer types from base/basictypes.h. It should simply include base/macros.h for the DISALLOW_COPY_AND_ASSIGN macro instead. BUG=None TEST=`FEATURES=test emerge-$BOARD update_engine` Change-Id: Idf18bc69339b7170122b289342c724c862454062 Reviewed-on: https://chromium-review.googlesource.com/216140 Tested-by: Ben Chan <benchan@chromium.org> Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Ben Chan <benchan@chromium.org>
2014-07-19update_engine: fixed remaining linter and some spelling errorsAlex Vakulenko
Fixed remaining errors from cpplint as well as some spelling errors mostly in comments. BUG=None TEST=FEATURES=test emerge-link update_engine Change-Id: I484988ab846ac5a3c68c016ddccfb247f225ec27 Reviewed-on: https://chromium-review.googlesource.com/208897 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org> Tested-by: Alex Vakulenko <avakulenko@chromium.org>
2014-06-18update_engine: fixed warnings from cpplintAlex Vakulenko
Fixed all the cpplint warnings in update engine. BUG=None TEST=Unit tests still pass. Change-Id: I285ae858eec8abe0b26ff203b99a42a200ceb71c Reviewed-on: https://chromium-review.googlesource.com/204027 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Tested-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2014-05-19Move payload generator files to payload_generator/ directory.Alex Deymo
This creates a new subdirectory payload_generator/ with all the payload generator specific files. The SConstruct file is updated to continue building all the files together, including those in the subdirectories, since some parts of the update_engine are using parts of the payload generation code. To reduce this code coupling, a new payload_constants.h file is introduced, with few constants used on the payload definition by both the payload generation and the payload performer. Finally, includes are updated and in some cases removed when they weren't used. Order of includes is also fixed to comply with the style guide. BUG=chromium:374377 TEST=Build and unittests still pass. delta_generator still present on base directory. Change-Id: I454bbc7a66c70ebb19fd596c352c7be40a081f3d Reviewed-on: https://chromium-review.googlesource.com/200325 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>