SET(SRCS
- step/step_parse.cc
step/step_create_symbolic_link.cc
step/step_copy_manifest_xml.cc
+ step/step_parse.cc
+ step/step_parse_recovery.cc
tpk_app_query_interface.cc
tpk_installer.cc
xml_parser/xml_parser.cc
#include <vector>
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "common/utils/logging.h"
using std::vector;
using std::string;
using xml_parser::XmlTree;
using xml_parser::XmlElement;
+namespace bf = boost::filesystem;
namespace ci = common_installer;
namespace tpk {
return Step::Status::OK;
}
+bf::path StepParse::LocateConfigFile() const {
+ boost::filesystem::path path(context_->unpacked_dir_path.get());
+ path /= kManifestFileName;
+ return path;
+}
+
/* process()
* Parse tizen-manifest.xml and get the data from it
* Store the data into the context_
*/
Status StepParse::process() {
- boost::filesystem::path mPath(context_->unpacked_dir_path.get());
- mPath /= kManifestFileName;
+ bf::path m_path = LocateConfigFile();
- LOG(INFO) << "Parse " << mPath.c_str();
+ LOG(INFO) << "Parse " << m_path.c_str();
XmlParser parser;
- std::unique_ptr<XmlTree> tree(parser.ParseAndGetNewTree(mPath.c_str()));
+ std::unique_ptr<XmlTree> tree(parser.ParseAndGetNewTree(m_path.c_str()));
if (tree == nullptr) {
LOG(ERROR) << "Failure on parsing xml";
return Status::ERROR;
Status undo() override { return Status::OK; };
Status precheck() override;
+ protected:
+ virtual boost::filesystem::path LocateConfigFile() const;
+
private:
bool SetContextByManifestParser(xml_parser::XmlTree* tree);
bool SetPkgInfoManifest(manifest_x* m,
bool SetPkgInfoChildren(manifest_x *m,
xml_parser::XmlTree *tree, xml_parser::XmlElement* manifest);
- SCOPE_LOG_TAG(StepParse)
+ SCOPE_LOG_TAG(Parse)
};
} // namespace parse
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#include "tpk/step/step_parse_recovery.h"
+
+#include <boost/filesystem/operations.hpp>
+
+#include "common/backup_paths.h"
+
+namespace bf = boost::filesystem;
+
+namespace {
+
+const char kManifestFileName[] = "tizen-manifest.xml";
+
+} // namespace
+
+namespace tpk {
+namespace parse {
+
+common_installer::Step::Status StepParseRecovery::process() {
+ (void) StepParse::process();
+ return Status::OK;
+}
+
+
+common_installer::Step::Status StepParseRecovery::precheck() {
+ if (context_->root_application_path.get().empty()) {
+ LOG(ERROR) << "Root path of packages in not set";
+ return Status::ERROR;
+ }
+ if (context_->pkgid.get().empty()) {
+ LOG(WARNING) << "Pkgid is not set. Parsing skipped";
+ return Status::OK;
+ }
+ return Status::OK;
+}
+
+boost::filesystem::path StepParseRecovery::LocateConfigFile() const {
+ context_->pkg_path.set(
+ context_->root_application_path.get() / context_->pkgid.get());
+ bf::path path1 = common_installer::GetBackupPathForPackagePath(
+ context_->pkg_path.get()) / kManifestFileName;
+ bf::path path2 = context_->pkg_path.get() / kManifestFileName;
+ if (bf::exists(path1))
+ return path1;
+ if (bf::exists(path2))
+ return path2;
+ return {};
+}
+
+} // namespace parse
+} // namespace tpk
+
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef TPK_STEP_STEP_PARSE_RECOVERY_H_
+#define TPK_STEP_STEP_PARSE_RECOVERY_H_
+
+#include <boost/filesystem/path.hpp>
+
+#include "common/utils/logging.h"
+#include "tpk/step/step_parse.h"
+
+namespace tpk {
+namespace parse {
+
+class StepParseRecovery : public StepParse {
+ public:
+ using StepParse::StepParse;
+
+ Status process() override;
+ Status precheck() override;
+
+ protected:
+ boost::filesystem::path LocateConfigFile() const override;
+
+ SCOPE_LOG_TAG(ParseRecovery)
+};
+} // namespace parse
+} // namespace tpk
+
+#endif // TPK_STEP_STEP_PARSE_RECOVERY_H_
#include "common/step/step_fail.h"
#include "common/step/step_generate_xml.h"
#include "common/step/step_old_manifest.h"
+#include "common/step/step_open_recovery_file.h"
#include "common/step/step_parse.h"
+#include "common/step/step_recover_application.h"
+#include "common/step/step_recover_files.h"
+#include "common/step/step_recover_icons.h"
+#include "common/step/step_recover_manifest.h"
+#include "common/step/step_recover_security.h"
+#include "common/step/step_recover_storage_directories.h"
#include "common/step/step_register_app.h"
#include "common/step/step_remove_icons.h"
#include "common/step/step_remove_files.h"
#include "common/step/step_revoke_security.h"
+#include "common/step/step_remove_temporary_directory.h"
#include "common/step/step_register_security.h"
#include "common/step/step_check_signature.h"
#include "common/step/step_unregister_app.h"
#include "tpk/step/step_copy_manifest_xml.h"
#include "tpk/step/step_create_symbolic_link.h"
#include "tpk/step/step_parse.h"
+#include "tpk/step/step_parse_recovery.h"
namespace ci = common_installer;
ReinstallSteps();
break;
case ci::RequestType::Recovery:
- AddStep<ci::configuration::StepFail>();
- // TODO(t.iwanek): recovery mode invocation...
+ RecoverySteps();
break;
default:
AddStep<ci::configuration::StepFail>();
AddStep<ci::configuration::StepFail>();
}
+void TpkInstaller::RecoverySteps() {
+ AddStep<ci::configuration::StepConfigure>(pkgmgr_);
+ AddStep<ci::recovery::StepOpenRecoveryFile>();
+ AddStep<tpk::parse::StepParseRecovery>();
+ AddStep<ci::pkgmgr::StepRecoverApplication>();
+ AddStep<ci::filesystem::StepRemoveTemporaryDirectory>();
+ AddStep<ci::filesystem::StepRecoverIcons>();
+ AddStep<ci::filesystem::StepRecoverManifest>();
+ AddStep<ci::filesystem::StepRecoverStorageDirectories>();
+ AddStep<ci::filesystem::StepRecoverFiles>();
+ AddStep<ci::security::StepRecoverSecurity>();
+}
+
} // namespace tpk
void UpdateSteps();
void UninstallSteps();
void ReinstallSteps();
+ void RecoverySteps();
SCOPE_LOG_TAG(TpkInstaller)
};