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>
12 #include "common/installer_context.h"
13 #include "common/step/step.h"
15 namespace common_installer {
16 namespace filesystem {
19 * @brief The StepDeltaPatch class
20 * Patches the unpack directory content according to delta file so that
21 * new package content is complete and no file is missing.
23 * Patching package files with delta is performed in unpacked_dir before all
24 * step that operates on widget's final location. That means that whole new
25 * package content is prepared before any files of package installation are
29 * 1) `unpacked_dir` (where delta package is unpacked) is moved to
30 * `unpacked_dir_patch` (PATCH DIR)
31 * 2) old package content is moved to `unpacked_dir` (it becomes APP_DIR)
32 * 3) `unpacked_dir` is being applied with patches (using xdelta3 tool)
33 * 4) `unpacked_dir_patch` is removed.
34 * 5) Normal update flow proceeds as if it it was normal update installation
35 * (as the unpacked_dir contains full new version of package).
37 class StepDeltaPatch : public Step {
39 explicit StepDeltaPatch(InstallerContext* context,
40 const std::string& delta_root = "");
42 Status process() override;
43 Status clean() override { return Status::OK; }
44 Status undo() override;
45 Status precheck() override;
48 boost::filesystem::path patch_dir_;
49 std::string delta_root_;
54 } // namespace filesystem
55 } // namespace common_installer
57 #endif // COMMON_STEP_FILESYSTEM_STEP_DELTA_PATCH_H_