cp %{SOURCE1001} .
%build
-%cmake . -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}
+%cmake . -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} -DWRT_LAUNCHER=%{_bindir}/xwalk-launcher
make %{?_smp_mflags}
%install
#define DBG(msg) std::cout << "[GenerateXML] " << msg << std::endl;
#define ERR(msg) std::cout << "[ERROR: GenerateXML] " << msg << std::endl;
-namespace {
-
-const char kLauncher[] = "/usr/lib/xwalk/xwalk";
-
-} // anonymous namespace
namespace common_installer {
namespace generate_xml {
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
fs::path exec_path = fs::path(context_->pkg_path()) / fs::path(ui->appid)
- / fs::path("bin");
- utils::CreateDir(exec_path);
+ / fs::path("bin") / fs::path(ui->appid);
- exec_path /= fs::path(ui->appid);
-
- fs::create_symlink(fs::path(kLauncher), exec_path, error);
- if (error) {
- ERR("Failed to set symbolic link "
- << boost::system::system_error(error).what());
- xmlFreeTextWriter(writer);
- return Step::Status::ERROR;
- }
xmlTextWriterWriteAttribute(writer, BAD_CAST "exec",
BAD_CAST exec_path.string().c_str());
xmlTextWriterWriteAttribute(writer, BAD_CAST "type",
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
fs::path exec_path = fs::path(context_->pkg_path()) / fs::path(svc->appid)
- / fs::path("bin");
- utils::CreateDir(exec_path);
-
- exec_path /= fs::path(svc->appid);
-
- fs::create_symlink(fs::path(kLauncher), exec_path, error);
- if (error) {
- ERR("Failed to set symbolic link "
- << boost::system::system_error(error).what());
- xmlFreeTextWriter(writer);
- return Step::Status::ERROR;
- }
+ / fs::path("bin") / fs::path(svc->appid);
xmlTextWriterWriteAttribute(writer, BAD_CAST "exec",
BAD_CAST exec_path.string().c_str());
# Target - sources
SET(SRCS
step/step_parse.cc
+ step/step_symbolic_link.cc
wgt_backend.cc
)
+
+IF(WRT_LAUNCHER)
+ ADD_DEFINITIONS("-DWRT_LAUNCHER=\"${WRT_LAUNCHER}\"")
+ MESSAGE( "WRT LAUNCHER binary path is set to ${WRT_LAUNCHER}")
+ELSE(WRT_LAUNCHER)
+ MESSAGE(FATAL_ERROR, "WRT LAUNCHER binary path is not set")
+ENDIF(WRT_LAUNCHER)
+
# Target - definition
ADD_EXECUTABLE(${TARGET_WGT_BACKEND} ${SRCS})
# Target - includes
--- /dev/null
+/* 2014, Copyright © Eurogiciel Coporation, APACHE-2.0, see LICENSE file */
+
+#include "wgt/step/step_symbolic_link.h"
+
+#include <pkgmgr-info.h>
+#include <unistd.h>
+
+#include <boost/filesystem.hpp>
+#include <cassert>
+#include <cstring>
+#include <iostream>
+#include <cstdio>
+#include <string>
+
+#include "common/utils.h"
+
+#define DBG(msg) std::cout << "[Symoblic Link] " << msg << std::endl;
+#define ERR(msg) std::cout << "[ERROR: Symoblic Link] " << msg << std::endl;
+
+namespace wgt {
+namespace symbolic_link {
+
+namespace fs = boost::filesystem;
+
+common_installer::Step::Status StepSymbolicLink::process() {
+ assert(context_->manifest_data());
+ boost::system::error_code error;
+ uiapplication_x* ui = context_->manifest_data()->uiapplication;
+ serviceapplication_x* svc = context_->manifest_data()->serviceapplication;
+ if ((!ui) && (!svc)) {
+ ERR("There is neither UI applications nor"
+ << "Services applications described!\n");
+ return Step::Status::ERROR;
+ }
+ // add ui-application element per ui application
+ for (; ui != nullptr; ui = ui->next) {
+ // binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
+ fs::path exec_path = fs::path(context_->pkg_path()) / fs::path(ui->appid)
+ / fs::path("bin");
+ utils::CreateDir(exec_path);
+
+ exec_path /= fs::path(ui->appid);
+
+ fs::create_symlink(fs::path(WRT_LAUNCHER), exec_path, error);
+ if (error) {
+ ERR("Failed to set symbolic link "
+ << boost::system::system_error(error).what());
+ return Step::Status::ERROR;
+ }
+ }
+ for (; svc != nullptr; svc = svc->next) {
+ // binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
+ fs::path exec_path = fs::path(context_->pkg_path()) / fs::path(svc->appid)
+ / fs::path("bin");
+ utils::CreateDir(exec_path);
+
+ exec_path /= fs::path(svc->appid);
+
+ fs::create_symlink(fs::path(WRT_LAUNCHER), exec_path, error);
+ if (error) {
+ ERR("Failed to set symbolic link "
+ << boost::system::system_error(error).what());
+ return Step::Status::ERROR;
+ }
+ }
+ DBG("Successfully parse tizen manifest xml");
+
+ return Status::OK;
+}
+
+common_installer::Step::Status StepSymbolicLink::clean() {
+ return Status::OK;
+}
+
+common_installer::Step::Status StepSymbolicLink::undo() {
+ uiapplication_x* ui = context_->manifest_data()->uiapplication;
+ serviceapplication_x* svc = context_->manifest_data()->serviceapplication;
+
+ for (; ui != nullptr; ui = ui->next) {
+ fs::path exec_path = fs::path(context_->pkg_path()) / fs::path(ui->appid)
+ / fs::path("bin");
+ if (fs::exists(exec_path))
+ fs::remove_all(exec_path);
+ }
+ for (; svc != nullptr; svc = svc->next) {
+ fs::path exec_path = fs::path(context_->pkg_path()) / fs::path(svc->appid)
+ / fs::path("bin");
+ if (fs::exists(exec_path))
+ fs::remove_all(exec_path);
+ }
+ return Status::OK;
+}
+
+} // namespace symbolic_link
+} // namespace wgt
--- /dev/null
+/* 2014, Copyright © Samsung, license APACHE-2.0, see LICENSE file */
+
+#ifndef WGT_STEP_STEP_SYMBOLIC_LINK_H_
+#define WGT_STEP_STEP_SYMBOLIC_LINK_H_
+
+#include <boost/filesystem.hpp>
+
+#include "common/app_installer.h"
+#include "common/context_installer.h"
+#include "common/step/step.h"
+
+namespace wgt {
+namespace symbolic_link {
+
+class StepSymbolicLink : public common_installer::Step {
+ public:
+ using Step::Step;
+
+ Status process() override;
+ Status clean() override;
+ Status undo() override;
+};
+
+} // namespace symbolic_link
+} // namespace wgt
+
+#endif // WGT_STEP_STEP_SYMBOLIC_LINK_H_
#include "common/step/step_unregister.h"
#include "common/step/step_unzip.h"
#include "wgt/step/step_parse.h"
+#include "wgt/step/step_symbolic_link.h"
+
namespace ci = common_installer;
installer.AddStep<wgt::parse::StepParse>();
installer.AddStep<ci::signal::StepSignal>();
installer.AddStep<ci::copy::StepCopy>();
+ installer.AddStep<wgt::symbolic_link::StepSymbolicLink>();
installer.AddStep<ci::security::StepSecurity>();
installer.AddStep<ci::generate_xml::StepGenerateXml>();
installer.AddStep<ci::record::StepRecord>();