1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
5 #ifndef COMMON_STEP_FILESYSTEM_STEP_DELTA_PATCH_H_
6 #define COMMON_STEP_FILESYSTEM_STEP_DELTA_PATCH_H_
8 #include <manifest_parser/utils/logging.h>
13 #include "common/installer_context.h"
14 #include "common/step/step.h"
16 namespace common_installer {
17 namespace filesystem {
20 * @brief The StepDeltaPatch class
21 * Patches the unpack directory content according to delta file so that
22 * new package content is complete and no file is missing.
24 * Patching package files with delta is performed in unpacked_dir before all
25 * step that operates on widget's final location. That means that whole new
26 * package content is prepared before any files of package installation are
30 * 1) `unpacked_dir` (where delta package is unpacked) is moved to
31 * `unpacked_dir_patch` (PATCH DIR)
32 * 2) old package content is moved to `unpacked_dir` (it becomes APP_DIR)
33 * 3) `unpacked_dir` is being applied with patches (using xdelta3 tool)
34 * 4) `unpacked_dir_patch` is removed.
35 * 5) Normal update flow proceeds as if it it was normal update installation
36 * (as the unpacked_dir contains full new version of package).
38 class StepDeltaPatch : public Step {
40 explicit StepDeltaPatch(InstallerContext* context,
41 const std::string& delta_root = "");
43 Status process() override;
44 Status clean() override { return Status::OK; }
45 Status undo() override;
46 Status precheck() override;
49 std::filesystem::path patch_dir_;
50 std::string delta_root_;
55 } // namespace filesystem
56 } // namespace common_installer
58 #endif // COMMON_STEP_FILESYSTEM_STEP_DELTA_PATCH_H_