cmake . -DCMAKE_INSTALL_PREFIX=/usr \
-DDPL_LOG=ON \
- -DCMAKE_PACKAGE_VERSION=%{version} \
-DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
%{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS}
make %{?jobs:-j%jobs}
Try
{
std::string tempDir =
- Jobs::WidgetInstall::createTempPath(m_jobStruct.m_preload);
+ Jobs::WidgetInstall::createTempPath(m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_PRELOAD);
m_isDRM = isDRMWidget(widgetPath);
if (true == m_isDRM) {
m_installerContext.widgetConfig.tzAppid = update.tzAppId;
- WidgetUpdateMode::Type updateTypeCheckBit;
- updateTypeCheckBit = CalcWidgetUpdatePolicy(update.existingVersion,
- update.incomingVersion);
- // Calc proceed flag
- if ((m_jobStruct.updateMode & updateTypeCheckBit) > 0 ||
- m_jobStruct.updateMode ==
- WidgetUpdateMode::PolicyDirectoryForceInstall)
+ if (isUpperVersion(update.existingVersion, update.incomingVersion) ||
+ m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY)
{
LogInfo("Whether widget policy allow proceed ok");
return ConfigureResult::Updated;
return ConfigureResult::Failed;
}
-WidgetUpdateMode::Type JobWidgetInstall::CalcWidgetUpdatePolicy(
+bool JobWidgetInstall::isUpperVersion(
const OptionalWidgetVersion &existingVersion,
- const OptionalWidgetVersion &incomingVersion) const
+ const OptionalWidgetVersion &incomingVersion)
{
- // Widget is installed, check versions
+ LogInfo("Existing version = '" << *existingVersion);
+ LogInfo("Incoming version = '" << *incomingVersion);
+
if (!existingVersion && !incomingVersion) {
- return WidgetUpdateMode::ExistingVersionEqual;
+ return false;
} else if (!existingVersion && !!incomingVersion) {
- return WidgetUpdateMode::ExistingVersionNewer;
+ return false;
} else if (!!existingVersion && !incomingVersion) {
- return WidgetUpdateMode::ExistingVersionOlder;
+ return true;
} else {
- LogInfo("Existing widget: version = '" << *existingVersion << "'");
-
- if (!existingVersion->IsWac() && !incomingVersion->IsWac()) {
- return WidgetUpdateMode::BothVersionsNotStd;
- } else if (!existingVersion->IsWac()) {
- return WidgetUpdateMode::ExistingVersionNotStd;
- } else if (!incomingVersion->IsWac()) {
- return WidgetUpdateMode::IncomingVersionNotStd;
+ if (!existingVersion->IsWac() || !incomingVersion->IsWac()) {
+ return false;
} else {
- // Both versions are WAC-comparable. Do compare.
if (*incomingVersion == *existingVersion) {
- return WidgetUpdateMode::ExistingVersionEqual;
+ return false;
} else if (*incomingVersion > *existingVersion) {
- return WidgetUpdateMode::ExistingVersionOlder;
+ return true;
} else {
- return WidgetUpdateMode::ExistingVersionNewer;
+ return false;
}
}
}
const std::string &tempPath)
{
// Check installation type (direcotory/ or config.xml or widget.wgt)
- if (WidgetUpdateMode::PolicyDirectoryForceInstall ==
- m_jobStruct.updateMode)
+ if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY)
{
LogDebug("Install directly from directory");
return PKG_TYPE_DIRECTORY_WEB_APP;
{
m_installerContext.locationType = INSTALL_LOCATION_TYPE_NOMAL;
- if (true == m_jobStruct.m_preload) {
+ if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_PRELOAD) {
m_installerContext.locationType =
INSTALL_LOCATION_TYPE_PRELOAD;
} else {
static WidgetUpdateInfo detectWidgetUpdate(
const WrtDB::ConfigParserData &configInfo,
const WrtDB::TizenAppId &tizenId);
- WidgetUpdateMode::Type CalcWidgetUpdatePolicy(
+ bool isUpperVersion(
const OptionalWidgetVersion &existingVersion,
- const OptionalWidgetVersion &incomingVersion) const;
+ const OptionalWidgetVersion &incomingVersion);
void setTizenId(const WrtDB::ConfigParserData &configInfo);
void displayWidgetInfo();
void configureWidgetLocation(const std::string & widgetPath,
//TODO make directory like jobs common?
std::string createTempPath(bool preload = false);
-std::string createTempPath(bool preload);
-
void createTempPath(const std::string& path);
} // WidgetInstall
} // Jobs
ProgressPercent percent,
const ProgressDescription &);
-namespace WidgetUpdateMode {
+namespace InstallMode {
enum Type
{
- Zero = 0,
-
- // Bits
- NotInstalled = 1 << 0,
- IncomingVersionNotStd = 1 << 1,
- ExistingVersionNotStd = 1 << 2,
- BothVersionsNotStd = 1 << 3,
- ExistingVersionOlder = 1 << 4,
- ExistingVersionEqual = 1 << 5,
- ExistingVersionNewer = 1 << 6,
-
- // Policies
- PolicyNeverUpdate = NotInstalled,
-
- PolicyWac = NotInstalled |
- ExistingVersionOlder,
-
- PolicyAlwaysInstall = NotInstalled |
- IncomingVersionNotStd |
- ExistingVersionNotStd |
- BothVersionsNotStd |
- ExistingVersionOlder |
- ExistingVersionEqual |
- ExistingVersionNewer,
-
- PolicyForceInstall = PolicyAlwaysInstall,
- PolicyDirectoryForceInstall
+ INSTALL_MODE_WGT = 0,
+ INSTALL_MODE_DIRECTORY,
+ INSTALL_MODE_PRELOAD,
};
-
-inline Type operator | (const Type &a,
- const Type &b)
-{
- return static_cast<Type>(static_cast<unsigned long>(a) |
- static_cast<unsigned long>(b));
-}
-
-inline Type operator & (const Type &a,
- const Type &b)
-{
- return static_cast<Type>(static_cast<unsigned long>(a) &
- static_cast<unsigned long>(b));
-}
}
//TODO into namespace
//Widget Installation Struct
struct WidgetInstallationStruct : public WidgetInstallCallbackBase
{
- WidgetUpdateMode::Type updateMode;
+ InstallMode::Type m_installMode;
bool m_quiet;
- bool m_preload;
std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrInterface;
// It must be empty-constructible as a parameter of generic event
- WidgetInstallationStruct() : updateMode(WidgetUpdateMode::Zero),
- m_quiet(true),
- m_preload(false)
+ WidgetInstallationStruct() :
+ m_installMode(InstallMode::Type::INSTALL_MODE_WGT),
+ m_quiet(true)
{}
WidgetInstallationStruct(
InstallerFinishedCallback finished,
InstallerProgressCallback progress,
void *param,
- WidgetUpdateMode::Type mode,
+ InstallMode::Type mode,
bool quiet,
- bool preload,
std::shared_ptr<PackageManager::IPkgmgrSignal>
_pkgmgrInterface
) :
WidgetInstallCallbackBase(finished, progress, param),
- updateMode(mode),
+ m_installMode(mode),
m_quiet(quiet),
- m_preload(preload),
pkgmgrInterface(_pkgmgrInterface)
{}
};
void InstallerLogic::InstallSingleDeferredPackage()
{
LogWarning("Not implemented");
- // if (m_packagesToInstall.empty())
- // return;
- //
- // // Take single package
- // DPL::String widgetPackage = m_packagesToInstall.front();
- // m_packagesToInstall.pop_front();
- //
- // // Remove it from DB
- // GlobalDAO::RemoveDefferedWidgetPackageInstallation(widgetPackage);
- //
- // // Begin installation
- // LogInfo("Installing deferred widget package: " << widgetPackage);
- //
- // // Post installation
- // CONTROLLER_POST_EVENT(
- // InstallerController,
- // InstallerControllerEvents::InstallWidgetEvent(
- // DPL::ToUTF8String(widgetPackage).c_str(),
- // WidgetInstallationStruct(
- // &DummyInstallCallback, &DummyProgressCallback, NULL,
- // WidgetUpdateMode::PolicyWac)));
}
void InstallerLogic::InstallWaitingPlugins()
)
SET(WRT_INSTALLER_SOURCES
- ${WRT_INSTALLER_DIR}/wrt_installer.cpp
+ ${WRT_INSTALLER_DIR}/wrt-installer.cpp
${WRT_INSTALLER_DIR}/wrt_installer_api.cpp
${WRT_INSTALLER_DIR}/installer_callbacks_translate.cpp
${WRT_INSTALLER_DIR}/plugin_utils.cpp
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/* @file wrt_installer.cpp
+/* @file wrt-installer.cpp
* @version 1.0
* @brief Implementation file for installer
*/
-#include "wrt_installer.h"
+#include "wrt-installer.h"
#include "plugin_utils.h"
-#include <cstdlib>
#include <string>
-#include <fstream>
-#include <unistd.h>
-#include <memory>
+#include <cstring>
+#include <cstdlib>
+#include <dirent.h>
#include <sys/resource.h>
+
+#include <dpl/log/log.h>
#include <dpl/optional.h>
-#include <dpl/scoped_free.h>
#include <dpl/optional_typedefs.h>
#include <dpl/exception.h>
-#include <dpl/sstream.h>
-#include <vconf.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/wrt-dao-ro/config_parser_data.h>
-#include <dpl/localization/localization_utils.h>
-#include <dpl/optional_typedefs.h>
#include <dpl/string.h>
#include <dpl/abstract_waitable_input_adapter.h>
#include <dpl/abstract_waitable_output_adapter.h>
#include <dpl/copy.h>
#include <dpl/errno_string.h>
#include <dpl/utils/wrt_global_settings.h>
-#include "option_parser.h"
#include <parser_runner.h>
#include <widget_parser.h>
#include <root_parser.h>
-#define NOFILE_CNT_FOR_INSTALLER 9999
+#include <Elementary.h>
+
+#include <pkg-manager/pkgmgr_signal_interface.h>
+#include <pkg-manager/pkgmgr_signal_dummy.h>
+#include <pkg-manager/pkgmgr_signal.h>
using namespace WrtDB;
namespace { // anonymous
-const char AUL_ARG_KEY[] = "widget_arg";
const char * const PKGMGR_INSTALL_MSG = "Install widget";
const char * const PKGMGR_UNINSTALL_MSG = "Uninstall widget";
-const double BASE_LAYOUT_W = 720.0f;
-const double BASE_LAYOUT_H = 1280.0f;
-
const char * const CONFIG_XML = "config.xml";
const char * const HYBRID_CONFIG_XML = "res/wgt/config.xml";
+const unsigned int NOFILE_CNT_FOR_INSTALLER = 9999;
+
struct free_deleter
{
void operator()(void* x)
WrtInstaller::WrtInstaller(int argc, char **argv) :
Application(argc, argv, "backend", false),
DPL::TaskDecl<WrtInstaller>(this),
- m_installPolicy(WRT_WIM_NOT_INSTALLED),
+ m_installMode(WRT_INSTALL_MODE_UNKNOWN),
m_packagePath(),
- m_handle(-1),
m_initialized(false),
m_numPluginsToInstall(0),
m_totalPlugins(0),
m_installByPkgmgr(false),
m_quiet(true),
m_popup(NULL),
- m_startupPluginInstallation(false),
- m_preloadWidget(false)
+ m_startupPluginInstallation(false)
{
Touch();
LogDebug("App Created");
LogDebug("App Finished");
}
+int WrtInstaller::getReturnStatus() const
+{
+ if (!m_returnStatus) {
+ return RE_SUCCESS;
+ } else {
+ return RE_FAIL;
+ }
+}
+
+WrtInstaller::InstallerPopup::InstallerPopup() :
+ m_win(NULL),
+ m_popup(NULL),
+ m_progressbar(NULL)
+{}
+
+WrtInstaller::InstallerPopup::~InstallerPopup()
+{
+ LogDebug("App Finished");
+}
+
+void WrtInstaller::InstallerPopup::init()
+{
+ LogDebug("Window Init");
+
+ if (m_win == NULL) {
+ // create window
+ m_win = createWin("wrt-installer");
+
+ // create popup
+ m_popup = elm_popup_add(m_win);
+
+ // create progressbar
+ m_progressbar = elm_progressbar_add(m_popup);
+ elm_object_style_set(m_progressbar, "list_progress");
+ elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
+ evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_object_content_set(m_popup, m_progressbar);
+ elm_progressbar_value_set(m_progressbar, 0.0);
+ evas_object_show(m_progressbar);
+
+ evas_object_show(m_popup);
+ evas_object_show(m_win);
+ }
+}
+
+Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name)
+{
+ Evas_Object *win;
+ win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
+
+ int w, h;
+ if (!win) {
+ return NULL;
+ }
+
+ elm_win_alpha_set(win, EINA_TRUE);
+ elm_win_title_set(win, name);
+ elm_win_borderless_set(win, EINA_TRUE);
+ elm_win_raise(win);
+
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(win, w, h);
+ return win;
+}
+
+void WrtInstaller::InstallerPopup::showPopup(void* userdata,
+ const DPL::String& pkgMsg,
+ ShowResultCallback callback)
+{
+ Evas_Object *btn;
+
+ LogDebug("Result Popup Created");
+ evas_object_del(m_popup);
+ m_popup = NULL;
+
+ m_popup = elm_popup_add(m_win);
+ if (!m_popup) {
+ return;
+ }
+
+ btn = elm_button_add(m_popup);
+ if (!btn) {
+ evas_object_del(m_popup);
+ return;
+ }
+ elm_object_text_set(btn, "OK");
+ evas_object_smart_callback_add(btn, "clicked", callback, userdata);
+ elm_object_part_content_set(m_popup, "button1", btn);
+ elm_object_part_text_set(m_popup, "title,text", "RESULT");
+ elm_object_text_set(m_popup, DPL::ToUTF8String(pkgMsg).c_str());
+
+ evas_object_show(m_popup);
+ evas_object_show(m_win);
+}
+
void WrtInstaller::OnStop()
{
LogInfo("Stopping Dummy Client");
struct stat info;
if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) {
LogInfo("Installing package directly from directory");
- m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_DIRECTORY;
} else {
LogInfo("Installing from regular location");
- m_installPolicy = WRT_WIM_POLICY_WAC;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_WGT;
}
m_packagePath = m_argv[2];
AddStep(&WrtInstaller::installStep);
- } else if (arg == "-if" || arg == "--install-force") {
- if (m_argc != 3) {
- return showHelpAndQuit();
- }
-
- m_packagePath = m_argv[2];
- m_installPolicy = WRT_WIM_POLICY_FORCE_INSTALL;
- AddStep(&WrtInstaller::installStep);
} else if (arg == "-il" || arg == "--install-preload") {
if (m_argc != 3) {
return showHelpAndQuit();
}
-
m_packagePath = m_argv[2];
- m_preloadWidget = true;
- m_installPolicy = WRT_WIM_POLICY_WAC;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_PRELOAD;
AddStep(&WrtInstaller::installStep);
} else if (arg == "-un" || arg == "--uninstall-name") {
if (m_argc != 3) {
struct stat info;
if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
LogInfo("Installing package directly from directory");
- m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_DIRECTORY;
} else {
LogInfo("Installing from regular location");
- m_installPolicy = WRT_WIM_POLICY_WAC;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_WGT;
}
AddStep(&WrtInstaller::installStep);
break;
WRTInstallerNS::NextStepEvent());
}
-void WrtInstaller::OnReset(bundle *b)
+void WrtInstaller::OnReset(bundle* /*b*/)
{
- const char * bundledVal = bundle_get_val(b, AUL_ARG_KEY);
- if (bundledVal != NULL) {
- m_bundleValue = bundledVal;
- LogInfo("Bundled value for (" << AUL_ARG_KEY << ") key received: " <<
- m_bundleValue);
- }
-}
-
-int WrtInstaller::getReturnStatus() const
-{
- if (!m_returnStatus) {
- return RE_SUCCESS;
- } else {
- return RE_FAIL;
- }
+ LogDebug("OnReset");
}
void WrtInstaller::OnTerminate()
" -p, --install-plugins install plugins\n"
" -i, --install "
"install or update widget package for given path\n"
- " -if, --install-force "
- "install forcibly widget package for given path\n"
" -un, --uninstall-name "
"uninstall widget for given package name\n"
" -up, --uninstall-packagepath "
this, &staticWrtStatusCallback,
(!m_quiet || m_installByPkgmgr)
? &staticWrtInstallProgressCallback : NULL,
- m_installPolicy,
+ m_installMode,
m_quiet,
- m_preloadWidget,
pkgmgrSignalInterface);
}
}
}
-WrtInstaller::InstallerPopup::InstallerPopup() :
- m_win(NULL),
- m_popup(NULL),
- m_progressbar(NULL)
-{}
-
-WrtInstaller::InstallerPopup::~InstallerPopup()
-{
- LogDebug("App Finished");
-}
-
-void WrtInstaller::InstallerPopup::init()
-{
- LogDebug("Window Init");
-
- if (m_win == NULL) {
- // create window
- m_win = createWin("wrt-installer");
-
- // create popup
- m_popup = elm_popup_add(m_win);
-
- // create progressbar
- m_progressbar = elm_progressbar_add(m_popup);
- elm_object_style_set(m_progressbar, "list_progress");
- elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
- evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- elm_object_content_set(m_popup, m_progressbar);
- elm_progressbar_value_set(m_progressbar, 0.0);
- evas_object_show(m_progressbar);
-
- evas_object_show(m_popup);
- evas_object_show(m_win);
- }
-}
-
-Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name)
-{
- Evas_Object *win;
- win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
-
- int w, h;
- if (!win) {
- return NULL;
- }
-
- elm_win_alpha_set(win, EINA_TRUE);
- elm_win_title_set(win, name);
- elm_win_borderless_set(win, EINA_TRUE);
- elm_win_raise(win);
-
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
- evas_object_resize(win, w, h);
- return win;
-}
-
-void WrtInstaller::InstallerPopup::showPopup(void* userdata,
- const DPL::String& pkgMsg,
- ShowResultCallback callback)
-{
- Evas_Object *btn;
-
- LogDebug("Result Popup Created");
- evas_object_del(m_popup);
- m_popup = NULL;
-
- m_popup = elm_popup_add(m_win);
- if (!m_popup) {
- return;
- }
-
- btn = elm_button_add(m_popup);
- if (!btn) {
- evas_object_del(m_popup);
- return;
- }
- elm_object_text_set(btn, "OK");
- evas_object_smart_callback_add(btn, "clicked", callback, userdata);
- elm_object_part_content_set(m_popup, "button1", btn);
- elm_object_part_text_set(m_popup, "title,text", "RESULT");
- elm_object_text_set(m_popup, DPL::ToUTF8String(pkgMsg).c_str());
-
- evas_object_show(m_popup);
- evas_object_show(m_win);
-}
-
void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/,
void* /*event_info*/)
{
* limitations under the License.
*/
/**
- * @file wrt_installer.h
+ * @file wrt-installer.h
* @version 1.0
* @brief Implementation file for installer
*/
-#ifndef WRT_CLIENT_H
-#define WRT_CLIENT_H
+#ifndef WRT_INSTALLER_H
+#define WRT_INSTALLER_H
#include <dpl/application.h>
#include <dpl/generic_event.h>
#include <dpl/event/controller.h>
-#include <dpl/type_list.h>
#include <dpl/task.h>
-#include <dpl/log/log.h>
#include <dpl/string.h>
#include <string>
-#include <utilX.h>
#include <wrt_installer_api.h>
-#include <pkg-manager/pkgmgr_signal_interface.h>
-#include <pkg-manager/pkgmgr_signal_dummy.h>
-#include <pkg-manager/pkgmgr_signal.h>
-#include <memory>
-
namespace WRTInstallerNS { //anonymous
DECLARE_GENERIC_EVENT_0(QuitEvent)
DECLARE_GENERIC_EVENT_0(NextStepEvent)
// Installation steps
void initStep();
void installStep();
- void installNewPlugins();
void installPluginsStep();
void uninstallPkgNameStep();
void unistallWgtFileStep();
void shutdownStep();
- void registerCallbackStep();
- void queryListStep();
// Static callbacks
static void staticWrtInitCallback(WrtErrStatus status,
static void failResultCallback(void *data, Evas_Object *obj,
void *event_info);
+ void installNewPlugins();
bool popupsEnabled() const;
// Private data
std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrSignalInterface;
- wrt_widget_install_mode_e m_installPolicy;
- std::string m_bundleValue;
+ WrtInstallMode m_installMode;
std::string m_packagePath;
- int m_handle;
std::string m_name;
bool m_initialized;
size_t m_numPluginsToInstall;
bool m_quiet;
InstallerPopup *m_popup;
bool m_startupPluginInstallation;
- std::string m_webAppConfig;
- std::string m_webAppIcon;
- bool m_preloadWidget;
typedef std::list<std::string> PluginPathList;
DPL::Optional<PluginPathList> m_pluginsPaths;
};
-#endif // WRT_CLIENT_H
+#endif // WRT_INSTALLER_H
\ No newline at end of file
using namespace WrtDB;
-#undef TRUE
-#undef FALSE
-#define TRUE 0
-#define FALSE -1
-
#ifdef __cplusplus
#define EXPORT_API __attribute__((visibility("default")))
extern "C"
{
#endif
-inline WidgetUpdateMode::Type translateWidgetUpdateMode(
- wrt_widget_update_mode_t updateMode)
+inline InstallMode::Type translateInstallMode(
+ WrtInstallMode installMode)
{
- if (updateMode == WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL) {
- return WidgetUpdateMode::PolicyDirectoryForceInstall;
- }
-
- WidgetUpdateMode::Type result = WidgetUpdateMode::Zero;
- if (updateMode & WRT_WIM_NOT_INSTALLED) {
- result = result | WidgetUpdateMode::NotInstalled;
- }
-
- if (updateMode & WRT_WIM_INCOMING_VERSION_NOT_STD) {
- result = result | WidgetUpdateMode::IncomingVersionNotStd;
- }
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_NOT_STD) {
- result = result | WidgetUpdateMode::ExistingVersionNotStd;
- }
-
- if (updateMode & WRT_WIM_BOTH_VERSIONS_NOT_STD) {
- result = result | WidgetUpdateMode::BothVersionsNotStd;
- }
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_OLDER) {
- result = result | WidgetUpdateMode::ExistingVersionOlder;
- }
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_EQUAL) {
- result = result | WidgetUpdateMode::ExistingVersionEqual;
- }
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_NEWER) {
- result = result | WidgetUpdateMode::ExistingVersionNewer;
+ if (WRT_INSTALL_MODE_INSTALL_WGT == installMode) {
+ return InstallMode::INSTALL_MODE_WGT;
+ } else if (WRT_INSTALL_MODE_INSTALL_DIRECTORY == installMode) {
+ return InstallMode::INSTALL_MODE_DIRECTORY;
+ } else if (WRT_INSTALL_MODE_INSTALL_PRELOAD == installMode) {
+ return InstallMode::INSTALL_MODE_PRELOAD;
}
-
- return result;
+ Assert(true && "wrong argument is inputed");
}
const char PLUGIN_INSTALL_SEMAPHORE[] = "/.wrt_plugin_install_lock";
", Description : " << description);
}
-EXPORT_API int wrt_installer_init(void *userdata,
+EXPORT_API void wrt_installer_init(void *userdata,
WrtInstallerInitCallback callback)
{
// Set DPL/LOG MID
if (callback) {
callback(WRT_INSTALLER_ERROR_FATAL_ERROR, userdata);
}
- return TRUE;
+ return;
}
// Initialize ValidationCore - this must be done before AttachDatabases
InstallerMainThreadSingleton::Instance().AttachDatabases();
- //checking for correct DB version
- // if (!WrtDB::WrtDatabase::CheckTableExist(DB_CHECKSUM_STR))
- // {
- // LogError("WRONG VERSION OF WRT DATABASE");
- // Assert(false && "WRONG VERSION OF WRT DATABASE");
- // return FALSE;
- // }
- LogWarning("Database check not implemented!");
-
LogInfo("Prepare libxml2 to work in multithreaded program.");
xmlInitParser();
DPL::Exception::DisplayKnownException(ex);
if (callback) {
callback(WRT_INSTALLER_ERROR_FATAL_ERROR, userdata);
+ return;
}
- return FALSE;
}
- // OK
- return TRUE;
+ return;
}
EXPORT_API void wrt_installer_shutdown()
void* userdata,
WrtInstallerStatusCallback status_cb,
WrtProgressCallback progress_cb,
- wrt_widget_update_mode_t update_mode,
+ WrtInstallMode installMode,
bool quiet,
- bool preload,
std::shared_ptr<PackageManager::
IPkgmgrSignal> pkgmgrInterface
)
InstallerCallbacksTranslate::installProgressCallback,
new InstallerCallbacksTranslate::StatusCallbackStruct(
userdata, status_cb, progress_cb),
- translateWidgetUpdateMode(update_mode),
+ translateInstallMode(installMode),
quiet,
- preload,
pkgmgrInterface)));
}
UNHANDLED_EXCEPTION_HANDLER_END
UNHANDLED_EXCEPTION_HANDLER_END
}
-EXPORT_API int wrt_installer_init_for_tests(void *userdata,
- WrtInstallerInitCallback callback)
-{
- // Set DPL/LOG MID
- DPL::Log::LogSystemSingleton::Instance().SetTag("WRT");
-
- try {
- LogInfo("[WRT-API] INITIALIZING WRT INSTALLER...");
- LogInfo("[WRT-API] BUILD: " << __TIMESTAMP__);
-
- // Touch InstallerController Singleton
- InstallerMainThreadSingleton::Instance().
- TouchArchitectureOnlyInstaller();
-
- // Check paths
- if (!checkPaths()) {
- if (callback) {
- callback(WRT_INSTALLER_ERROR_FATAL_ERROR, userdata);
- }
- return TRUE;
- }
-
- CONTROLLER_POST_SYNC_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::
- InitializeEvent());
-
- if (callback) {
- LogInfo("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK");
- callback(WRT_SUCCESS, userdata);
- }
- } catch (const DPL::Exception& ex) {
- LogError("Internal Error during Init:");
- DPL::Exception::DisplayKnownException(ex);
- if (callback) {
- callback(WRT_INSTALLER_ERROR_FATAL_ERROR, userdata);
- }
- return FALSE;
- }
-
- // OK
- return TRUE;
-}
-
-EXPORT_API void wrt_installer_shutdown_for_tests()
-{
- try {
- LogInfo("[WRT-API] DEINITIALIZING WRT INSTALLER...");
-
- // Installer termination
- CONTROLLER_POST_SYNC_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::
- TerminateEvent());
-
- // Global deinit check
- LogInfo("Cleanup libxml2 global values.");
- xmlCleanupParser();
- } catch (const DPL::Exception& ex) {
- LogError("Internal Error during Shutdown:");
- DPL::Exception::DisplayKnownException(ex);
- }
-}
-
-EXPORT_API WrtErrStatus wrt_get_widget_by_guid(std::string & tzAppid,
- const std::string & guid)
-{
- try {
- LogInfo("[WRT-API] GETTING WIDGET PACKAGE NAME BY WidgetID : "
- << guid);
-
- WidgetGUID widget_guid = DPL::FromUTF8String(guid);
- WrtDB::WidgetDAOReadOnly dao(widget_guid);
- tzAppid = DPL::ToUTF8String(dao.getTzAppId());
- return WRT_SUCCESS;
- } catch (WidgetDAOReadOnly::Exception::WidgetNotExist&) {
- LogError("Error package name is not found");
- return WRT_INSTALLER_ERROR_FATAL_ERROR;
- } catch (const DPL::Exception& ex) {
- LogError("Internal Error during get widget id by package name");
- DPL::Exception::DisplayKnownException(ex);
- return WRT_INSTALLER_ERROR_FATAL_ERROR;
- }
-}
#ifdef __cplusplus
}
#endif
* @brief This file contains declarations of wrt_installer_api
*/
-/*
- * @defgroup wrt_engine_group WebRunTime engine Library
- * @ingroup internet_FW
- * Functions to APIs to access wrt-engine
- */
-
#ifndef WRT_INSTALLER_API_H_
#define WRT_INSTALLER_API_H_
extern "C" {
#endif
-/**
- * Callback function type invoked after async init function
- */
typedef void (*WrtInstallerInitCallback)(WrtErrStatus status,
void *data);
-
-/**
- * Callback function type invoked after async functions
- */
typedef void (*WrtPluginInstallerStatusCallback)(WrtErrStatus status,
void *data);
-
-/**
- * Callback function type invoked after async functions
- */
typedef void (*WrtInstallerStatusCallback)(std::string tizenId,
WrtErrStatus status,
void *data);
-
-/**
- * Callback function type invoked after async functions
- */
typedef void (*WrtProgressCallback)(float percent,
const char *description,
void *data);
-
-/**
- * Callback function type invoked when all plugin installations are finished
- */
typedef void (*WrtAllPluginInstalledCallback)(void *userdata);
typedef struct
void *user_data;
} wrt_plugin_data;
-/**
- * @fn int wrt_installer_init(void *userdata, WrtInstallerInitCallback callback)
- * @brief Initializes WRT
- *
- * This method is used to initialize wrt-engine.
- * It connects to database, initializes webkit, widget and plugin logic.
- *
- * @param [in] userdata - User parameters to be passed to the callback
- * @param [in] callback - The callback function that is launched, after
- * wrt initialization.
- * The callback is called in the context of the
- * application's main loop.
- *
- * @return 0 on success, -1 on failure
- *
- * Sample code:
- * @code
- * int main (int argc, char *argv[])
- * {
- * init_loop(argc, argv);
- * printf("Initializing WRT");
- * wrt_init(NULL, &init_cb);
- *
- * wait_for_wrt_init();
- * printf("Starting tests");
- *
- * int status = DPL_TestRunnerSingleton_Instance().ExecTestRunner(argc,
- * argv);
- *
- * wrt_installer_shutdown();
- * quit_loop();
- * return status;
- * }
- * @endcode
- *
- * @see wrt_installer_shutdown
- */
-typedef enum wrt_widget_install_mode_e
+enum WrtInstallMode
{
- /**
- * Raw install bit flags
- */
- WRT_WIM_NOT_INSTALLED = (1 << 0),
- WRT_WIM_INCOMING_VERSION_NOT_STD = (1 << 1),
- WRT_WIM_EXISTING_VERSION_NOT_STD = (1 << 2),
- WRT_WIM_BOTH_VERSIONS_NOT_STD = (1 << 3),
- WRT_WIM_EXISTING_VERSION_OLDER = (1 << 4),
- WRT_WIM_EXISTING_VERSION_EQUAL = (1 << 5),
- WRT_WIM_EXISTING_VERSION_NEWER = (1 << 6),
-
- /**
- * Update default policies
- */
-
- /* Never update policy
- */
- WRT_WIM_POLICY_NEVER_UPDATE = WRT_WIM_NOT_INSTALLED,
-
- /* WAC update policy
- */
- WRT_WIM_POLICY_WAC = WRT_WIM_NOT_INSTALLED |
- WRT_WIM_EXISTING_VERSION_OLDER,
-
- /* Always update policy
- */
- WRT_WIM_POLICY_ALWAYS_INSTALL = WRT_WIM_NOT_INSTALLED |
- WRT_WIM_INCOMING_VERSION_NOT_STD |
- WRT_WIM_EXISTING_VERSION_NOT_STD |
- WRT_WIM_BOTH_VERSIONS_NOT_STD |
- WRT_WIM_EXISTING_VERSION_OLDER |
- WRT_WIM_EXISTING_VERSION_EQUAL |
- WRT_WIM_EXISTING_VERSION_NEWER,
-
- /* Force install policy
- */
- WRT_WIM_POLICY_FORCE_INSTALL = WRT_WIM_POLICY_ALWAYS_INSTALL,
- /* Installation from directory - forced update
- */
- WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL
-} wrt_widget_update_mode_t;
-
-int wrt_installer_init(void *userdata,
- WrtInstallerInitCallback callback);
-
-/**
- * @fn void wrt_installer_shutdown(void)
- * @brief Deinitializes WRT
- *
- * This method is used to deinitialize wrt-engine.
- * It deinitializes widget logic, plugin logic, shuts down connection to
- * database, switchs back to single thread and does deinit checks.
- *
- * @return nothing
- *
- * Sample code:
- * @code
- * int main (int argc, char *argv[])
- * {
- * init_loop(argc, argv);
- * printf("Initializing WRT");
- * wrt_init(NULL, &init_cb);
- *
- * wait_for_wrt_init();
- * printf("Starting tests");
- *
- * int status = DPL_TestRunnerSingleton_Instance().ExecTestRunner(argc,
- * argv);
- *
- * wrt_installer_shutdown();
- * quit_loop();
- * return status;
- * }
- * @endcode
- *
- * @see wrt_init
- */
+ WRT_INSTALL_MODE_UNKNOWN = 0,
+ WRT_INSTALL_MODE_INSTALL_WGT,
+ WRT_INSTALL_MODE_INSTALL_DIRECTORY,
+ WRT_INSTALL_MODE_INSTALL_PRELOAD
+};
+
+void wrt_installer_init(
+ void *userdata,
+ WrtInstallerInitCallback callback);
void wrt_installer_shutdown(void);
-
-/**
- * @fn void wrt_install_widget(const char *widget_package_path,
- * void *user_parameter,
- * WrtInstallerStatusCallback status_callback,
- * WrtProgressCallback progress_callback,
- * wrt_widget_update_mode_t update_mode,
- * bool quiet,
- * bool preload);
- *
- * @brief Installs widget from given path
- *
- * This method is used to install widget from a given path.
- *
- * @param [in] widget_package_path Path of the widget package.
- * @param [in] user_parameter User parameters to be passed to the callback
- * @param [in] status_cb Call to this one will be done at the end of
- * operation
- * The callback is called in the context of the
- * application's
- * @param [in] progress_cb Callback function to get data of install
- * progress
- * If you don't want to get progress data, this
- * should be NULL
- * @param [in] install_mode Installation mode
- * @param [in] quiet quiet mode
- * @param [in] preload preload widget install
- * @return Nothing (status returned in callback).
- *
- * Sample code:
- * @code
- * wrt_install_widget(path.c_str(),
- * NULL,
- * install_cb,
- * progress_cb,
- * WRT_WIM_POLICY_WAC,
- * false,
- * false);
- * @endcode
- *
- * @see wrt_installer_uninstall_widget
- */
void wrt_install_widget(
const char *path,
void *user_parameter,
WrtInstallerStatusCallback status_callback,
WrtProgressCallback progress_callback,
- wrt_widget_update_mode_t update_mode,
+ WrtInstallMode install_mode,
bool quiet,
- bool preload,
std::shared_ptr<PackageManager::IPkgmgrSignal>
pkgmgrInterface
);
-
-/**
- * @fn void wrt_installer_uninstall_widget (const char * const tizenAppid,
- * void* userdata,
- * WrtInstallerStatusCallback cb)
- * @brief Uninstalls widget using its name
- *
- * This method is used to uninstall the widget specified by its appid.
- * The callback function is called when the uninstall operation is done.
- *
- * @param [in] tzAppid - tizen appid
- * @param [in] userdata - user parameters to be passed to the callback
- * @param [in] status_cb - Call to this one will be done at the end of
- * operation
- * The callback is called in the context of the
- * application's
- * @param [in] progress_cb - Callback function to get data of install progress
- * If you don't want to get progress data, this
- * should be NULL
- *
- * @return nothing (status returned in callback).
- *
- * Sample code:
- * @code //TODO SAMPLE
- * wrt_installer_uninstall_widget( appId, NULL, uninstall_cb, progress_cb);
- * @endcode
- *
- * @see wrt_installer_install_widget
- */
void wrt_uninstall_widget (
const char * const tzAppid,
void* userdata,
WrtProgressCallback progress_cb,
std::shared_ptr<PackageManager::IPkgmgrSignal>
pkgmgrSignalInterface);
-
-/**
- * @fn void wrt_install_plugin(const char *pluginDirectory,
- * void *userData,
- * WrtInstallerStatusCallback statusCallback,
- * WrtProgressCallback progressCallback)
- *
- * @brief Installs plugin from given path
- *
- * This method installs new plugin from specified location and calls a callback
- * function when the operation is done.
- *
- * @param [in] pluginDirectory - plugin directory
- * @param [in] userData - user parameters to be passed to the callback
- * @param [in] statusCallback - user callback to call after installation
- * @param [in] progressCallback - user callback to call when plugin
- * installation progress has changed
- *
- * @return nothing (status returned in callback).
- *
- * Sample code:
- * @code
- * wrt_install_plugin("/usr/lib/wrt-plugins/",NULL,NULL,NULL);
- * @endcode
- *
- * @see wrt_install_plugin
- */
void wrt_install_plugin(const char *pluginDirectory,
void *userData,
WrtPluginInstallerStatusCallback statusCallback,
WrtProgressCallback progressCallback);
-
-/**
- * @brief To install plugins for first excution
- *
- * This method install plugins
- *
- * @return nothing
- */
void wrt_install_all_plugins(WrtAllPluginInstalledCallback installed_cb,
void *user_param);
-/**
- * @brief To initialize for tests
- *
- * This method is wrt init for tests
- *
- * @return int
- */
-int wrt_installer_init_for_tests(void *userdata,
- WrtInstallerInitCallback callback);
-
-/**
- * @brief To shutdown for tests
- *
- * This method is wrt shutdown for tests
- *
- * @return int
- */
-void wrt_installer_shutdown_for_tests();
-
-/**
- * @brief wrt_get_widget_by_guid Returns tizenAppid by pkg guid (widgetId)
- * @param tzAppid tizen appid argument ot be set
- * @param guid guid that we look for
- * @return error code
- */
-WrtErrStatus wrt_get_widget_by_guid(std::string &tzAppid,
- const std::string &guid);
#ifdef __cplusplus
}
#endif