# Target - sources
SET(SRCS
+ step/configuration/step_check_start_files.cc
step/configuration/step_parse.cc
step/encryption/step_encrypt_resources.cc
step/encryption/step_remove_encryption_data.cc
--- /dev/null
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "wgt/step/configuration/step_check_start_files.h"
+
+#include <boost/filesystem/path.hpp>
+
+#include <common/app_installer.h>
+#include <common/installer_context.h>
+#include <common/step/step.h>
+
+#include <wgt/wgt_backend_data.h>
+
+#include <wgt_manifest_handlers/w3c_pc_utils.h>
+#include <wgt_manifest_handlers/content_handler.h>
+
+namespace bf = boost::filesystem;
+
+namespace wgt {
+namespace configuration {
+
+common_installer::Step::Status StepCheckStartFiles::process() {
+ bool flag = false; // it's not important in this step to use this flag
+ std::string error;
+ bool result_check = CheckStartFile(static_cast<WgtBackendData*>
+ (context_->backend_data.get())->content.get(),
+ context_->unpacked_dir_path.get(),
+ &flag);
+ if (!result_check) {
+ LOG(ERROR) << "Could not find valid start file";
+ return common_installer::Step::Status::PARSE_ERROR;
+ }
+
+ result_check = CheckServicesStartFiles(static_cast<WgtBackendData*>(
+ context_->backend_data.get())->service_list.get(),
+ context_->unpacked_dir_path.get(),
+ &error);
+ if (!result_check) {
+ LOG(ERROR) << error;
+ return common_installer::Step::Status::PARSE_ERROR;
+ }
+
+ return common_installer::Step::Status::OK;
+}
+
+} // namespace configuration
+} // namespace wgt
--- /dev/null
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+#ifndef WGT_STEP_CONFIGURATION_STEP_CHECK_START_FILES_H_
+#define WGT_STEP_CONFIGURATION_STEP_CHECK_START_FILES_H_
+
+#include <boost/filesystem.hpp>
+
+#include <common/app_installer.h>
+#include <common/installer_context.h>
+#include <common/step/step.h>
+
+#include <manifest_parser/utils/logging.h>
+
+#include <wgt/wgt_backend_data.h>
+
+#include <type_traits>
+#include <cassert>
+#include <memory>
+#include <set>
+#include <string>
+
+namespace wgt {
+namespace configuration {
+
+/**
+ * \brief The StepCheckStartFiles class
+ * Checks if valid start files exists.
+ * It needs content info from wgt_backend_data.
+ *
+ * Step is used in delta mode.
+ */
+class StepCheckStartFiles : public common_installer::Step {
+ public:
+ using Step::Step;
+
+ Status process() override;
+ Status clean() override { return Status::OK; }
+ Status undo() override { return Status::OK; }
+ Status precheck() override { return Status::OK; }
+
+ STEP_NAME(CheckStartFiles)
+};
+
+} // namespace configuration
+} // namespace wgt
+
+#endif // WGT_STEP_CONFIGURATION_STEP_CHECK_START_FILES_H_
LOG(ERROR) << "[Parse] Parse failed. " << parser_->GetErrorMessage();
return common_installer::Step::Status::PARSE_ERROR;
}
+
+ WgtBackendData* backend_data =
+ static_cast<WgtBackendData*>(context_->backend_data.get());
+
if (check_start_file_) {
- if (!parser_->HasValidStartFile()) {
+ if (!parser_->CheckValidStartFile()) {
LOG(ERROR) << parser_->GetErrorMessage();
return common_installer::Step::Status::PARSE_ERROR;
}
- if (!parser_->HasValidServicesStartFiles()) {
+ if (!parser_->CheckValidServicesStartFiles()) {
LOG(ERROR) << parser_->GetErrorMessage();
return common_installer::Step::Status::PARSE_ERROR;
}
+ } else {
+ // making backup of content data and services content data
+ auto content_info =
+ GetManifestDataForKey<const wgt::parse::ContentInfo>(
+ wgt::application_widget_keys::kTizenContentKey);
+ auto service_list =
+ GetManifestDataForKey<const wgt::parse::ServiceList>(
+ wgt::application_widget_keys::kTizenServiceKey);
+ if (content_info)
+ backend_data->content.set(*content_info);
+ if (service_list)
+ backend_data->service_list.set(*service_list);
}
manifest_x* manifest =
if (perm_info)
permissions = perm_info->GetAPIPermissions();
- WgtBackendData* backend_data =
- static_cast<WgtBackendData*>(context_->backend_data.get());
-
auto settings_info =
GetManifestDataForKey<const wgt::parse::SettingInfo>(
wgt::application_widget_keys::kTizenSettingKey);
LOG(DEBUG) << " ]-";
LOG(DEBUG) << "]-";
- // TODO(t.iwanek): In delta mode this step is running two times
if (context_->manifest_data.get())
pkgmgr_parser_free_manifest_xml(context_->manifest_data.get());
#include <common/utils/property.h>
#include <wgt_manifest_handlers/appwidget_handler.h>
+#include <wgt_manifest_handlers/content_handler.h>
+#include <wgt_manifest_handlers/service_handler.h>
#include <wgt_manifest_handlers/setting_handler.h>
#include <string>
Property<parse::SettingInfo> settings;
Property<parse::AppWidgetInfo> appwidgets;
+ Property<parse::ContentInfo> content;
+ Property<parse::ServiceList> service_list;
};
} // namespace wgt
#include <common/step/rds/step_rds_modify.h>
#include <common/step/rds/step_rds_parse.h>
+#include "wgt/step/configuration/step_check_start_files.h"
#include "wgt/step/configuration/step_parse.h"
#include "wgt/step/encryption/step_encrypt_resources.h"
#include "wgt/step/encryption/step_remove_encryption_data.h"
case ci::RequestType::Delta: {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::filesystem::StepUnzip>();
- // TODO(t.iwanek): manifest is parsed twice...
AddStep<wgt::configuration::StepParse>(
wgt::configuration::StepParse::ConfigLocation::PACKAGE, false);
- // start file may not have changed
AddStep<ci::configuration::StepParseManifest>(
ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
ci::configuration::StepParseManifest::StoreLocation::BACKUP);
AddStep<ci::filesystem::StepEnableExternalMount>();
AddStep<ci::filesystem::StepDeltaPatch>("res/wgt/");
AddStep<ci::filesystem::StepDisableExternalMount>();
- AddStep<wgt::configuration::StepParse>(
- wgt::configuration::StepParse::ConfigLocation::PACKAGE, true);
+ AddStep<wgt::configuration::StepCheckStartFiles>();
AddStep<ci::security::StepCheckSignature>();
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<wgt::security::StepCheckSettingsLevel>();