} // namespace
+Status StepCreateSymbolicLink::precheck() {
+ manifest_x *m = context_->manifest_data.get();
+ if (!m) {
+ LOG(ERROR) << "manifest_data attribute is empty";
+ return Step::Status::INVALID_VALUE;
+ }
+ if (!(m->uiapplication || m->serviceapplication)) {
+ LOG(ERROR) << "Neither ui-application nor service-application exists";
+ return Step::Status::ERROR;
+ }
+
+ return Step::Status::OK;
+}
Status StepCreateSymbolicLink::process() {
// Get manifest_x
manifest_x *m = context_->manifest_data.get();
- if (!m) {
- LOG(ERROR) << "manifest_x is null";
- return Status::ERROR;
- }
// get ui-app and service-app
uiapplication_x *uiapp = m->uiapplication;
serviceapplication_x *svcapp = m->serviceapplication;
- if (!(uiapp || svcapp)) {
- LOG(ERROR) << "Neither ui-application nor service-application exists";
- return Status::ERROR;
- }
if (!CreateSymLink(uiapp, context_)) return Status::ERROR;
if (!CreateSymLink(svcapp, context_)) return Status::ERROR;
typedef common_installer::Step::Status Status;
using boost::filesystem::path;
+Status StepParse::precheck() {
+ if (context_->unpacked_dir_path.get().empty()) {
+ LOG(ERROR) << "unpacked_dir_path attribute is empty";
+ return Step::Status::INVALID_VALUE;
+ }
+ if (!boost::filesystem::exists(context_->unpacked_dir_path.get())) {
+ LOG(ERROR) << "unpacked_dir_path ("
+ << context_->unpacked_dir_path.get()
+ << ") path does not exist";
+ return Step::Status::INVALID_VALUE;
+ }
+
+ boost::filesystem::path tmp(context_->unpacked_dir_path.get());
+ tmp /= kManifestFileName;
+
+ if (!boost::filesystem::exists(tmp)) {
+ LOG(ERROR) << kManifestFileName << " not found from the package";
+ return Step::Status::INVALID_VALUE;
+ }
+
+ return Step::Status::OK;
+}
+
/* process()
* Parse tizen-manifest.xml and get the data from it
* Store the data into the context_
*/
Status StepParse::process() {
- std::unique_ptr<boost::filesystem::path> mPath(
- GetManifestFilePath(context_->unpacked_dir_path.get()));
- if (!mPath) {
- return Status::ERROR;
- }
- LOG(INFO) << "Parse " << mPath->c_str();
+ boost::filesystem::path mPath(context_->unpacked_dir_path.get());
+ mPath /= kManifestFileName;
+
+ LOG(INFO) << "Parse " << mPath.c_str();
XmlParser parser;
- std::unique_ptr<XmlTree> tree(parser.ParseAndGetNewTree(mPath->c_str()));
+ std::unique_ptr<XmlTree> tree(parser.ParseAndGetNewTree(mPath.c_str()));
if (tree == nullptr) {
LOG(ERROR) << "Failure on parsing xml";
return Status::ERROR;
return Status::OK;
}
-
-/* in parse() : Get manifest file path from the package unzipped directory
- */
-boost::filesystem::path* StepParse::GetManifestFilePath(
- const boost::filesystem::path& dir) {
- path* mPath = new path(dir);
- *mPath /= kManifestFileName;
-
- LOG(INFO) << "manifest file path: " << mPath->string();
- if (!boost::filesystem::exists(*mPath)) {
- LOG(ERROR) << kManifestFileName << " not found from the package";
- return nullptr;
- }
- return mPath; // object copy
-}
-
-
/* Read manifest xml, and set up context_ object
*/
bool StepParse::SetContextByManifestParser(XmlTree* tree) {
#ifndef TPK_STEP_STEP_PARSE_H_
#define TPK_STEP_STEP_PARSE_H_
-#include <boost/filesystem.hpp>
#include "common/step/step.h"
#include "tpk/xml_parser/xml_parser.h"
using Step::Step;
Status process() override;
- Status clean() override { return Status::OK; }
- Status undo() override { return Status::OK; }
- Status precheck() override { return Status::OK; }
+ Status clean() override { return Status::OK; };
+ Status undo() override { return Status::OK; };
+ Status precheck() override;
private:
- boost::filesystem::path* GetManifestFilePath(
- const boost::filesystem::path& dir);
bool SetContextByManifestParser(xml_parser::XmlTree* tree);
bool SetPkgInfoManifest(manifest_x* m,
xml_parser::XmlTree* tree, xml_parser::XmlElement* manifest);