From: Piotr Ganicz Date: Mon, 24 Oct 2016 14:04:29 +0000 (+0200) Subject: AppInstaller logic export X-Git-Tag: accepted/tizen/unified/20171128.150345~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F98%2F93998%2F15;p=platform%2Fcore%2Fappfw%2Fapp-installers.git AppInstaller logic export This commit gather the logic of choosing proper steps sequence to app-installer repository. All backends have to prepare their own sequences for each pkgmgr request. The default implementation of such methods is provided and there is no need for overriding each function in backends. Submit together: - https://review.tizen.org/gerrit/#/c/93999/ - https://review.tizen.org/gerrit/#/c/94000/ Change-Id: Ice10a836c28786f92f6fdd8bc0d23a6c7febce19 Signed-off-by: Damian Pietruchowski --- diff --git a/src/common/app_installer.cc b/src/common/app_installer.cc index ef2cf99..c5cb483 100644 --- a/src/common/app_installer.cc +++ b/src/common/app_installer.cc @@ -13,6 +13,7 @@ #include "common/installer_context.h" #include "common/pkgmgr_interface.h" #include "common/pkgmgr_signal.h" +#include "common/step/configuration/step_fail.h" namespace { @@ -38,6 +39,71 @@ AppInstaller::AppInstaller(const char* package_type, PkgMgrPtr pkgmgr) AppInstaller::~AppInstaller() { } +void AppInstaller::Init() { + switch (pkgmgr_->GetRequestType()) { + case RequestType::Install: + InstallSteps(); + break; + case RequestType::Update: + UpdateSteps(); + break; + case RequestType::Uninstall: + UninstallSteps(); + break; + case RequestType::Reinstall: + ReinstallSteps(); + break; + case RequestType::Delta: + DeltaSteps(); + break; + case RequestType::Move: + MoveSteps(); + break; + case RequestType::Recovery: + RecoverySteps(); + break; + case RequestType::MountInstall: + MountInstallSteps(); + break; + case RequestType::MountUpdate: + MountUpdateSteps(); + break; + case RequestType::ManifestDirectInstall: + ManifestDirectInstallSteps(); + break; + case RequestType::ManifestDirectUpdate: + ManifestDirectUpdateSteps(); + break; + case RequestType::ManifestPartialInstall: + ManifestPartialInstallSteps(); + break; + case RequestType::ManifestPartialUpdate: + ManifestPartialUpdateSteps(); + break; + case RequestType::PartialUninstall: + PartialUninstallSteps(); + break; + case RequestType::ReadonlyUpdateInstall: + ReadonlyUpdateInstallSteps(); + break; + case RequestType::ReadonlyUpdateUninstall: + ReadonlyUpdateUninstallSteps(); + break; + case RequestType::EnablePkg: + EnablePkgSteps(); + break; + case RequestType::DisablePkg: + DisablePkgSteps(); + break; + case RequestType::MigrateExtImg: + MigrateExtImgSteps(); + break; + default: + UnknownSteps(); + break; + } +} + AppInstaller::Result AppInstaller::Run() { std::list>::iterator it(steps_.begin()); std::list>::iterator itStart(steps_.begin()); @@ -149,6 +215,29 @@ AppInstaller::Result AppInstaller::Run() { return ret; } +void AppInstaller::InstallSteps() { UnknownSteps(); } +void AppInstaller::UpdateSteps() { UnknownSteps(); } +void AppInstaller::UninstallSteps() { UnknownSteps(); } +void AppInstaller::ReinstallSteps() { UnknownSteps(); } +void AppInstaller::DeltaSteps() { UnknownSteps(); } +void AppInstaller::MoveSteps() { UnknownSteps(); } +void AppInstaller::RecoverySteps() { UnknownSteps(); } +void AppInstaller::MountInstallSteps() { UnknownSteps(); } +void AppInstaller::MountUpdateSteps() { UnknownSteps(); } +void AppInstaller::ManifestDirectInstallSteps() { UnknownSteps(); } +void AppInstaller::ManifestDirectUpdateSteps() { UnknownSteps(); } +void AppInstaller::ManifestPartialInstallSteps() { UnknownSteps(); } +void AppInstaller::ManifestPartialUpdateSteps() { UnknownSteps(); } +void AppInstaller::PartialUninstallSteps() { UnknownSteps(); } +void AppInstaller::ReadonlyUpdateInstallSteps() { UnknownSteps(); } +void AppInstaller::ReadonlyUpdateUninstallSteps() { UnknownSteps(); } +void AppInstaller::DisablePkgSteps() { UnknownSteps(); } +void AppInstaller::EnablePkgSteps() { UnknownSteps(); } +void AppInstaller::MigrateExtImgSteps() { UnknownSteps(); } +void AppInstaller::UnknownSteps() { + AddStep(); +} + void AppInstaller::HandleStepError(Step::Status result, const std::string& error) { if (pi_) diff --git a/src/common/app_installer.h b/src/common/app_installer.h index 78c1e1a..1bc614c 100644 --- a/src/common/app_installer.h +++ b/src/common/app_installer.h @@ -118,9 +118,32 @@ class AppInstaller { PkgMgrPtr pkgmgr_; std::unique_ptr context_; + void Init(); + private: std::list> steps_; + virtual void InstallSteps(); + virtual void UpdateSteps(); + virtual void UninstallSteps(); + virtual void ReinstallSteps(); + virtual void DeltaSteps(); + virtual void MoveSteps(); + virtual void RecoverySteps(); + virtual void MountInstallSteps(); + virtual void MountUpdateSteps(); + virtual void ManifestDirectInstallSteps(); + virtual void ManifestDirectUpdateSteps(); + virtual void ManifestPartialInstallSteps(); + virtual void ManifestPartialUpdateSteps(); + virtual void PartialUninstallSteps(); + virtual void ReadonlyUpdateInstallSteps(); + virtual void ReadonlyUpdateUninstallSteps(); + virtual void DisablePkgSteps(); + virtual void EnablePkgSteps(); + virtual void MigrateExtImgSteps(); + virtual void UnknownSteps(); + // data used to send signal std::unique_ptr pi_;