[Release] wrt-installer_0.1.110 submit/tizen_2.2/20130730.071200
authorsung-su.kim <sung-su.kim@samsung.com>
Thu, 25 Jul 2013 23:37:12 +0000 (08:37 +0900)
committersung-su.kim <sung-su.kim@samsung.com>
Fri, 26 Jul 2013 08:22:20 +0000 (17:22 +0900)
Change-Id: Ibf32fd853a84d787d7aac7becdf3f15a57cbab2b

53 files changed:
CMakeLists.txt
configuration/widgets.tizen.xsd
packaging/wrt-installer.spec
src/CMakeLists.txt
src/configuration_parser/widget_parser.cpp
src/jobs/plugin_install/job_plugin_install.cpp
src/jobs/plugin_install/plugin_install_task.cpp
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/manifest.cpp
src/jobs/widget_install/manifest.h
src/jobs/widget_install/task_ace_check.cpp
src/jobs/widget_install/task_certificates.cpp
src/jobs/widget_install/task_certify.cpp
src/jobs/widget_install/task_certify_level.cpp [new file with mode: 0644]
src/jobs/widget_install/task_certify_level.h [new file with mode: 0644]
src/jobs/widget_install/task_commons.cpp
src/jobs/widget_install/task_database.cpp
src/jobs/widget_install/task_file_manipulation.cpp
src/jobs/widget_install/task_install_ospsvc.cpp
src/jobs/widget_install/task_manifest_file.cpp [changed mode: 0755->0644]
src/jobs/widget_install/task_prepare_reinstall.cpp
src/jobs/widget_install/task_recovery.cpp
src/jobs/widget_install/task_smack.cpp
src/jobs/widget_install/task_widget_config.cpp
src/jobs/widget_install/task_widget_config.h
src/jobs/widget_install/widget_install_context.h
src/jobs/widget_install/widget_install_errors.h
src/jobs/widget_install/widget_security.cpp [moved from src/jobs/widget_install/wac_security.cpp with 92% similarity]
src/jobs/widget_install/widget_security.h [moved from src/jobs/widget_install/wac_security.h with 92% similarity]
src/jobs/widget_install/widget_unzip.cpp
src/jobs/widget_uninstall/job_widget_uninstall.cpp
src/jobs/widget_uninstall/task_check.cpp
src/jobs/widget_uninstall/task_db_update.cpp
src/jobs/widget_uninstall/task_remove_files.cpp
src/jobs/widget_uninstall/task_smack.cpp
src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp
src/logic/installer_logic.cpp
src/misc/feature_logic.cpp
src/pkg-manager/backendlib.cpp
src/pkg-manager/pkgmgr_signal.cpp
src/pkg-manager/pkgmgr_signal.h
src/pkg-manager/pkgmgr_signal_dummy.h
src/pkg-manager/pkgmgr_signal_interface.h
src/wrt-installer/CMakeLists.txt
src/wrt-installer/installer_callbacks_translate.cpp
src/wrt-installer/language_subtag_rst_tree.cpp
src/wrt-installer/plugin_utils.cpp
src/wrt-installer/wrt-installer.cpp
src/wrt-installer/wrt-installer.h
src/wrt-installer/wrt_installer_api.cpp
tests/general/CMakeLists.txt
tests/general/LanguageSubtagRstTreeTests.cpp [new file with mode: 0644]
tests/general/TestInit.cpp

index 23b1a5d..666256f 100644 (file)
@@ -52,9 +52,9 @@ SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++0x -g")
 SET(CMAKE_CXX_FLAGS_CCOV       "-O0 -std=c++0x -g --coverage")
 
-    ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
 IF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
     MESSAGE(STATUS "Logging enabled for DPL")
+    ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
 ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
     MESSAGE(STATUS "Logging disabled for DPL")
 ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
index 0d8233a..5a99dc3 100644 (file)
         </xs:restriction>
     </xs:simpleType>
 
+    <xs:simpleType name="soundmodeType">
+        <xs:restriction base="xs:token">
+            <xs:enumeration value="shared"/>
+            <xs:enumeration value="exclusive"/>
+        </xs:restriction>
+    </xs:simpleType>
+
     <xs:simpleType name="appWidgetIdType">
         <xs:restriction base="xs:string">
             <xs:pattern value="[0-9a-zA-Z]{10}.[0-9a-zA-Z]{1,52}.[0-9a-zA-Z]{1,}"/>
@@ -78,6 +85,7 @@
             <xs:attribute name="backbutton-persence" type="tizen:data.boolean" use="optional"/>
             <xs:attribute name="user-agent" use="optional"/>
             <xs:attribute name="hwkey-event" type="tizen:activationType" use="optional"/> <!-- default: true -->
+            <xs:attribute name="sound-mode" type="tizen:soundmodeType" use="optional"/> <!-- default: shared -->
         </xs:complexType>
     </xs:element>
 
index 40164fd..707cebc 100644 (file)
@@ -1,7 +1,7 @@
 #git:framework/web/wrt-installer
 Name:       wrt-installer
 Summary:    Installer for tizen Webruntime
-Version:    0.1.101
+Version:    0.1.110
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
@@ -19,6 +19,7 @@ BuildRequires:  pkgconfig(dpl-event-efl)
 BuildRequires:  pkgconfig(dpl-utils-efl)
 BuildRequires:  pkgconfig(dpl-wrt-dao-ro)
 BuildRequires:  pkgconfig(dpl-wrt-dao-rw)
+BuildRequires:  pkgconfig(wrt-commons-i18n-dao-ro)
 BuildRequires:  pkgconfig(security-install)
 BuildRequires:  pkgconfig(ecore-x)
 BuildRequires:  pkgconfig(xmlsec1)
index 724787d..93a2431 100644 (file)
@@ -70,6 +70,7 @@ SET(INSTALLER_SOURCES
     ${INSTALLER_JOBS}/widget_install/task_ace_check.cpp
     ${INSTALLER_JOBS}/widget_install/task_manifest_file.cpp
     ${INSTALLER_JOBS}/widget_install/task_certify.cpp
+    ${INSTALLER_JOBS}/widget_install/task_certify_level.cpp
     ${INSTALLER_JOBS}/widget_install/task_prepare_files.cpp
     ${INSTALLER_JOBS}/widget_install/task_recovery.cpp
     ${INSTALLER_JOBS}/widget_install/task_install_ospsvc.cpp
@@ -78,7 +79,7 @@ SET(INSTALLER_SOURCES
     ${INSTALLER_JOBS}/widget_install/task_encrypt_resource.cpp
     ${INSTALLER_JOBS}/widget_install/task_certificates.cpp
     ${INSTALLER_JOBS}/widget_install/task_prepare_reinstall.cpp
-    ${INSTALLER_JOBS}/widget_install/wac_security.cpp
+    ${INSTALLER_JOBS}/widget_install/widget_security.cpp
     ${INSTALLER_JOBS}/widget_install/widget_update_info.cpp
     ${INSTALLER_JOBS}/widget_install/directory_api.cpp
     ${INSTALLER_JOBS}/widget_install/widget_unzip.cpp
index 5fe45e4..bb4547e 100644 (file)
@@ -31,7 +31,7 @@
 #include "libiriwrapper.h"
 #include <dpl/utils/warp_iri.h>
 #include <dpl/utils/mime_type_utils.h>
-#include <language_subtag_rst_tree.h>
+//#include <language_subtag_rst_tree.h>
 
 #include <iri.h>
 #include <dpl/log/log.h>
@@ -984,7 +984,7 @@ class AppControlParser : public ElementParser
 
             if (!m_value.IsNull() && *m_value == ignoreUri)
             {
-                LogInfo("exception : '" << *m_value << "' scheme will be ignored.");
+                LogDebug("exception : '" << *m_value << "' scheme will be ignored.");
                 m_value = DPL::OptionalString::Null;
             }
 
@@ -2108,7 +2108,8 @@ class AllowNavigationParser : public ElementParser
 
     virtual void Accept(const Text& text)
     {
-        if (m_properNamespace) {
+        if (m_properNamespace)
+        {
             m_origin = text.value;
         }
     }
@@ -2119,6 +2120,12 @@ class AllowNavigationParser : public ElementParser
 
     virtual void Verify()
     {
+        if (m_data.allowNavigationEncountered || !m_properNamespace)
+        {
+            return;
+        }
+        m_data.allowNavigationEncountered = true;
+
         if (m_origin.IsNull()) {
             LogWarning("data is empty");
             return;
@@ -2782,7 +2789,7 @@ void WidgetParser::Accept(const XmlAttribute& attribute)
         m_version = attribute.value;
         NormalizeString(m_version);
     } else if (attribute.name == L"min-version") {
-        LogInfo("min-version attribute was found. Value: " << attribute.value);
+        LogDebug("min-version attribute was found. Value: " << attribute.value);
         m_minVersion = attribute.value;
         NormalizeString(m_minVersion);
         m_data.minVersionRequired = m_minVersion;
@@ -2848,8 +2855,8 @@ void WidgetParser::Accept(const XmlAttribute& attribute)
 
         //Any other value consider as a namespace definition
     } else if (attribute.name == L"xmlns" || attribute.prefix == L"xmlns") {
-        LogInfo("Namespace domain: " << attribute.name);
-        LogInfo("Namespace value: " << attribute.value);
+        LogDebug("Namespace domain: " << attribute.name);
+        LogDebug("Namespace value: " << attribute.value);
         m_nameSpaces[attribute.name] = attribute.value;
     } else {
         LogError("Unknown attirbute: namespace=" << attribute.ns <<
index 811c049..6cc3c3f 100644 (file)
@@ -73,7 +73,7 @@ void JobPluginInstall::SendFinishedSuccess()
         getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
                                               Jobs::Exceptions::ErrorPluginInstallationFailed);
 
-        LogInfo("Installation: " << getFilePath() <<
+        LogDebug("Installation: " << getFilePath() <<
                 " NOT possible");
     }
 }
index 861dbc2..2b90704 100644 (file)
@@ -85,7 +85,7 @@ PluginInstallTask::~PluginInstallTask()
 
 void PluginInstallTask::stepCheckPluginPath()
 {
-    LogInfo("Plugin installation: step CheckPluginPath");
+    LogDebug("Plugin installation: step CheckPluginPath");
 
     if(!m_context->pluginFilePath.Exists()){
         ThrowMsg(Exceptions::PluginPathFailed,
@@ -97,7 +97,7 @@ void PluginInstallTask::stepCheckPluginPath()
 
 void PluginInstallTask::stepParseConfigFile()
 {
-    LogInfo("Plugin installation: step parse config file");
+    LogDebug("Plugin installation: step parse config file");
 
     DPL::Utils::Path filename = m_context->pluginFilePath;
     filename /= GlobalConfig::GetPluginMetafileName();
@@ -107,7 +107,7 @@ void PluginInstallTask::stepParseConfigFile()
         return;
     }
 
-    LogInfo("Plugin Config file::" << filename.Filename());
+    LogDebug("Plugin Config file::" << filename.Filename());
 
     Try
     {
@@ -167,7 +167,7 @@ void PluginInstallTask::stepCheckIfAlreadyInstalled()
 
 void PluginInstallTask::stepLoadPluginLibrary()
 {
-    LogInfo("Plugin installation: step load library");
+    LogDebug("Plugin installation: step load library");
 
     DISABLE_IF_PLUGIN_WITHOUT_LIB()
 
@@ -264,16 +264,16 @@ void PluginInstallTask::stepLoadPluginLibrary()
     m_libraryObjects = PluginObjectsPtr(new PluginObjects());
     const js_entity_definition_t *rawEntityListIterator = rawEntityList;
 
-    LogInfo("#####");
-    LogInfo("##### Plugin: " << filename.Filename() << " supports new plugin API");
-    LogInfo("#####");
+    LogDebug("#####");
+    LogDebug("##### Plugin: " << filename.Filename() << " supports new plugin API");
+    LogDebug("#####");
 
     while (rawEntityListIterator->parent_name != NULL &&
            rawEntityListIterator->object_name != NULL)
     {
-        LogInfo("#####     [" << rawEntityListIterator->object_name << "]: ");
-        LogInfo("#####     Parent: " << rawEntityListIterator->parent_name);
-        LogInfo("#####");
+        LogDebug("#####     [" << rawEntityListIterator->object_name << "]: ");
+        LogDebug("#####     Parent: " << rawEntityListIterator->parent_name);
+        LogDebug("#####");
 
         m_libraryObjects->addObjects(rawEntityListIterator->parent_name,
                                      rawEntityListIterator->object_name);
@@ -296,7 +296,7 @@ void PluginInstallTask::stepLoadPluginLibrary()
 
 void PluginInstallTask::stepRegisterPlugin()
 {
-    LogInfo("Plugin installation: step register Plugin");
+    LogDebug("Plugin installation: step register Plugin");
 
     m_pluginHandle =
         PluginDAO::registerPlugin(m_pluginInfo, m_context->pluginFilePath.Fullpath());
@@ -306,7 +306,7 @@ void PluginInstallTask::stepRegisterPlugin()
 
 void PluginInstallTask::stepRegisterFeatures()
 {
-    LogInfo("Plugin installation: step register features");
+    LogDebug("Plugin installation: step register features");
 
     FOREACH(it, m_pluginInfo.m_featureContainer)
     {
@@ -318,7 +318,7 @@ void PluginInstallTask::stepRegisterFeatures()
 
 void PluginInstallTask::stepRegisterPluginObjects()
 {
-    LogInfo("Plugin installation: step register objects");
+    LogDebug("Plugin installation: step register objects");
 
     DISABLE_IF_PLUGIN_WITHOUT_LIB()
 
@@ -349,7 +349,7 @@ void PluginInstallTask::stepRegisterPluginObjects()
 
 void PluginInstallTask::stepResolvePluginDependencies()
 {
-    LogInfo("Plugin installation: step resolve dependencies ");
+    LogDebug("Plugin installation: step resolve dependencies ");
 
     //DISABLE_IF_PLUGIN_WITHOUT_LIB
     if (m_pluginInfo.m_libraryName.empty()) {
index c77fcf3..99d102d 100644 (file)
@@ -55,6 +55,7 @@
 #include "parser_runner.h"
 #include <widget_install/job_widget_install.h>
 #include <widget_install/task_certify.h>
+#include <widget_install/task_certify_level.h>
 #include <widget_install/task_widget_config.h>
 #include <widget_install/task_file_manipulation.h>
 #include <widget_install/task_ace_check.h>
@@ -108,7 +109,7 @@ bool hasExtension(const std::string& filename, const std::string& extension)
     if (fileLen < extLen) {
         LogError("Filename " << filename << " is shorter than extension "
                              << extension);
-        return false;
+         false;
     }
     return (0 == filename.compare(fileLen - extLen, extLen, extension));
 }
@@ -172,10 +173,16 @@ JobWidgetInstall::JobWidgetInstall(
     m_exceptionCaught(Jobs::Exceptions::Success)
 {
     m_installerContext.mode = m_jobStruct.m_installMode;
+    getInstallerStruct().pkgmgrInterface->sendSignal(
+        PKGMGR_START_KEY,
+        PKGMGR_START_INSTALL);
+    getInstallerStruct().pkgmgrInterface->sendSignal(
+        PKGMGR_PROGRESS_KEY,
+        PKGMGR_START_VALUE);
     ConfigureResult result = prepareInstallation(widgetPath);
 
     if (result == ConfigureResult::Ok) {
-        LogInfo("Configure installation succeeded");
+        LogDebug("Configure installation succeeded");
         m_installerContext.job->SetProgressFlag(true);
 
         AddTask(new TaskRecovery(m_installerContext));
@@ -187,10 +194,10 @@ JobWidgetInstall::JobWidgetInstall(
             AddTask(new TaskPrepareFiles(m_installerContext));
         }
         AddTask(new TaskCertify(m_installerContext));
+        AddTask(new TaskCertifyLevel(m_installerContext));
         if (m_needEncryption) {
             AddTask(new TaskEncryptResource(m_installerContext));
         }
-
         AddTask(new TaskFileManipulation(m_installerContext));
         AddTask(new TaskManifestFile(m_installerContext));
         if (m_installerContext.widgetConfig.packagingType ==
@@ -203,8 +210,8 @@ JobWidgetInstall::JobWidgetInstall(
         AddTask(new TaskAceCheck(m_installerContext));
         AddTask(new TaskSmack(m_installerContext));
     } else if (result == ConfigureResult::Updated) {
-        LogInfo("Configure installation updated");
-        LogInfo("Widget Update");
+        LogDebug("Configure installation updated");
+        LogDebug("Widget Update");
         m_installerContext.job->SetProgressFlag(true);
 
         if (m_installerContext.mode.command ==
@@ -222,10 +229,10 @@ JobWidgetInstall::JobWidgetInstall(
         }
 
         AddTask(new TaskCertify(m_installerContext));
+        AddTask(new TaskCertifyLevel(m_installerContext));
         if (m_needEncryption) {
             AddTask(new TaskEncryptResource(m_installerContext));
         }
-
         if (m_installerContext.mode.extension !=
                 InstallMode::ExtensionType::DIR) {
             AddTask(new TaskUpdateFiles(m_installerContext));
@@ -259,7 +266,6 @@ ConfigureResult JobWidgetInstall::prepareInstallation(
 {
     ConfigureResult result;
     m_needEncryption = false;
-
     Try
     {
         std::string tempDir;
@@ -301,6 +307,9 @@ ConfigureResult JobWidgetInstall::prepareInstallation(
         setApplicationType(configData);
         m_needEncryption = detectResourceEncryption(configData);
         setInstallLocationType(configData);
+        m_installerContext.callerPkgId =
+            DPL::FromUTF8String(getInstallerStruct().pkgmgrInterface->getCallerId());
+        LogDebug("Caller Package Id : " << m_installerContext.callerPkgId);
 
         // Configure installation
         result = ConfigureInstallation(widgetPath, configData, tempDir);
@@ -381,7 +390,7 @@ void JobWidgetInstall::setTizenId(
             break;
         }
         m_installerContext.widgetConfig.tzPkgid = pkgId;
-        LogInfo("tizen_id name was generated by WRT: " <<
+        LogDebug("tizen_id name was generated by WRT: " <<
                 m_installerContext.widgetConfig.tzPkgid);
     }
 
@@ -438,9 +447,9 @@ void JobWidgetInstall::setTizenId(
                                                          m_installerContext.
                                                              widgetConfig.
                                                              tzPkgid));
-    LogInfo("Tizen App Id : " << m_installerContext.widgetConfig.tzAppid);
-    LogInfo("Tizen Pkg Id : " << m_installerContext.widgetConfig.tzPkgid);
-    LogInfo("W3C Widget GUID : " << m_installerContext.widgetConfig.guid);
+    LogDebug("Tizen App Id : " << m_installerContext.widgetConfig.tzAppid);
+    LogDebug("Tizen Pkg Id : " << m_installerContext.widgetConfig.tzPkgid);
+    LogDebug("W3C Widget GUID : " << m_installerContext.widgetConfig.guid);
 }
 
 void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath,
@@ -457,7 +466,7 @@ void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath,
     m_installerContext.locations->registerAppid(
         DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
 
-    LogInfo("widgetSource " << widgetPath);
+    LogDebug("widgetSource " << widgetPath);
 }
 
 ConfigureResult JobWidgetInstall::ConfigureInstallation(
@@ -491,9 +500,6 @@ ConfigureResult JobWidgetInstall::ConfigureInstallation(
     }
     Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
         result = ConfigureResult::Ok;
-        getInstallerStruct().pkgmgrInterface->sendSignal(
-                PKGMGR_START_KEY,
-                PKGMGR_START_INSTALL);
         m_installerContext.isUpdateMode = false;
 
         if (!validateTizenApplicationID(
@@ -521,7 +527,7 @@ ConfigureResult JobWidgetInstall::ConfigureInstallation(
 bool JobWidgetInstall::validateTizenApplicationID(
     const WrtDB::TizenAppId &tizenAppId)
 {
-    LogInfo("tizen application ID = [" << tizenAppId << "]");
+    LogDebug("tizen application ID = [" << tizenAppId << "]");
 
     regex_t reg;
     if (regcomp(&reg, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
@@ -562,9 +568,9 @@ ConfigureResult JobWidgetInstall::checkWidgetUpdate(
         return ConfigureResult::Failed;
     }
 
-    LogInfo("existing version = '" << update.existingVersion);
-    LogInfo("incoming version = '" << update.incomingVersion);
-    LogInfo("Tizen AppID = " << update.tzAppId);
+    LogDebug("existing version = '" << update.existingVersion);
+    LogDebug("incoming version = '" << update.incomingVersion);
+    LogDebug("Tizen AppID = " << update.tzAppId);
 
     // Check running state
     bool isRunning = false;
@@ -620,7 +626,7 @@ ConfigureResult JobWidgetInstall::checkWidgetUpdate(
                 LogError("Fail to terminate running application");
                 return ConfigureResult::Failed_WidgetRunning;
             }
-            LogInfo("terminate application");
+            LogDebug("terminate application");
         }
     }
 
@@ -706,7 +712,7 @@ WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
     const ConfigParserData &configInfo,
     const WrtDB::TizenAppId &tizenId)
 {
-    LogInfo("Checking up widget package for config.xml...");
+    LogDebug("Checking up widget package for config.xml...");
     OptionalWidgetVersion incomingVersion;
 
     if (!configInfo.version.IsNull()) {
@@ -890,7 +896,7 @@ void JobWidgetInstall::displayWidgetInfo()
 
     out << std::endl;
 
-    LogInfo(out.str());
+    LogDebug(out.str());
 }
 
 WrtDB::PackagingType JobWidgetInstall::checkPackageType(
@@ -898,7 +904,7 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType(
     const std::string &tempPath)
 {
     if (hasExtension(widgetSource, XML_EXTENSION)) {
-        LogInfo("Hosted app installation");
+        LogDebug("Hosted app installation");
         return PKG_TYPE_HOSTED_WEB_APP;
     }
 
@@ -915,7 +921,7 @@ void JobWidgetInstall::setApplicationType(
 {
     AppType widgetAppType = APP_TYPE_UNKNOWN;
     FOREACH(iterator, configInfo.nameSpaces) {
-        LogInfo("namespace = [" << *iterator << "]");
+        LogDebug("namespace = [" << *iterator << "]");
 
         if (*iterator == ConfigurationNamespace::TizenWebAppNamespaceName) {
             if (widgetAppType != APP_TYPE_UNKNOWN &&
@@ -933,7 +939,7 @@ void JobWidgetInstall::setApplicationType(
 
     m_installerContext.widgetConfig.webAppType = widgetAppType;
 
-    LogInfo("type = [" <<
+    LogDebug("type = [" <<
             m_installerContext.widgetConfig.webAppType.getApptypeToString() <<
             "]");
 }
index 7a8bea6..80b37b0 100644 (file)
@@ -155,9 +155,10 @@ void Manifest::serialize(xmlTextWriterPtr writer)
         writeAttribute(writer, "type", this->type);
         writeAttribute(writer, "version", this->version);
         if (!this->installLocation.IsNull()) {
-            writeAttribute(writer, "install-location", (*this->installLocation),
-                           (*this->installLocation).empty());
+            writeAttribute(writer, "install-location", (*this->installLocation));
         }
+        writeAttribute(writer, "storeclient-id", this->storeClientId,
+                !this->storeClientId.empty());
 
         FOREACH(l, this->label)
         {
index 1729716..67ee3ce 100644 (file)
@@ -554,6 +554,10 @@ class Manifest
     {
         this->version = x;
     }
+    void setStoreClientId(const NcnameType &x)
+    {
+        this->storeClientId= x;
+    }
 
   private:
     std::list<LabelType> label;
@@ -573,6 +577,7 @@ class Manifest
     NmtokenType version;
     std::list<Account> account;
     PrivilegeType privileges;
+    NcnameType storeClientId;
 
 };
 } //namespace Jobs
index b3d7e4a..a75773b 100644 (file)
@@ -60,17 +60,17 @@ void TaskAceCheck::StepPrepareForAce()
 void TaskAceCheck::StepAceCheck()
 {
     WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
-    LogInfo("StepAceCheck!");
+    LogDebug("StepAceCheck!");
     // This widget does not use any device cap
     if (m_context.featureLogic->isDone()) {
         return;
     }
 
-    LogInfo("StepAceCheck!");
+    LogDebug("StepAceCheck!");
     DPL::String deviceCap = m_context.featureLogic->getDevice();
 
-    LogInfo("StepAceCheck!");
-    LogInfo("DevCap is : " << deviceCap);
+    LogDebug("StepAceCheck!");
+    LogDebug("DevCap is : " << deviceCap);
 
     std::string devCapStr = DPL::ToUTF8String(deviceCap);
     ace_policy_result_t policyResult = ACE_DENY;
@@ -90,7 +90,7 @@ void TaskAceCheck::StepAceCheck()
         }
     }
 
-    LogInfo("PolicyResult is : " << static_cast<int>(policyResult));
+    LogDebug("PolicyResult is : " << static_cast<int>(policyResult));
     m_context.staticPermittedDevCaps.insert(std::make_pair(deviceCap,
                                                            policyResult ==
                                                            ACE_PERMIT));
@@ -107,18 +107,18 @@ void TaskAceCheck::StepProcessAceResponse()
         return;
     }
 
-    LogInfo("StepProcessAceResponse");
+    LogDebug("StepProcessAceResponse");
     m_context.featureLogic->next();
 
     // No device caps left to process
     if (m_context.featureLogic->isDone()) {
-        LogInfo("All responses has been received from ACE.");
+        LogDebug("All responses has been received from ACE.");
         // Data to convert to C API
         std::vector<std::string> devCaps;
         std::vector<bool> devCapsSmack;
         // Saving static dev cap permissions
         FOREACH(cap, m_context.staticPermittedDevCaps) {
-            LogInfo("staticPermittedDevCaps : " << cap->first
+            LogDebug("staticPermittedDevCaps : " << cap->first
                                                 << " smack: " << cap->second);
             std::string devCapStr = DPL::ToUTF8String(cap->first);
             devCaps.push_back(devCapStr);
@@ -176,14 +176,14 @@ void TaskAceCheck::StepProcessAceResponse()
         return;
     }
 
-    LogInfo("Next device cap.");
+    LogDebug("Next device cap.");
     // Process next device cap
     SwitchToStep(&TaskAceCheck::StepAceCheck);
 }
 
 void TaskAceCheck::StepCheckAceResponse()
 {
-    LogInfo("Checking ACE response");
+    LogDebug("Checking ACE response");
     if (m_context.featureLogic->isRejected()) {
         LogError("Installation failure. Some devCap was not accepted by ACE.");
         ThrowMsg(
@@ -191,11 +191,11 @@ void TaskAceCheck::StepCheckAceResponse()
             "Instalation failure. "
             "Some deviceCap was not accepted by ACE.");
     }
-    LogInfo("Updating \"feature reject status\" in database!");
+    LogDebug("Updating \"feature reject status\" in database!");
     auto it = m_context.featureLogic->resultBegin();
     auto end = m_context.featureLogic->resultEnd();
     for (; it != end; ++it) {
-        LogInfo(
+        LogDebug(
             "  |-  Feature: " << it->name << " has reject status: " <<
             it->rejected);
         if (it->rejected) {
@@ -203,7 +203,7 @@ void TaskAceCheck::StepCheckAceResponse()
             dao.updateFeatureRejectStatus(*it);
         }
     }
-    LogInfo("Installation continues...");
+    LogDebug("Installation continues...");
 
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_ACE_CHECK,
index a6693bc..cf4afd3 100644 (file)
@@ -84,7 +84,7 @@ void TaskCertificates::SetCertiInfo(CertificateSource source)
 {
     LogDebug("Set CertiInfo to pkgmgr : " << source);
     CertificateChainList certificateChainList;
-    m_context.wacSecurity.getCertificateChainList(certificateChainList, source);
+    m_context.widgetSecurity.getCertificateChainList(certificateChainList, source);
 
     FOREACH(it, certificateChainList)
     {
index e5d1533..7b44f7f 100644 (file)
@@ -137,7 +137,7 @@ void TaskCertify::processDistributorSignature(const SignatureData &data)
 {
     // this signature is verified -
     // no point in check domain WAC_ROOT and WAC_RECOGNIZED
-    m_contextData.wacSecurity.setDistributorSigned(true);
+    m_contextData.widgetSecurity.setDistributorSigned(true);
 
     CertificateCollection collection;
     collection.load(data.getCertList());
@@ -148,13 +148,13 @@ void TaskCertify::processDistributorSignature(const SignatureData &data)
            "Certificate collection is not able to create chain. "
            "It is not possible to verify this signature.");
 
-    m_contextData.wacSecurity.getCertificateChainListRef().push_back(
+    m_contextData.widgetSecurity.getCertificateChainListRef().push_back(
         collection);
 
     if (data.getSignatureNumber() == 1) {
-        m_contextData.wacSecurity.getCertificateListRef().push_back(
+        m_contextData.widgetSecurity.getCertificateListRef().push_back(
             toWidgetCertificateData(data, true));
-        m_contextData.wacSecurity.getCertificateListRef().push_back(
+        m_contextData.widgetSecurity.getCertificateListRef().push_back(
             toWidgetCertificateData(data, false));
     }
 }
@@ -162,14 +162,14 @@ void TaskCertify::processDistributorSignature(const SignatureData &data)
 void TaskCertify::processAuthorSignature(const SignatureData &data)
 {
     using namespace ValidationCore;
-    LogInfo("DNS Identity match!");
+    LogDebug("DNS Identity match!");
     // this signature is verified or widget is distributor signed
-    m_contextData.wacSecurity.setAuthorCertificatePtr(data.getEndEntityCertificatePtr());
-    CertificatePtr test = m_contextData.wacSecurity.getAuthorCertificatePtr();
+    m_contextData.widgetSecurity.setAuthorCertificatePtr(data.getEndEntityCertificatePtr());
+    CertificatePtr test = m_contextData.widgetSecurity.getAuthorCertificatePtr();
 
-    m_contextData.wacSecurity.getCertificateListRef().push_back(
+    m_contextData.widgetSecurity.getCertificateListRef().push_back(
         toWidgetCertificateData(data, true));
-    m_contextData.wacSecurity.getCertificateListRef().push_back(
+    m_contextData.widgetSecurity.getCertificateListRef().push_back(
         toWidgetCertificateData(data, false));
 
     // match widget_id with one from dns identity set
@@ -186,12 +186,12 @@ void TaskCertify::processAuthorSignature(const SignatureData &data)
            "Certificate collection is not able to create chain. "
            "It is not possible to verify this signature.");
 
-    m_contextData.wacSecurity.getAuthorsCertificateChainListRef().push_back(
+    m_contextData.widgetSecurity.getAuthorsCertificateChainListRef().push_back(
         collection);
 
     FOREACH(it, dnsIdentity){
         if (widgetId.matchHost(*it)) {
-            m_contextData.wacSecurity.setRecognized(true);
+            m_contextData.widgetSecurity.setRecognized(true);
             return;
         }
     }
@@ -211,7 +211,7 @@ void TaskCertify::getSignatureFiles(std::string path, SignatureFileInfoSet& file
 
 void TaskCertify::stepSignature()
 {
-    LogInfo("================ Step: <<Signature>> ENTER ===============");
+    LogDebug("================ Step: <<Signature>> ENTER ===============");
 
     std::string widgetPath;
     widgetPath = m_contextData.locations->getTemporaryPackageDir() + "/";
@@ -239,10 +239,10 @@ void TaskCertify::stepSignature()
     }
 
     SignatureFileInfoSet::reverse_iterator iter = signatureFiles.rbegin();
-    LogInfo("Number of signatures: " << signatureFiles.size());
+    LogDebug("Number of signatures: " << signatureFiles.size());
 
     for (; iter != signatureFiles.rend(); ++iter) {
-        LogInfo("Checking signature with id=" << iter->getFileNumber());
+        LogDebug("Checking signature with id=" << iter->getFileNumber());
         SignatureData data(widgetPath + iter->getFileName(),
                            iter->getFileNumber());
 
@@ -300,10 +300,10 @@ void TaskCertify::stepSignature()
     }
 
     if (signatureFiles.empty()) {
-        LogInfo("No signature files has been found.");
+        LogDebug("No signature files has been found.");
     }
 
-    LogInfo("================ Step: <<Signature>> DONE ================");
+    LogDebug("================ Step: <<Signature>> DONE ================");
 
     m_contextData.job->UpdateProgress(
         InstallerContext::INSTALL_DIGSIG_CHECK,
@@ -312,7 +312,7 @@ void TaskCertify::stepSignature()
 
 void TaskCertify::stepFinalize()
 {
-    LogInfo("Step: <<CERTYFYING DONE>>");
+    LogDebug("Step: <<CERTYFYING DONE>>");
 
     m_contextData.job->UpdateProgress(
         InstallerContext::INSTALL_CERT_CHECK,
@@ -333,9 +333,9 @@ bool TaskCertify::isTizenWebApp() const
 
 void TaskCertify::stepVerifyUpdate()
 {
-    LogInfo("Step: <<Check Update>>");
+    LogDebug("Step: <<Check Update>>");
     CertificatePtr newCertificate =
-        m_contextData.wacSecurity.getAuthorCertificatePtr();
+        m_contextData.widgetSecurity.getAuthorCertificatePtr();
     CertificatePtr oldCertificate =
         getOldAuthorSignerCertificate(m_contextData.widgetConfig.tzAppid);
 
diff --git a/src/jobs/widget_install/task_certify_level.cpp b/src/jobs/widget_install/task_certify_level.cpp
new file mode 100644 (file)
index 0000000..6c77ccf
--- /dev/null
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/*
+ * @file    task_certify.cpp
+ * @author  Jihoon Chung (jihoon.chung@samgsung.com)
+ * @version
+ * @brief
+ */
+
+//SYSTEM INCLUDES
+#include <string>
+#include <map>
+#include <unistd.h>
+
+//WRT INCLUDES
+#include <widget_install/task_certify_level.h>
+#include <widget_install/job_widget_install.h>
+#include <widget_install/widget_install_errors.h>
+#include <widget_install/widget_install_context.h>
+#include <dpl/assert.h>
+#include <dpl/log/log.h>
+#include <dpl/exception.h>
+#include <dpl/string.h>
+#include <dpl/foreach.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+
+#include <vcore/CertStoreType.h>
+#include <vcore/SignatureReader.h>
+#include <vcore/SignatureFinder.h>
+#include <vcore/WrtSignatureValidator.h>
+#include <dpl/utils/wrt_global_settings.h>
+#include <dpl/wrt-dao-ro/global_dao_read_only.h>
+
+using namespace ValidationCore;
+using namespace WrtDB;
+
+namespace Jobs {
+namespace WidgetInstall {
+TaskCertifyLevel::TaskCertifyLevel(InstallerContext &inCont) :
+    DPL::TaskDecl<TaskCertifyLevel>(this),
+    m_contextData(inCont)
+{
+    AddStep(&TaskCertifyLevel::stepCertifyLevel);
+}
+
+void TaskCertifyLevel::stepCertifyLevel()
+{
+    LogDebug("================ Step: <<Certify Level>> ENTER ===============");
+    if (!checkSettingLevel(getCertifyLevel())) {
+        ThrowMsg(Exceptions::PrivilegeLevelViolation, "setting level violate");
+    }
+    LogDebug("================ Step: <<Certify Level>> DONE ================");
+
+    m_contextData.job->UpdateProgress(
+        InstallerContext::INSTALL_CERTIFY_LEVEL_CHECK,
+        "Application Certificate level check Finished");
+}
+
+void TaskCertifyLevel::getSignatureFiles(const std::string& path,
+                                         SignatureFileInfoSet& file)
+{
+    SignatureFileInfoSet signatureFiles;
+    SignatureFinder signatureFinder(path);
+    if (SignatureFinder::NO_ERROR != signatureFinder.find(file)) {
+        LogError("Error in Signature Finder : " << path);
+        ThrowMsg(Exceptions::SignatureNotFound, "Signature not found");
+    }
+}
+
+TaskCertifyLevel::Level TaskCertifyLevel::getCertifyLevel()
+{
+    std::string widgetPath;
+    widgetPath = m_contextData.locations->getTemporaryPackageDir() + "/";
+
+    if (m_contextData.mode.command == InstallMode::Command::REINSTALL) {
+        widgetPath =
+            m_contextData.locations->getPackageInstallationDir() + "/";
+    }
+
+    SignatureFileInfoSet signatureFiles;
+
+    Try {
+        getSignatureFiles(widgetPath, signatureFiles);
+
+        if (signatureFiles.size() <= 0) {
+            widgetPath += std::string(WrtDB::GlobalConfig::GetWidgetSrcPath())
+                + "/";
+            if (0 == access(widgetPath.c_str(), F_OK)) {
+                getSignatureFiles(widgetPath, signatureFiles);
+            }
+        }
+    } Catch(Exceptions::SignatureNotFound) {
+        ReThrowMsg(Exceptions::SignatureNotFound, widgetPath);
+    }
+
+    SignatureFileInfoSet::reverse_iterator iter = signatureFiles.rbegin();
+    LogDebug("Number of signatures: " << signatureFiles.size());
+
+    Level level = Level::UNKNOWN;
+    for (; iter != signatureFiles.rend(); ++iter) {
+        LogDebug("Checking signature with id=" << iter->getFileNumber());
+        SignatureData data(widgetPath + iter->getFileName(),
+                           iter->getFileNumber());
+
+        Try {
+            SignatureReader xml;
+            xml.initialize(data, GlobalConfig::GetSignatureXmlSchema());
+            xml.read(data);
+
+            WrtSignatureValidator validator(
+                    WrtSignatureValidator::TIZEN,
+                    !GlobalSettings::
+                    OCSPTestModeEnabled(),
+                    !GlobalSettings::
+                    CrlTestModeEnabled(),
+                    false);
+
+            WrtSignatureValidator::Result result =
+                validator.check(data, widgetPath);
+
+            if (m_contextData.mode.installTime
+                ==  InstallMode::InstallTime::PRELOAD)
+            {
+                result = WrtSignatureValidator::SIGNATURE_VERIFIED;
+            }
+
+            if (result == WrtSignatureValidator::SIGNATURE_REVOKED) {
+                ThrowMsg(Exceptions::CertificateExpired,
+                         "Certificate is REVOKED");
+            }
+
+            if (result == WrtSignatureValidator::SIGNATURE_INVALID &&
+                    iter->getFileNumber() <= 1)
+            {
+                ThrowMsg(Exceptions::SignatureInvalid, "Invalid Package");
+            }
+
+            if (data.isAuthorSignature()) {
+                LogDebug("Skip author signature");
+            } else {
+                Level currentCertLevel =
+                    certTypeToLevel(data.getVisibilityLevel());
+                if (currentCertLevel == Level::UNKNOWN) {
+                    continue;
+                }
+                if (currentCertLevel > level) {
+                    level = currentCertLevel;
+                    LogDebug("level " << enumToString(level));
+                }
+            }
+        } Catch(ParserSchemaException::Base) {
+            LogError("Error occured in ParserSchema.");
+            ReThrowMsg(Exceptions::SignatureInvalid,
+                       "Error occured in ParserSchema.");
+        }
+    }
+
+    return level;
+}
+
+bool TaskCertifyLevel::checkSettingLevel(
+    TaskCertifyLevel::Level level)
+{
+    secureSettingMap data = {
+        {"sound-mode", Level::PARTNER}
+    };
+
+    FOREACH(it, m_contextData.widgetConfig.configInfo.settingsList) {
+        secureSettingIter ret = data.find(DPL::ToUTF8String(it->m_name));
+        if (ret != data.end()) {
+            if (level < ret->second) {
+                LogError("\"" <<
+                         it->m_name <<
+                         "\" needs \"" <<
+                         enumToString(ret->second) <<
+                         "\" level");
+                return false;
+            }
+        }
+    }
+    return true;
+}
+
+std::string TaskCertifyLevel::enumToString(
+    TaskCertifyLevel::Level level)
+{
+    switch (level) {
+#define X(x, y) case x: return #y;
+        X(Level::UNKNOWN, UNKNOWN)
+        X(Level::PUBLIC, PUBLIC)
+        X(Level::PARTNER, PARTNER)
+        X(Level::PLATFORM, PLATFORM)
+#undef X
+    default:
+        return "UNKNOWN";
+    }
+}
+
+TaskCertifyLevel::Level TaskCertifyLevel::certTypeToLevel(
+    CertStoreId::Type type)
+{
+    // CertStoreType.h (framework/security/cert-svc)
+    // RootCA's visibility level : public
+    // const Type VIS_PUBLIC = 1 << 6;
+    // RootCA's visibility level : partner
+    // const Type VIS_PARTNER = 1 << 7;
+    // RootCA's visibility level : platform
+    // const Type VIS_PLATFORM = 1 << 10;
+    if (type == CertStoreId::VIS_PUBLIC) {
+        return Level::PUBLIC;
+    } else if (type == CertStoreId::VIS_PARTNER) {
+        return Level::PARTNER;
+    } else if (type == CertStoreId::VIS_PLATFORM) {
+        return Level::PLATFORM;
+    }
+    return Level::UNKNOWN;
+}
+
+} //namespace WidgetInstall
+} //namespace Jobs
+
diff --git a/src/jobs/widget_install/task_certify_level.h b/src/jobs/widget_install/task_certify_level.h
new file mode 100644 (file)
index 0000000..ae8ce40
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/**
+ * @file    task_certify_level.h
+ * @author  Jihoon Chung (jihoon.chung@samgsung.com)
+ * @version
+ * @brief
+ */
+#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_CERTIFY_LEVEL_H
+#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_CERTIFY_LEVEL_H
+
+//SYSTEM INCLUDES
+#include <string>
+#include <cstdint>
+#include <map>
+
+//WRT INCLUDES
+#include <vcore/CertStoreType.h>
+#include <vcore/SignatureFinder.h>
+#include <dpl/task.h>
+
+class InstallerContext;
+
+namespace Jobs {
+namespace WidgetInstall {
+class TaskCertifyLevel :
+    public DPL::TaskDecl<TaskCertifyLevel>
+{
+  public:
+    TaskCertifyLevel(InstallerContext &inCont);
+
+  private:
+    //data
+    InstallerContext& m_contextData;
+
+    enum class Level : std::int8_t {
+        UNKNOWN  = 0,
+        PUBLIC   = 1,
+        PARTNER  = 2,
+        PLATFORM = 3
+    };
+    typedef std::map<std::string, Level> secureSettingMap;
+    typedef std::map<std::string, Level>::iterator secureSettingIter;
+
+    //steps
+    void stepCertifyLevel();
+
+    //util
+    void getSignatureFiles(const std::string& path,
+                           ValidationCore::SignatureFileInfoSet& file);
+    Level getCertifyLevel();
+    bool checkSettingLevel(Level level);
+    std::string enumToString(Level level);
+    Level certTypeToLevel(ValidationCore::CertStoreId::Type type);
+
+};
+} //namespace WidgetInstall
+} //namespace Jobs
+
+#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_CERTIFY_LEVEL_H
index cd643ec..3935cfb 100644 (file)
@@ -41,7 +41,7 @@ const mode_t TEMPORARY_PATH_MODE = 0775;
 
 std::string createTempPath(bool preload)
 {
-    LogInfo("Step: Creating temporary path");
+    LogDebug("Step: Creating temporary path");
 
     // Temporary path
     std::ostringstream tempPathBuilder;
index 29fda9a..de10e4a 100644 (file)
@@ -73,7 +73,7 @@ void TaskDatabase::StepWrtDBInsert()
         time(&m_context.widgetConfig.installedTime);
 
         if (m_context.isUpdateMode) { //update
-            LogInfo("Registering widget... (update)");
+            LogDebug("Registering widget... (update)");
             Try
             {
                 m_handleToRemove = WidgetDAOReadOnly::getHandle(
@@ -96,27 +96,27 @@ void TaskDatabase::StepWrtDBInsert()
                 m_backAppId,
                 m_context.widgetConfig.tzAppid,
                 m_context.widgetConfig,
-                m_context.wacSecurity);
+                m_context.widgetSecurity);
             m_handle = WidgetDAOReadOnly::getHandle(
                     m_context.widgetConfig.tzAppid);
         } else { //new installation
-            LogInfo("Registering widget...");
+            LogDebug("Registering widget...");
             WidgetDAO::registerWidget(
                 m_context.widgetConfig.tzAppid,
                 m_context.widgetConfig,
-                m_context.wacSecurity);
+                m_context.widgetSecurity);
             m_handle = WidgetDAOReadOnly::getHandle(
                     m_context.widgetConfig.tzAppid);
         }
 
         FOREACH(cap, m_context.staticPermittedDevCaps) {
-            LogInfo(
+            LogDebug(
                 "staticPermittedDevCaps : " << cap->first
                                             << " smack status: " <<
                 cap->second);
         }
 
-        LogInfo("Widget registered");
+        LogDebug("Widget registered");
     }
     Catch(WidgetDAO::Exception::DatabaseError)
     {
@@ -144,7 +144,7 @@ void TaskDatabase::StepAceDBInsert()
     }
 
     if (!AceApi::registerAceWidget(m_handle, m_context.widgetConfig,
-                                   m_context.wacSecurity.getCertificateList()))
+                                   m_context.widgetSecurity.getCertificateList()))
     {
         LogError("ace database insert failed");
         ThrowMsg(Exceptions::UpdateFailed,
@@ -302,17 +302,17 @@ void TaskDatabase::StepLiveboxDBInsert()
         } else {
             boxType = DPL::ToUTF8String((**it).m_type);
         }
-        LogInfo("livebox id: " << boxId);
-        LogInfo("livebox type: " << boxType);
+        LogDebug("livebox id: " << boxId);
+        LogDebug("livebox type: " << boxType);
 
         int autoLaunch = (**it).m_autoLaunch == L"true" ? 1 : 0;
-        LogInfo("livebox auto-launch: " << autoLaunch);
+        LogDebug("livebox auto-launch: " << autoLaunch);
 
         int mouseEvent = (**it).m_boxInfo.m_boxMouseEvent == L"true" ? 1 : 0;
-        LogInfo("livebox mouse-event: " << mouseEvent);
+        LogDebug("livebox mouse-event: " << mouseEvent);
 
         int pdFastOpen = (**it).m_boxInfo.m_pdFastOpen == L"true" ? 1 : 0;
-        LogInfo("livebox pd fast-open: " << pdFastOpen);
+        LogDebug("livebox pd fast-open: " << pdFastOpen);
 
         web_provider_livebox_insert_box_info(
                 boxId.c_str(), tizenId.c_str(), boxType.c_str(),
index 181e85e..866d189 100644 (file)
@@ -118,7 +118,7 @@ void changeOwnerForDirectory(std::string storagePath, mode_t mode) {
                      "Chown to invaild user");
         }
     } else if (euidaccess(storagePath.c_str(), W_OK | R_OK | X_OK) == 0) {
-        LogInfo(storagePath << " already exists.");
+        LogDebug(storagePath << " already exists.");
         // Even if private directory already is created, private dircetory
         // should change owner.
         if (chown(storagePath.c_str(),
index b3e3374..3c3fb94 100644 (file)
@@ -56,7 +56,7 @@ TaskInstallOspsvc::TaskInstallOspsvc(InstallerContext& context) :
 
 void TaskInstallOspsvc::StepInstallOspService()
 {
-    LogInfo("Step: installation for osp service");
+    LogDebug("Step: installation for osp service");
 
     std::ostringstream commStr;
     commStr << OSP_INSTALL_STR << BashUtils::escape_arg(
old mode 100755 (executable)
new mode 100644 (file)
index a94bf6a..6133536
@@ -179,7 +179,7 @@ void TaskManifestFile::stepCreateExecFile()
     }
 #else
     //default widget
-    LogInfo("link -s " << clientExeStr << " " << exec);
+    LogDebug("link -s " << clientExeStr << " " << exec);
     errno = 0;
     if (symlink(clientExeStr.c_str(), exec.c_str()) != 0)
     {
@@ -489,7 +489,7 @@ void TaskManifestFile::saveLocalizedKey(std::ofstream &file,
 
 void TaskManifestFile::backupIconFiles()
 {
-    LogInfo("Backup Icon Files");
+    LogDebug("Backup Icon Files");
 
     std::ostringstream b_icon_dir;
     b_icon_dir << backup_dir.str() << "icons";
@@ -654,7 +654,7 @@ void TaskManifestFile::commitManifest()
     if (!(m_context.mode.rootPath == InstallMode::RootPath::RO &&
                 m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
                 && m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
-        LogInfo("cp " << manifest_file << " " << commit_manifest);
+        LogDebug("cp " << manifest_file << " " << commit_manifest);
 
         DPL::FileInput input(DPL::ToUTF8String(manifest_file));
         DPL::FileOutput output(commit_manifest);
@@ -955,6 +955,10 @@ void TaskManifestFile::setWidgetManifest(Manifest & manifest)
     DPL::String name = (!!m_context.widgetConfig.configInfo.authorName ?
                         *m_context.widgetConfig.configInfo.authorName : L"");
     manifest.addAuthor(Author(email, href, L"", name));
+
+    if (!m_context.callerPkgId.empty()) {
+        manifest.setStoreClientId(m_context.callerPkgId);
+    }
 }
 
 void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp)
@@ -985,7 +989,7 @@ void TaskManifestFile::setAppControlsInfo(UiApplication & uiApp)
         m_context.widgetConfig.configInfo.appControlList;
 
     if (appControlList.empty()) {
-        LogInfo("Widget doesn't contain app control");
+        LogDebug("Widget doesn't contain app control");
         return;
     }
 
@@ -1022,7 +1026,7 @@ void TaskManifestFile::setAppCategory(UiApplication &uiApp)
         m_context.widgetConfig.configInfo.categoryList;
 
     if (categoryList.empty()) {
-        LogInfo("Widget doesn't contain application category");
+        LogDebug("Widget doesn't contain application category");
         return;
     }
     FOREACH(it, categoryList) {
@@ -1038,7 +1042,7 @@ void TaskManifestFile::setMetadata(UiApplication &uiApp)
         m_context.widgetConfig.configInfo.metadataList;
 
     if (metadataList.empty()) {
-        LogInfo("Web application doesn't contain metadata");
+        LogDebug("Web application doesn't contain metadata");
         return;
     }
     FOREACH(it, metadataList) {
@@ -1067,7 +1071,7 @@ void TaskManifestFile::stepAbortParseManifest()
 void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
 {
     FOREACH(it, m_context.widgetConfig.configInfo.m_livebox) {
-        LogInfo("setLiveBoxInfo");
+        LogDebug("setLiveBoxInfo");
         LiveBoxInfo liveBox;
         DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
         DPL::String appid = m_context.widgetConfig.tzAppid;
@@ -1129,7 +1133,7 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
         if (ConfigInfo->m_boxInfo.m_boxSrc.empty() ||
             ConfigInfo->m_boxInfo.m_boxSize.empty())
         {
-            LogInfo("Widget doesn't contain box");
+            LogDebug("Widget doesn't contain box");
             return;
         } else {
             BoxInfoType box;
@@ -1212,7 +1216,7 @@ void TaskManifestFile::setAccount(Manifest& manifest)
     AccountProviderType provider;
 
     if (account.m_iconSet.empty()) {
-        LogInfo("Widget doesn't contain Account");
+        LogDebug("Widget doesn't contain Account");
         return;
     }
     if (account.m_multiAccountSupport) {
index 772375a..4eb4f3d 100644 (file)
@@ -65,7 +65,7 @@ TaskPrepareReinstall::TaskPrepareReinstall(InstallerContext& context) :
 
 void TaskPrepareReinstall::StepPrepare()
 {
-    LogInfo("Prepare");
+    LogDebug("Prepare");
     m_sourcePath = m_context.locations->getTemporaryPackageDir();
     m_sourcePath += "/";
 
@@ -75,7 +75,7 @@ void TaskPrepareReinstall::StepPrepare()
 
 void TaskPrepareReinstall::StepParseRDSDelta()
 {
-    LogInfo("parse RDS delta");
+    LogDebug("parse RDS delta");
     std::string rdsDeltaPath = m_sourcePath;
     rdsDeltaPath += ".rds_delta";
     std::ifstream delta(rdsDeltaPath);
@@ -91,7 +91,7 @@ void TaskPrepareReinstall::StepParseRDSDelta()
     while (std::getline(delta, line) &&!delta.eof()) {
         FOREACH(keyIt, keyList) {
             if (line == *keyIt) {
-                LogInfo("find key = [" << line << "]");
+                LogDebug("find key = [" << line << "]");
                 key = line;
                 break;
             }
@@ -101,20 +101,20 @@ void TaskPrepareReinstall::StepParseRDSDelta()
         }
         if (key == KEY_DELETE) {
             m_deleteFileList.push_back(line);
-            LogInfo("line = [" << line << "]");
+            LogDebug("line = [" << line << "]");
         } else if (key == KEY_ADD) {
             m_addFileList.push_back(line);
-            LogInfo("line = [" << line << "]");
+            LogDebug("line = [" << line << "]");
         } else if (key == KEY_MODIFY) {
             m_modifyFileList.push_back(line);
-            LogInfo("line = [" << line << "]");
+            LogDebug("line = [" << line << "]");
         }
     }
 }
 
 void TaskPrepareReinstall::StepVerifyRDSDelta()
 {
-    LogInfo("verify RDS delta");
+    LogDebug("verify RDS delta");
     // Verify ADD file
     FOREACH(file, m_addFileList) {
         std::string addFilePath = m_sourcePath;
@@ -137,7 +137,7 @@ void TaskPrepareReinstall::StepVerifyRDSDelta()
         existingFilePath += *file;
         verifyFile(existingFilePath);
     }
-    LogInfo("Finished veify RDS Delta");
+    LogDebug("Finished veify RDS Delta");
 
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_RDS_DELTA_CHECK,
@@ -146,7 +146,7 @@ void TaskPrepareReinstall::StepVerifyRDSDelta()
 
 void TaskPrepareReinstall::StepAddFile()
 {
-    LogInfo("Add file");
+    LogDebug("Add file");
     FOREACH(file, m_addFileList) {
         std::string newfile = m_sourcePath;
         newfile += *file;
@@ -156,13 +156,13 @@ void TaskPrepareReinstall::StepAddFile()
             ThrowMsg(Exceptions::RDSDeltaFailure,
                 "Fail to ADD file " << newfile);
         }
-        LogInfo("Copy " << newfile << " to " << destPath);
+        LogDebug("Copy " << newfile << " to " << destPath);
     }
 }
 
 void TaskPrepareReinstall::StepDeleteFile()
 {
-    LogInfo("Delete file");
+    LogDebug("Delete file");
     FOREACH(file, m_deleteFileList) {
         std::string deleteFilePath = m_installedPath;
         deleteFilePath += *file;
@@ -170,13 +170,13 @@ void TaskPrepareReinstall::StepDeleteFile()
             ThrowMsg(Exceptions::RDSDeltaFailure,
                 "Fail to DELETE file " << deleteFilePath);
         }
-        LogInfo("Delete " << deleteFilePath);
+        LogDebug("Delete " << deleteFilePath);
     }
 }
 
 void TaskPrepareReinstall::StepModifyFile()
 {
-    LogInfo("Modify  file");
+    LogDebug("Modify  file");
     FOREACH(file, m_modifyFileList) {
         std::string destPath = m_installedPath;
         destPath += *file;
@@ -191,7 +191,7 @@ void TaskPrepareReinstall::StepModifyFile()
             ThrowMsg(Exceptions::RDSDeltaFailure,
                 "Fail to move new file" << destPath);
         }
-        LogInfo("Replace " << newfile << " to " << destPath);
+        LogDebug("Replace " << newfile << " to " << destPath);
     }
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_RDS_PREPARE,
index 6e963b8..09b0e7d 100644 (file)
@@ -52,7 +52,7 @@ TaskRecovery::TaskRecovery(InstallerContext& context) :
 
 void TaskRecovery::StepCreateCheckFile()
 {
-    LogInfo("Step: create information file for recovery");
+    LogDebug("Step: create information file for recovery");
 
     size_t pos = m_context.locations->getWidgetSource().rfind("/");
     std::ostringstream infoPath;
index 9b99814..65a97cb 100644 (file)
@@ -67,7 +67,7 @@ TaskSmack::TaskSmack(InstallerContext& context) :
 
 void TaskSmack::StepSetInstall()
 {
-    LogInfo("----------------> SMACK: StepStartSetSmack()");
+    LogDebug("----------------> SMACK: StepStartSetSmack()");
 #ifdef WRT_SMACK_ENABLED
     std::string pkg = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid);
     m_pkgId = (char*)calloc(1, pkg.length() + 1);
@@ -87,7 +87,7 @@ void TaskSmack::StepSetInstall()
 
 void TaskSmack::StepSmackFolderLabeling()
 {
-    LogInfo("----------------> SMACK:\
+    LogDebug("----------------> SMACK:\
             Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()");
 #ifdef WRT_SMACK_ENABLED
     /* /opt/usr/apps/[pkgid] directory's label is "_" */
@@ -151,7 +151,7 @@ void TaskSmack::StepSmackFolderLabeling()
 
 void TaskSmack::StepSmackPrivilege()
 {
-    LogInfo("----------------> SMACK:\
+    LogDebug("----------------> SMACK:\
             Jobs::WidgetInstall::TaskSmack::SmackPrivilegeStep()");
 #ifdef WRT_SMACK_ENABLED
     /* TODO :
@@ -168,7 +168,7 @@ void TaskSmack::StepSmackPrivilege()
     char** perm_list = new char*[privileges.size() + 1];
     int index = 0;
     FOREACH(it, privileges) {
-        LogInfo("Permission : " << it->name);
+        LogDebug("Permission : " << it->name);
         int length = DPL::ToUTF8String(it->name).length();
         char *priv = new char[length + 1];
         snprintf(priv, length + 1, "%s",
@@ -197,7 +197,7 @@ void TaskSmack::StepSmackPrivilege()
 
 void TaskSmack::StepRevokeForUpdate()
 {
-    LogInfo("----------------> SMACK:\
+    LogDebug("----------------> SMACK:\
             Jobs::WidgetInstall::TaskSmack::StepRevokePrivilegeForUpdate()");
 #ifdef WRT_SMACK_ENABLED
     if (PC_OPERATION_SUCCESS != app_revoke_permissions(m_pkgId)) {
@@ -208,7 +208,7 @@ void TaskSmack::StepRevokeForUpdate()
 
 void TaskSmack::StepAbortSmack()
 {
-    LogInfo("----------------> SMACK:\
+    LogDebug("----------------> SMACK:\
             Jobs::WidgetInstall::TaskSmack::StepAbortSmack()");
 #ifdef WRT_SMACK_ENABLED
 
@@ -247,7 +247,7 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId)
     }
 
     /* /shared/trusted directory */
-    CertificatePtr rootCert = m_context.wacSecurity.getAuthorCertificatePtr();
+    CertificatePtr rootCert = m_context.widgetSecurity.getAuthorCertificatePtr();
     if (rootCert.Get() != NULL) {
         ValidationCore::Crypto::Hash::SHA1 sha1;
         sha1.Append(rootCert->getDER());
index 758535d..c541346 100644 (file)
@@ -67,11 +67,6 @@ const char WRT_WIDGETS_XML_SCHEMA[] = "/usr/etc/wrt-installer/widgets.xsd";
 
 namespace Jobs {
 namespace WidgetInstall {
-void InstallerTaskWidgetPopupData::PopupData::addWidgetInfo(
-    const DPL::String &info)
-{
-    widgetInfo = info;
-}
 
 TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) :
     DPL::TaskDecl<TaskWidgetConfig>(this),
@@ -94,7 +89,7 @@ void TaskWidgetConfig::StepProcessConfigurationFile()
     Try
     {
         std::string path = m_installContext.locations->getConfigurationDir();
-        LogInfo("path: " << path);
+        LogDebug("path: " << path);
 
         processFile(path, m_installContext.widgetConfig);
     }
@@ -180,8 +175,8 @@ void TaskWidgetConfig::ProcessLocalizedStartFiles()
             return;
         }
     }
-    ThrowMsg(Exceptions::WidgetConfigFileInvalid,
-             L"The Widget has no valid start file");
+    ThrowMsg(Exceptions::InvalidStartFile,
+             "The Widget has no valid start file");
 }
 
 void TaskWidgetConfig::ProcessStartFile(const DPL::OptionalString& path,
@@ -309,7 +304,7 @@ void TaskWidgetConfig::ProcessLocalizedIcons()
 
 void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon)
 {
-    LogInfo("enter");
+    LogDebug("enter");
     bool isAnyIconValid = false;
     //In case a default filename is passed as custom filename in config.xml, we
     //need to keep a set of already processed filenames to avoid icon
@@ -343,7 +338,7 @@ void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon)
             if (MimeTypeUtils::isMimeTypeSupportedForIcon(type)) {
                 isAnyIconValid = true;
                 localesAvailableForIcon.insert(*i);
-                LogInfo("Icon absolutePath :" << absolutePath <<
+                LogDebug("Icon absolutePath :" << absolutePath <<
                         ", assigned locale :" << *i << ", type: " << type);
             }
         }
@@ -502,7 +497,7 @@ void TaskWidgetConfig::StepVerifyFeatures()
         if (!isFeatureAllowed(m_installContext.widgetConfig.webAppType.appType,
                               it->name))
         {
-            LogInfo("This application type not allowed to use this feature");
+            LogDebug("This application type not allowed to use this feature");
             ThrowMsg(
                 Exceptions::WidgetConfigFileInvalid,
                 "This app type [" <<
@@ -521,9 +516,6 @@ void TaskWidgetConfig::StepVerifyFeatures()
         featureInfo += DPL::ToUTF8String(BR);
     }
     data.featuresList = newList;
-    if (!featureInfo.empty()) {
-        m_popupData.addWidgetInfo(DPL::FromUTF8String(featureInfo));
-    }
 
     m_installContext.job->UpdateProgress(
         InstallerContext::INSTALL_WIDGET_CONFIG2,
@@ -549,7 +541,7 @@ void TaskWidgetConfig::StepVerifyLivebox()
             boxType = DPL::ToUTF8String((**it).m_type);
         }
 
-        LogInfo("livebox type: " << boxType);
+        LogDebug("livebox type: " << boxType);
 
         ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList =
             (**it).m_boxInfo.m_boxSize;
@@ -580,9 +572,9 @@ bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType,
                                         DPL::String featureName)
 {
     using namespace WrtDB;
-    LogInfo("AppType = [" <<
+    LogDebug("AppType = [" <<
             WidgetType(appType).getApptypeToString() << "]");
-    LogInfo("FetureName = [" << featureName << "]");
+    LogDebug("FetureName = [" << featureName << "]");
 
     AppType featureType = APP_TYPE_UNKNOWN;
     std::string featureStr = DPL::ToUTF8String(featureName);
@@ -679,7 +671,7 @@ bool TaskWidgetConfig::isMinVersionCompatible(
         (majorWidget == majorSupported && minorWidget == minorSupported
          && microWidget > microSupported))
     {
-        LogInfo("Platform doesn't support this widget.");
+        LogDebug("Platform doesn't support this widget.");
         return false;
     }
     return true;
index 785d7fc..71b8a67 100755 (executable)
@@ -39,13 +39,6 @@ class InstallerContext;
 
 namespace Jobs {
 namespace WidgetInstall {
-namespace InstallerTaskWidgetPopupData {
-struct PopupData
-{
-    DPL::String widgetInfo;
-    void addWidgetInfo(const DPL::String &info);
-};
-} // InstalllerTaskWidgetPopupData
 
 class TaskWidgetConfig :
     public DPL::TaskDecl<TaskWidgetConfig>
@@ -63,7 +56,6 @@ class TaskWidgetConfig :
     InstallerContext& m_installContext;
     WrtDB::LocaleSet m_localeFolders;
     std::set<DPL::String> m_processedIconSet;
-    InstallerTaskWidgetPopupData::PopupData m_popupData;
 
     void StepProcessConfigurationFile();
     void ReadLocaleFolders();
index a19f3bb..3d735b6 100644 (file)
@@ -26,7 +26,7 @@
 #include <string>
 #include <dpl/string.h>
 #include <dpl/wrt-dao-rw/widget_dao.h>
-#include <widget_install/wac_security.h>
+#include <widget_install/widget_security.h>
 #include <feature_logic.h>
 #include <widget_install/widget_update_info.h>
 #include <widget_location.h>
@@ -56,6 +56,7 @@ struct InstallerContext
         INSTALL_WIDGET_CONFIG2,
         INSTALL_DIGSIG_CHECK,
         INSTALL_CERT_CHECK,
+        INSTALL_CERTIFY_LEVEL_CHECK,
         INSTALL_ECRYPTION_FILES,
         INSTALL_CREATE_BACKUP_DIR,                     /* For Update */
         INSTALL_DIR_CREATE,
@@ -78,7 +79,7 @@ struct InstallerContext
     // Installation state variables
     WrtDB::WidgetRegisterInfo widgetConfig;      ///< WidgetConfigInfo
     DPL::Optional<WidgetLocation> locations;
-    Jobs::WidgetInstall::WacSecurity wacSecurity; ///< Widget Domain
+    Jobs::WidgetInstall::WidgetSecurity widgetSecurity; ///< Widget Domain
                                                   // information.
     InstallStep installStep;              ///< current step of installation
     Jobs::WidgetInstall::JobWidgetInstall *job;
@@ -95,6 +96,7 @@ struct InstallerContext
     InstallLocationType locationType;
     bool isUpdateMode;
     InstallMode mode;
+    DPL::String callerPkgId;
 };
 
 #endif // INSTALLER_CONTEXT_H
index 3ef2a79..3fb3dfc 100644 (file)
@@ -44,6 +44,7 @@ DECLARE_JOB_EXCEPTION(Base, EmptyPluginsDirectory, ErrorPackageInvalid)
 DECLARE_JOB_EXCEPTION(Base, PluginsSubdirectory, ErrorPackageInvalid)
 DECLARE_JOB_EXCEPTION(Base, RDSDeltaFailure, ErrorPackageInvalid)
 DECLARE_JOB_EXCEPTION(Base, MissingConfig, ErrorPackageInvalid)
+DECLARE_JOB_EXCEPTION(Base, InvalidStartFile, ErrorPackageInvalid)
 
 DECLARE_JOB_EXCEPTION(Base, PackageLowerVersion, ErrorPackageLowerVersion)
 
similarity index 92%
rename from src/jobs/widget_install/wac_security.cpp
rename to src/jobs/widget_install/widget_security.cpp
index 447a99f..01644ab 100644 (file)
  *    limitations under the License.
  */
 /*
- * @file    wac_security.cpp
+ * @file    widget_security.cpp
  * @author  Krzysztof Jackiewicz(k.jackiewicz@samsung.com)
  * @version 1.0
  * @brief
  */
 
-#include "wac_security.h"
+#include "widget_security.h"
 #include <dpl/foreach.h>
 
 namespace Jobs {
 namespace WidgetInstall {
-void WacSecurity::getCertificateChainList(
+void WidgetSecurity::getCertificateChainList(
     WrtDB::CertificateChainList& list,
     WrtDB::CertificateSource source) const
 {
similarity index 92%
rename from src/jobs/widget_install/wac_security.h
rename to src/jobs/widget_install/widget_security.h
index 8306f75..0bc04ef 100644 (file)
@@ -14,7 +14,7 @@
  *    limitations under the License.
  */
 /*
- * @file    wac_security.h
+ * @file    widget_security.h
  * @author  Krzysztof Jackiewicz(k.jackiewicz@samsung.com)
  * @version 1.0
  * @brief
 
 namespace Jobs {
 namespace WidgetInstall {
-class WacSecurity : public WrtDB::IWacSecurity
+class WidgetSecurity : public WrtDB::IWidgetSecurity
 {
   public:
-    WacSecurity() :
+    WidgetSecurity() :
         mRecognized(false),
         mDistributorSigned(false)
     {}
 
-    // from IWacSecurity
+    // from IWidgetSecurity
     virtual const WrtDB::WidgetCertificateDataList& getCertificateList() const
     {
         return mCertificateList;
@@ -53,12 +53,6 @@ class WacSecurity : public WrtDB::IWacSecurity
         return mDistributorSigned;
     }
 
-    // TODO : remove after wrt-commons released
-    virtual bool isWacSigned() const
-    {
-        return false;
-    }
-
     virtual void getCertificateChainList(
         WrtDB::CertificateChainList& list,
         WrtDB::CertificateSource source) const;
index 95f3ab4..28ef7b2 100644 (file)
@@ -90,7 +90,7 @@ void WidgetUnzip::ExtractFile(DPL::ZipInput::File *input,
 void WidgetUnzip::unzipProgress(const std::string &destination)
 {
     // Show file info
-    LogInfo("Unzipping: '" << m_zipIterator->name <<
+    LogDebug("Unzipping: '" << m_zipIterator->name <<
             "', Comment: '" << m_zipIterator->comment <<
             "', Compressed size: " << m_zipIterator->compressedSize <<
             ", Uncompressed size: " << m_zipIterator->uncompressedSize);
@@ -142,7 +142,7 @@ void WidgetUnzip::unzipProgress(const std::string &destination)
 
     // Check whether there are more files to extract
     if (++m_zipIterator == m_zip->end()) {
-        LogInfo("Unzip progress finished successfuly");
+        LogDebug("Unzip progress finished successfuly");
     } else {
         unzipProgress(destination);
     }
@@ -174,10 +174,10 @@ bool WidgetUnzip::isDRMPackage(const std::string &source)
     ret = drm_oem_sapps_is_drm_file(source.c_str(), source.length());
     dlclose(pHandle);
     if (1 == ret) {
-        LogInfo(source << " is DRM file");
+        LogDebug(source << " is DRM file");
         return true;
     }
-    LogInfo(source << " isn't DRM file");
+    LogDebug(source << " isn't DRM file");
     return false;
 }
 
@@ -211,7 +211,7 @@ bool WidgetUnzip::decryptDRMPackage(const std::string &source, const std::string
             decryptedSource.c_str(), decryptedSource.length());
     dlclose(pHandle);
     if (1 == ret) {
-        LogInfo(source << " is decrypted : " << decryptedSource);
+        LogDebug(source << " is decrypted : " << decryptedSource);
         return true;
     }
     return false;
@@ -219,7 +219,7 @@ bool WidgetUnzip::decryptDRMPackage(const std::string &source, const std::string
 
 std::string WidgetUnzip::getDecryptedPackage(const std::string &source)
 {
-    LogInfo("Check DRM...");
+    LogDebug("Check DRM...");
     if (isDRMPackage(source)) {
         std::string decryptedFile;
         size_t found = source.find_last_of(".wgt");
@@ -242,7 +242,7 @@ std::string WidgetUnzip::getDecryptedPackage(const std::string &source)
 
 void WidgetUnzip::unzipWgtFile(const std::string &source, const std::string &destination)
 {
-    LogInfo("Prepare to unzip...");
+    LogDebug("Prepare to unzip...");
     std::string wgtFile;
     Try
     {
@@ -250,7 +250,7 @@ void WidgetUnzip::unzipWgtFile(const std::string &source, const std::string &des
         LogDebug("wgtFile : " << wgtFile);
 
         m_zip.reset(new DPL::ZipInput(wgtFile));
-        LogInfo("Widget package comment: " << m_zip->GetGlobalComment());
+        LogDebug("Widget package comment: " << m_zip->GetGlobalComment());
 
         // Widget package must not be empty
         if (m_zip->empty()) {
@@ -266,7 +266,7 @@ void WidgetUnzip::unzipWgtFile(const std::string &source, const std::string &des
         m_zip.reset();
 
         // Done
-        LogInfo("Unzip finished");
+        LogDebug("Unzip finished");
     }
     Catch(DPL::ZipInput::Exception::OpenFailed)
     {
index 70c6340..b5e978e 100644 (file)
@@ -103,7 +103,7 @@ JobWidgetUninstall::JobWidgetUninstall(
             m_context.installedPath =
                 DPL::Utils::Path(*dao.getWidgetInstalledPath());
 
-            LogInfo("Widget model exists. App id : " << m_context.tzAppid);
+            LogDebug("Widget model exists. App id : " << m_context.tzAppid);
 
             AddTask(new TaskSmack(m_context));
             AddTask(new TaskCheck(m_context));
index abe6fd2..49acac6 100644 (file)
@@ -93,11 +93,11 @@ void TaskCheck::StepUninstallPreCheck()
                 ThrowMsg(Exceptions::AppIsRunning,
                          "Widget is not stopped. Cannot uninstall!");
             }
-            LogInfo("terminate application");
+            LogDebug("terminate application");
         }
     }
 
-    LogInfo("Widget Can be uninstalled. Pkgname : " << m_context.tzAppid);
+    LogDebug("Widget Can be uninstalled. Pkgname : " << m_context.tzAppid);
     m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_PRECHECK,
                                   "Uninstall pre-checking Finished");
 }
index 9047aae..de9c15c 100644 (file)
@@ -78,7 +78,7 @@ void TaskDbUpdate::StepLiveboxDBDelete()
     if (ret < 0) {
         LogDebug("failed to delete box info");
     } else {
-        LogInfo("delete box info: " << m_context.tzAppid);
+        LogDebug("delete box info: " << m_context.tzAppid);
     }
 }
 } //namespace WidgetUninstall
index 911b1bd..2940e19 100644 (file)
@@ -56,7 +56,7 @@ TaskRemoveFiles::~TaskRemoveFiles()
 
 void TaskRemoveFiles::StepRemoveInstallationDirectory()
 {
-    LogInfo("StepRemoveInstallationDirectory started");
+    LogDebug("StepRemoveInstallationDirectory started");
     Try {
         int ret = app2ext_get_app_location(m_context.tzPkgid.c_str());
 
@@ -102,7 +102,7 @@ void TaskRemoveFiles::StepRemoveInstallationDirectory()
 
 void TaskRemoveFiles::StepRemoveFinished()
 {
-    LogInfo("StepRemoveFinished finished");
+    LogDebug("StepRemoveFinished finished");
 
     m_context.job->UpdateProgress(
         UninstallerContext::UNINSTALL_REMOVE_FINISHED,
index 4e7d467..084722e 100644 (file)
@@ -40,7 +40,7 @@ TaskSmack::TaskSmack(UninstallerContext& context) :
 
 void TaskSmack::Step()
 {
-    LogInfo(
+    LogDebug(
         "------------------------> SMACK: Jobs::WidgetUninstall::TaskSmack::Step()");
 #ifdef WRT_SMACK_ENABLED
     const char* pkgId = m_context.tzPkgid.c_str();
index 572b130..c476ab2 100644 (file)
@@ -49,7 +49,7 @@ TaskUninstallOspsvc::~TaskUninstallOspsvc()
 
 void TaskUninstallOspsvc::StepUninstallOspsvc()
 {
-    LogInfo("Step : Uninstall Osp service ");
+    LogDebug("Step : Uninstall Osp service ");
 
     std::ostringstream commStr;
     commStr << OSP_INSTALL_STR << BashUtils::escape_arg(m_context.tzPkgid);
@@ -84,7 +84,7 @@ void TaskUninstallOspsvc::StepUninstallOspsvc()
 
     pclose(fd);
 
-    LogInfo("Widget Can be uninstalled. Pkgname : " << m_context.tzPkgid);
+    LogDebug("Widget Can be uninstalled. Pkgname : " << m_context.tzPkgid);
     m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_REMOVE_OSPSVC,
                                   "Uninstall OSP service finished");
 }
index 6b3f06c..a151125 100644 (file)
@@ -171,7 +171,7 @@ bool InstallerLogic::NextStep(Jobs::Job *job)
         return false;
     } catch (Jobs::JobExceptionBase &exc) {
         //start revert job
-        LogInfo("Exception occured: " << exc.getParam() <<
+        LogDebug("Exception occured: " << exc.getParam() <<
                 ". Reverting job...");
         bool hasAbortSteps = job->Abort();
         job->SetUndoType(true);
index 6ae087e..7f928ef 100644 (file)
@@ -39,7 +39,7 @@ FeatureLogic::FeatureLogic(const WrtDB::TizenAppId & tzAppid) :
     WrtDB::WidgetDAOReadOnly widgetDao(tzAppid);
     WidgetFeatureSet featureSet = widgetDao.getFeaturesList();
     FOREACH(it, featureSet) {
-        LogInfo("Feature name : " << it->name);
+        LogDebug("Feature name : " << it->name);
         WrtDB::DeviceCapabilitySet dcs;
         if (!DPL::StringCompare(it->name, PRIVILEGE_TESTAUTOMATION)) {
             // special privilege
@@ -51,7 +51,7 @@ FeatureLogic::FeatureLogic(const WrtDB::TizenAppId & tzAppid) :
             dcs = WrtDB::GlobalDAOReadOnly::GetDeviceCapability(it->name);
         }
         FOREACH(devCap, dcs) {
-            LogInfo("--- dev cap  : " << *devCap);
+            LogDebug("--- dev cap  : " << *devCap);
         }
         Feature feature(*it, dcs);
         m_featureList.push_back(feature);
index 48f98d4..ceca1ba 100644 (file)
@@ -28,6 +28,7 @@
 #include <dlog.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <vcore/VCore.h>
+#include <vconf.h>
 #include <dpl/wrt-dao-ro/WrtDatabase.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <dpl/wrt-dao-ro/feature_dao_read_only.h>
@@ -386,22 +387,44 @@ int getWidgetDetailInfoFromPackage(const char* pkgPath,
 
     DPL::Optional<DPL::String> name;
     DPL::Optional<DPL::String> desc;
+
     DPL::OptionalString defaultLocale = configInfo.defaultlocale;
 
+    char* language = vconf_get_str(VCONFKEY_LANGSET);
+
+    DPL::String inLocaleString = DPL::FromUTF8String(language);
+    DPL::String locString = inLocaleString.substr(
+            0, inLocaleString.find_first_of(L"."));
+    std::replace(locString.begin(), locString.end(), '_', '-');
+
     FOREACH(localizedData, configInfo.localizedDataSet)
     {
         Locale i = localizedData->first;
+        std::transform( locString.begin(),
+                locString.end(),
+                locString.begin(),
+                ::tolower );
+        std::transform( i.begin(), i.end(), i.begin(), ::tolower );
+        std::size_t found = locString.find(i);
+        std::size_t found2 = i.find(locString);
+
         if (!!defaultLocale) {
             if (defaultLocale == i) {
                 name = localizedData->second.name;
                 desc = localizedData->second.description;
                 break;
             }
-        } else {
+        } else if (found != std::string::npos
+                || found2 != std::string::npos) {
             name = localizedData->second.name;
             desc = localizedData->second.description;
             break;
         }
+        else {
+            name = localizedData->second.name;
+            desc = localizedData->second.description;
+            continue;
+        }
     }
 
     if( !name.IsNull()) {
index 5f43314..4d34368 100644 (file)
@@ -36,7 +36,7 @@ PkgmgrSignal::~PkgmgrSignal()
 bool PkgmgrSignal::initialize(int argc, char* argv[])
 {
     if (m_handle) {
-        LogInfo("Release already allocated pkgmgr handle");
+        LogDebug("Release already allocated pkgmgr handle");
         pkgmgr_installer_free(m_handle);
         m_handle = NULL;
     }
@@ -61,6 +61,10 @@ bool PkgmgrSignal::initialize(int argc, char* argv[])
             m_handle = NULL;
             return false;
         }
+        const char *callerId = pkgmgr_installer_get_caller_pkgid(m_handle);
+        if(callerId)
+            m_callerId = callerId;
+
     } else {
         LogError("Fail to get information of pkgmgr's request");
         pkgmgr_installer_free(m_handle);
@@ -99,7 +103,7 @@ bool PkgmgrSignal::setPkgname(const std::string& name)
     }
 
     m_pkgname = name;
-    LogInfo("Success to set tizen package name: " << m_pkgname);
+    LogDebug("Success to set tizen package name: " << m_pkgname);
 
     return true;
 }
@@ -117,7 +121,7 @@ bool PkgmgrSignal::sendSignal(const std::string& key,
         return false;
     }
 
-    if (m_handle == NULL || m_type.empty() || m_pkgname.empty()) {
+    if (m_handle == NULL || m_type.empty()) {
         LogError("Some data of PkgmgrSignal is empty");
         return false;
     }
@@ -131,7 +135,7 @@ bool PkgmgrSignal::sendSignal(const std::string& key,
         return false;
     }
 
-    LogInfo("Success to send pkgmgr signal: " << key <<
+    LogDebug("Success to send pkgmgr signal: " << key <<
             " - " << value);
     return true;
 }
@@ -153,4 +157,13 @@ int PkgmgrSignal::getRequestedType() const
 
     return m_reqType;
 }
+
+std::string PkgmgrSignal::getCallerId() const
+{
+    if (!m_initialized) {
+        LogError("PkgmgrSingal not yet intialized");
+    }
+
+    return m_callerId;
+}
 } // PackageManager
index 2e7f7c9..410459e 100644 (file)
@@ -38,6 +38,7 @@ namespace PackageManager {
 #define PKGMGR_PROGRESS_KEY         "install_percent"
 #define PKGMGR_ICON_PATH            "icon_path"
 #define PKGMGR_ERROR                "error"
+#define PKGMGR_START_VALUE          "0"
 
 typedef pkgmgr_installer* PkgmgrHandle;
 
@@ -50,6 +51,7 @@ class PkgmgrSignal : public IPkgmgrSignal
     bool sendSignal(const std::string& key, const std::string& value) const;
     std::string getPkgname() const;
     int getRequestedType() const;
+    std::string getCallerId() const;
 
     PkgmgrSignal();
     virtual ~PkgmgrSignal();
@@ -60,6 +62,7 @@ class PkgmgrSignal : public IPkgmgrSignal
     std::string m_type;
     std::string m_pkgname;
     int m_reqType;
+    std::string m_callerId;
 };
 } // PackageManager
 
index 4c1b3e4..26668d1 100644 (file)
@@ -47,6 +47,11 @@ class PkgmgrSignalDummy : public IPkgmgrSignal
     {
         return "";
     }
+
+    std::string getCallerId() const
+    {
+        return "";
+    }
 };
 } // PkgmgrSignalDummy
 
index 1f3946d..b94917d 100644 (file)
@@ -31,6 +31,7 @@ class IPkgmgrSignal
     virtual bool sendSignal(const std::string& key,
                             const std::string& value) const = 0;
     virtual std::string getPkgname() const = 0;
+    virtual std::string getCallerId() const = 0;
     virtual ~IPkgmgrSignal(){}
 };
 } // IPkgmgrSignal
index 3b94562..0bd83bb 100644 (file)
@@ -31,7 +31,7 @@ SET(WRT_INSTALLER_SOURCES
     ${WRT_INSTALLER_DIR}/wrt_installer_api.cpp
     ${WRT_INSTALLER_DIR}/installer_callbacks_translate.cpp
     ${WRT_INSTALLER_DIR}/plugin_utils.cpp
-    ${WRT_INSTALLER_DIR}/language_subtag_rst_tree.cpp
+#    ${WRT_INSTALLER_DIR}/language_subtag_rst_tree.cpp
     ${WRT_INSTALLER_DIR}/installer_main_thread.cpp
     ${WRT_INSTALLER_DIR}/option_parser.cpp
     ${PKG_MANAGER_DIR}/pkgmgr_signal.cpp
@@ -43,6 +43,7 @@ PKG_CHECK_MODULES(WRT_INSTALLER_DEPS
     pkgmgr-info
     pkgmgr
     security-install
+    wrt-commons-i18n-dao-ro
     REQUIRED)
 
 INCLUDE_DIRECTORIES(
index fa1c9f2..5e415d2 100644 (file)
@@ -162,7 +162,7 @@ void installFinishedCallback(void *userParam,
         // Callback
         apiStr->status_callback(tizenId, errorStatus, apiStr->userdata);
     } else {
-        LogInfo("installFinishedCallback: No callback");
+        LogDebug("installFinishedCallback: No callback");
     }
 }
 
@@ -201,7 +201,7 @@ void uninstallFinishedCallback(void *userParam,
         // Callback
         apiStr->status_callback(tizenId, errorStatus, apiStr->userdata);
     } else {
-        LogInfo("uninstallFinishedCallback: No callback");
+        LogDebug("uninstallFinishedCallback: No callback");
     }
 }
 
@@ -231,7 +231,7 @@ void pluginInstallFinishedCallback(void *userParam,
 
         apiStr->statusCallback(errorStatus, apiStr->userdata);
     } else {
-        LogInfo("PluginInstallFinishedCallback: No callback");
+        LogDebug("PluginInstallFinishedCallback: No callback");
     }
 
     delete apiStr;
@@ -249,12 +249,12 @@ void installProgressCallback(void *userParam,
 
     if (apiStr->progress_callback) {
         //CALLBACK EXEC
-        LogInfo("Entered " << percent << "% " << description);
+        LogDebug("Entered " << percent << "% " << description);
         apiStr->progress_callback(static_cast<float>(percent),
                                   description.c_str(),
                                   apiStr->userdata);
     } else {
-        LogInfo("installProgressCallback: ignoring NULL callback pointer");
+        LogDebug("installProgressCallback: ignoring NULL callback pointer");
     }
 }
 } //namespace
index 8bf901f..291c67d 100644 (file)
 #include <dpl/log/log.h>
 #include <dpl/db/orm.h>
 #include <dpl/string.h>
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
+#include <dpl/scope_guard.h>
+#include <wrt-commons/i18n-dao-ro/i18n_dao_read_only.h>
+#include <wrt-commons/i18n-dao-ro/i18n_database.h>
 #include <iterator>
 #include <vector>
 #include <ctype.h>
 #include <dpl/singleton_impl.h>
 IMPLEMENT_SINGLETON(LanguageSubtagRstTree)
 
+namespace I18nDAOReadOnly = I18n::DB::I18nDAOReadOnly;
+
 bool LanguageSubtagRstTree::ValidateLanguageTag(const std::string &tag_input)
 {
     std::string tag = tag_input;
@@ -40,57 +44,82 @@ bool LanguageSubtagRstTree::ValidateLanguageTag(const std::string &tag_input)
                   std::back_inserter(parts),
                   false);
     std::vector<DPL::String>::iterator token = parts.begin();
-    if (token == parts.end()) {
+    if (token == parts.end())
+    {
         return false;
     }
-    if (WrtDB::GlobalDAOReadOnly::IsValidSubTag(*token,
-                                                RECORD_TYPE_LANGUAGE))
+
+    I18n::DB::Interface::attachDatabaseRO();
+    DPL_SCOPE_EXIT()
+    {
+        I18n::DB::Interface::detachDatabase();
+    };
+
+    if (I18nDAOReadOnly::IsValidSubTag(*token, RECORD_TYPE_LANGUAGE))
     {
         ++token;
-    } else {
+    }
+    else
+    {
         return false;
     }
 
-    if (token == parts.end()) {
+    if (token == parts.end())
+    {
         return true;
     }
-    if (WrtDB::GlobalDAOReadOnly::IsValidSubTag(*token, RECORD_TYPE_EXTLANG)) {
+
+    if (I18nDAOReadOnly::IsValidSubTag(*token, RECORD_TYPE_EXTLANG))
+    {
         ++token;
     }
 
-    if (token == parts.end()) {
+    if (token == parts.end())
+    {
         return true;
     }
-    if (WrtDB::GlobalDAOReadOnly::IsValidSubTag(*token, RECORD_TYPE_SCRIPT)) {
+
+    if (I18nDAOReadOnly::IsValidSubTag(*token, RECORD_TYPE_SCRIPT))
+    {
         ++token;
     }
 
-    if (token == parts.end()) {
+    if (token == parts.end())
+    {
         return true;
     }
-    if (WrtDB::GlobalDAOReadOnly::IsValidSubTag(*token, RECORD_TYPE_REGION)) {
+
+    if (I18nDAOReadOnly::IsValidSubTag(*token, RECORD_TYPE_REGION))
+    {
         ++token;
     }
 
-    if (token == parts.end()) {
+    if (token == parts.end())
+    {
         return true;
     }
-    while (token != parts.end()) {
-        if (WrtDB::GlobalDAOReadOnly::IsValidSubTag(
-                *token, RECORD_TYPE_VARIANT))
+
+    while (token != parts.end())
+    {
+        if (I18nDAOReadOnly::IsValidSubTag(*token, RECORD_TYPE_VARIANT))
         {
             ++token;
-        } else {
+        }
+        else
+        {
             break;
         }
     }
 
     //'u' - unicode extension - only one BCP47 extension is registered.
     //TODO: unicode extension should be also validated (l.wrzosek)
-    if (token == parts.end()) {
+    if (token == parts.end())
+    {
         return true;
     }
-    if (*token == L"u") {
+
+    if (*token == L"u")
+    {
         ++token;
         bool one_or_more = false;
         while (token != parts.end() &&
@@ -100,16 +129,20 @@ bool LanguageSubtagRstTree::ValidateLanguageTag(const std::string &tag_input)
             one_or_more = true;
             ++token;
         }
-        if (!one_or_more) {
+        if (!one_or_more)
+        {
             return false;
         }
     }
 
     //'x' - privateuse
-    if (token == parts.end()) {
+    if (token == parts.end())
+    {
         return true;
     }
-    if (*token == L"x") {
+
+    if (*token == L"x")
+    {
         ++token;
         bool one_or_more = false;
         while (token != parts.end() &&
@@ -119,18 +152,21 @@ bool LanguageSubtagRstTree::ValidateLanguageTag(const std::string &tag_input)
             one_or_more = true;
             ++token;
         }
-        if (!one_or_more) {
+        if (!one_or_more)
+        {
             return false;
         }
     }
 
-    if (token == parts.end()) {
+    if (token == parts.end())
+    {
         return true;
     }
 
     //Try private use now:
     token = parts.begin();
-    if (*token == L"x") {
+    if (*token == L"x")
+    {
         ++token;
         bool one_or_more = false;
         while (token != parts.end() &&
index 5368f3f..657f8dc 100644 (file)
@@ -43,7 +43,7 @@ bool lockPluginInstallation(bool isPreload)
 
     int ret = 0;
 
-    LogInfo("Try to lock for plugins installation.");
+    LogDebug("Try to lock for plugins installation.");
 
     s_plugin_install_lock_fd =
         open(PLUGIN_INSTALL_LOCK_FILE, O_RDONLY | O_CREAT, 0666);
@@ -70,7 +70,7 @@ bool lockPluginInstallation(bool isPreload)
 
 bool unlockPluginInstallation(bool isPreload)
 {
-    LogInfo("Unlock for plugins installation.");
+    LogDebug("Unlock for plugins installation.");
     if (isPreload) {
         fprintf(stderr, "Skip plugin unlock.. \n");
         return true;
index 13ddfe8..4221367 100644 (file)
@@ -46,7 +46,7 @@
 #include <parser_runner.h>
 #include <widget_parser.h>
 #include <root_parser.h>
-#include <package-manager.h>
+#include <pkgmgr-info.h>
 
 #include <Elementary.h>
 
@@ -111,21 +111,13 @@ int WrtInstaller::getReturnStatus() const
 
 void WrtInstaller::OnStop()
 {
-    LogInfo("Stopping Dummy Client");
+    LogDebug("Stopping Dummy Client");
 }
 
 void WrtInstaller::OnCreate()
 {
-    LogInfo("Creating DummyClient");
-    fprintf(stderr,
-            "===========================================================\n");
-    fprintf(stderr, "# wrt-installer #\n");
-    fprintf(stderr, "# argc [%d]\n", m_argc);
-    fprintf(stderr, "# argv[0] = [%s]\n", m_argv[0]);
-    fprintf(stderr, "# argv[1] = [%s]\n", m_argv[1]);
-    fprintf(stderr, "# argv[2] = [%s]\n", m_argv[2]);
-    fprintf(stderr,
-            "===========================================================\n");
+    LogDebug("Creating DummyClient");
+    showArguments();
 
     AddStep(&WrtInstaller::initStep);
 
@@ -165,7 +157,7 @@ void WrtInstaller::OnCreate()
             if (!m_startupPluginInstallation) {
                 AddStep(&WrtInstaller::installPluginsStep);
             } else {
-                LogInfo("Plugin installation alredy started");
+                LogDebug("Plugin installation alredy started");
             }
         } else if (arg == "-i" || arg == "--install") {
             if (m_argc != 3) {
@@ -174,10 +166,10 @@ void WrtInstaller::OnCreate()
 
             struct stat info;
             if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) {
-                LogInfo("Installing package directly from directory");
+                LogDebug("Installing package directly from directory");
                 m_installMode.extension = InstallMode::ExtensionType::DIR;
             } else {
-                LogInfo("Installing from regular location");
+                LogDebug("Installing from regular location");
                 m_installMode.extension = InstallMode::ExtensionType::WGT;
             }
             m_packagePath = m_argv[2];
@@ -269,7 +261,7 @@ void WrtInstaller::OnCreate()
             if (m_argc != 3) {
                 return showHelpAndQuit();
             }
-            LogInfo("Installing package directly from directory");
+            LogDebug("Installing package directly from directory");
             m_installMode.command = InstallMode::Command::REINSTALL;
             m_installMode.extension = InstallMode::ExtensionType::DIR;
             m_packagePath = m_argv[2];
@@ -297,18 +289,41 @@ void WrtInstaller::OnCreate()
             m_packagePath = m_argv[4];
             struct stat info;
             if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
-                LogInfo("Installing package directly from directory");
+                LogDebug("Installing package directly from directory");
                 m_installMode.extension = InstallMode::ExtensionType::DIR;
             } else {
-                LogInfo("Installing from regular location");
+                LogDebug("Installing from regular location");
                 m_installMode.extension = InstallMode::ExtensionType::WGT;
             }
             AddStep(&WrtInstaller::installStep);
             break;
         case PKGMGR_REQ_UNINSTALL:
-            m_name = m_argv[4];
-            AddStep(&WrtInstaller::uninstallPkgNameStep);
-            break;
+            {
+                m_name = m_argv[4];
+                pkgmgrinfo_pkginfo_h handle = NULL;
+                bool system_app = false; // system app is preloaded and unremovable.
+                bool update = false;
+
+                if (0 == pkgmgrinfo_pkginfo_get_pkginfo(m_name.c_str(), &handle)) {
+                    if (0 > pkgmgrinfo_pkginfo_is_system(handle, &system_app)) {
+                        LogError("Can't get package information : " << m_name);
+                    }
+                    if (0 > pkgmgrinfo_pkginfo_is_update(handle, &update)) {
+                        LogError("Can't get package information about update : "
+                                << m_name);
+                    }
+                }
+
+                LogDebug("system app : " << system_app);
+                LogDebug("update : " << update);
+
+                if (system_app && update) {
+                    AddStep(&WrtInstaller::removeUpdateStep);
+                } else {
+                    AddStep(&WrtInstaller::uninstallPkgNameStep);
+                }
+                break;
+            }
         case PKGMGR_REQ_REINSTALL:
             m_packagePath = m_argv[4];
             m_installMode.command = InstallMode::Command::REINSTALL;
@@ -369,6 +384,28 @@ void WrtInstaller::showHelpAndQuit()
     Quit();
 }
 
+void WrtInstaller::showArguments()
+{
+    fprintf(stderr,
+            "===========================================================\n");
+    fprintf(stderr, "# wrt-installer #\n");
+    fprintf(stderr, "# argc [%d]\n", m_argc);
+    for (int i = 0; i < m_argc; i++) {
+        fprintf(stderr, "# argv[%d] = [%s]\n", i, m_argv[i]);
+    }
+    fprintf(stderr,
+            "===========================================================\n");
+    // for dlog
+    LogDebug("===========================================================");
+    LogDebug("# wrt-installer #");
+    LogDebug("# argc " <<  m_argc);
+    for (int i = 0; i < m_argc; i++) {
+        LogDebug("# argv[" << i << "] = " << m_argv[i]);
+    }
+    LogDebug("===========================================================");
+
+}
+
 void WrtInstaller::OnEventReceived(const WRTInstallerNS::QuitEvent& /*event*/)
 {
     LogDebug("Quiting");
@@ -436,7 +473,7 @@ void WrtInstaller::installPluginsStep()
     fprintf(stderr, "Installing plugins ...\n");
 
     if (m_startupPluginInstallation) {
-        LogInfo("Plugin installation started because new plugin package found");
+        LogDebug("Plugin installation started because new plugin package found");
     } else if (!PluginUtils::lockPluginInstallation(
         m_installMode.installTime == InstallMode::InstallTime::PRELOAD))
     {
@@ -456,7 +493,7 @@ void WrtInstaller::installPluginsStep()
         return;
     }
 
-    LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
+    LogDebug("Plugin DIRECTORY IS" << PLUGIN_PATH);
 
     std::list<std::string> pluginsPaths;
     struct dirent libdir;
@@ -499,7 +536,7 @@ void WrtInstaller::installPluginsStep()
     //set nb of plugins to install
     //this value indicate how many callbacks are expected
     m_numPluginsToInstall = pluginsPaths.size();
-    LogInfo("Plugins to install: " << m_numPluginsToInstall);
+    LogDebug("Plugins to install: " << m_numPluginsToInstall);
     m_pluginsPaths = pluginsPaths;
 
     m_totalPlugins = m_numPluginsToInstall;
@@ -516,30 +553,25 @@ void WrtInstaller::uninstallPkgNameStep()
 {
     LogDebug("Uninstalling widget ...");
     LogDebug("Package name : " << m_name);
-    pkgmgr_pkginfo_h handle;
-    int ret = -1;
-    bool preload = false;
 
-    if (0 == pkgmgr_pkginfo_get_pkginfo(m_name.c_str(), &handle)) {
-        if (pkgmgr_pkginfo_is_preload(handle, &preload) < 0) {
-            LogError("Can't get package information : " << m_name);
-        }
-    }
+    wrt_uninstall_widget(m_name.c_str(), this,
+            &staticWrtStatusCallback,
+            (m_installByPkgmgr)
+            ? &staticWrtUninstallProgressCallback : NULL,
+            pkgmgrSignalInterface);
+}
+
+void WrtInstaller::removeUpdateStep()
+{
+    LogDebug("This web app need to initialize preload app");
+    LogDebug("Package name : " << m_name);
+
+    wrt_uninstall_widget(m_name.c_str(), this,
+            &staticWrtInitializeToPreloadCallback,
+            (m_installByPkgmgr)
+            ? &staticWrtUninstallProgressCallback : NULL,
+            pkgmgrSignalInterface);
 
-    if (preload) {
-        LogDebug("This web app need to initialize preload app");
-        wrt_uninstall_widget(m_name.c_str(), this,
-                &staticWrtInitializeToPreloadCallback,
-                (m_installByPkgmgr)
-                ? &staticWrtUninstallProgressCallback : NULL,
-                pkgmgrSignalInterface);
-    } else {
-        wrt_uninstall_widget(m_name.c_str(), this,
-                &staticWrtStatusCallback,
-                (m_installByPkgmgr)
-                ? &staticWrtUninstallProgressCallback : NULL,
-                pkgmgrSignalInterface);
-    }
 }
 
 void WrtInstaller::unistallWgtFileStep()
@@ -976,14 +1008,14 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
 
         //remove installation request
         if (!PluginUtils::removeInstallationRequiredFlag()) {
-            LogInfo("Failed to remove file initializing plugin installation");
+            LogDebug("Failed to remove file initializing plugin installation");
         }
 
         //remove lock file
         if (!PluginUtils::unlockPluginInstallation(
             This->m_installMode.installTime == InstallMode::InstallTime::PRELOAD))
         {
-            LogInfo("Failed to remove installation lock");
+            LogDebug("Failed to remove installation lock");
         }
 
         This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
@@ -1029,7 +1061,7 @@ void WrtInstaller::staticWrtPluginInstallProgressCb(float percent,
 
     std::string path = std::string(data->pluginPath);
 
-    LogInfo("Plugin Installation: " << path <<
+    LogDebug("Plugin Installation: " << path <<
             " progress: " << percent <<
             "description " << description);
 }
@@ -1039,7 +1071,7 @@ void WrtInstaller::staticWrtInstallProgressCallback(float percent,
                                                     void* /*userdata*/)
 {
     //WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
-    LogInfo(" progress: " << percent <<
+    LogDebug(" progress: " << percent <<
             " description: " << description);
 }
 void WrtInstaller::staticWrtUninstallProgressCallback(float percent,
@@ -1047,7 +1079,7 @@ void WrtInstaller::staticWrtUninstallProgressCallback(float percent,
                                                       void* /*userdata*/)
 {
     //WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
-    LogInfo(" progress: " << percent <<
+    LogDebug(" progress: " << percent <<
             " description: " << description);
 }
 
@@ -1078,7 +1110,7 @@ void WrtInstaller::installNewPlugins()
     if (!PluginUtils::lockPluginInstallation(
         m_installMode.installTime == InstallMode::InstallTime::PRELOAD))
     {
-        LogInfo("Lock NOT created");
+        LogDebug("Lock NOT created");
         return;
     }
 
@@ -1127,6 +1159,8 @@ int main(int argc, char *argv[])
 {
     UNHANDLED_EXCEPTION_HANDLER_BEGIN
     {
+        DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_INSTALLER");
+
         // Output on stdout will be flushed after every newline character,
         // even if it is redirected to a pipe. This is useful for running
         // from a script and parsing output.
@@ -1152,15 +1186,6 @@ int main(int argc, char *argv[])
             LogError("getrlimit is fail!!");
         }
 
-        // set evas backend type for emulator
-        // popup isn't showed in the emulator,
-        // if backend isn't set to SW backend
-        if (GlobalSettings::IsEmulator()) {
-            if (setenv("ELM_ENGINE", "x11", 1)) {
-                LogDebug("Enable backend");
-            }
-        }
-
         WrtInstaller app(argc, argv);
         int ret = app.Exec();
         LogDebug("App returned: " << ret);
index 4405a07..94d515d 100644 (file)
@@ -81,6 +81,7 @@ class WrtInstaller :
 
   private:
     void         showHelpAndQuit();
+    void         showArguments();
 
     // Events
     virtual void OnEventReceived(const WRTInstallerNS::QuitEvent &event);
@@ -94,6 +95,7 @@ class WrtInstaller :
     void installPluginsStep();
     void uninstallPkgNameStep();
     void unistallWgtFileStep();
+    void removeUpdateStep();
     void shutdownStep();
 
     // Static callbacks
@@ -129,7 +131,6 @@ class WrtInstaller :
                                         void* userdata);
 
     void installNewPlugins();
-    bool popupsEnabled() const;
     CSCConfiguration::dataMap parseCSCConfiguration(std::string str);
     void showErrorMsg(WrtErrStatus status, std::string tizenId, std::string
             printMsg);
index ff19de7..76ca44b 100644 (file)
@@ -83,12 +83,9 @@ static bool checkPaths()
 void wrt_installer_init(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__);
+        LogDebug("[WRT-API] INITIALIZING WRT INSTALLER...");
+        LogDebug("[WRT-API] BUILD: " << __TIMESTAMP__);
 
         // Touch InstallerController Singleton
         InstallerMainThreadSingleton::Instance().TouchArchitecture();
@@ -109,11 +106,11 @@ void wrt_installer_init(void *userdata,
 
         InstallerMainThreadSingleton::Instance().AttachDatabases();
 
-        LogInfo("Prepare libxml2 to work in multithreaded program.");
+        LogDebug("Prepare libxml2 to work in multithreaded program.");
         xmlInitParser();
 
-        // Initialize Language Subtag registry
-        LanguageSubtagRstTreeSingleton::Instance().Initialize();
+//        // Initialize Language Subtag registry
+//        LanguageSubtagRstTreeSingleton::Instance().Initialize();
 
         // Installer init
         CONTROLLER_POST_SYNC_EVENT(
@@ -122,7 +119,7 @@ void wrt_installer_init(void *userdata,
                 InitializeEvent());
 
         if (callback) {
-            LogInfo("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK");
+            LogDebug("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK");
             callback(WRT_SUCCESS, userdata);
         }
     } catch (const DPL::Exception& ex) {
@@ -139,7 +136,7 @@ void wrt_installer_init(void *userdata,
 void wrt_installer_shutdown()
 {
     try {
-        LogInfo("[WRT-API] DEINITIALIZING WRT INSTALLER...");
+        LogDebug("[WRT-API] DEINITIALIZING WRT INSTALLER...");
 
         // Installer termination
         CONTROLLER_POST_SYNC_EVENT(
@@ -153,7 +150,7 @@ void wrt_installer_shutdown()
         ValidationCore::VCoreDeinit();
 
         // Global deinit check
-        LogInfo("Cleanup libxml2 global values.");
+        LogDebug("Cleanup libxml2 global values.");
         xmlCleanupParser();
     } catch (const DPL::Exception& ex) {
         LogError("Internal Error during Shutdown:");
@@ -180,7 +177,7 @@ void wrt_install_widget(
             DPL::Log::LogSystemSingleton::Instance().AddProvider(oldStyleProvider);
         }
 
-        LogInfo("[WRT-API] INSTALL WIDGET: " << path);
+        LogDebug("[WRT-API] INSTALL WIDGET: " << path);
         // Post installation event
         CONTROLLER_POST_EVENT(
             Logic::InstallerController,
@@ -207,7 +204,7 @@ void wrt_uninstall_widget(
     UNHANDLED_EXCEPTION_HANDLER_BEGIN
     {
         std::string tizenAppid(tzAppid);
-        LogInfo("[WRT-API] UNINSTALL WIDGET: " << tizenAppid);
+        LogDebug("[WRT-API] UNINSTALL WIDGET: " << tizenAppid);
         // Post uninstallation event
         CONTROLLER_POST_EVENT(
             Logic::InstallerController,
@@ -234,7 +231,7 @@ void wrt_install_plugin(
 {
     UNHANDLED_EXCEPTION_HANDLER_BEGIN
     {
-        LogInfo("[WRT-API] INSTALL PLUGIN: " << pluginDir);
+        LogDebug("[WRT-API] INSTALL PLUGIN: " << pluginDir);
         //Private data for status callback
         //Resource is free in pluginInstallFinishedCallback
         InstallerCallbacksTranslate::PluginStatusCallbackStruct*
index 74272b1..376170b 100644 (file)
@@ -59,6 +59,13 @@ INCLUDE_DIRECTORIES(${COMMON_LIB_PKGS_INCLUDE_DIRS})
 
 ADD_LIBRARY(${WRT_TEST_LIBRARY} STATIC ${WRT_DETAIL_SOURCES})
 
+
+SET(INSTALLER_TESTS_TARGET "wrt-installer-tests-general")
+
+PKG_CHECK_MODULES(INSTALLER_TESTS_DEPS
+    wrt-commons-i18n-dao-ro
+    REQUIRED)
+
 SET(INSTALLER_TESTS_SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/TestInit.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/ManifestTests.cpp
@@ -68,16 +75,18 @@ SET(INSTALLER_TESTS_SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/ParsingTizenAppcontrolTests.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/WidgetUpdateTests.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/PluginsInstallation.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/LanguageSubtagRstTreeTests.cpp
+    ${CMAKE_SOURCE_DIR}/src/wrt-installer/language_subtag_rst_tree.cpp
 )
 
-SET(INSTALLER_TESTS_TARGET "wrt-installer-tests-general")
+SET(INSTALLER_TESTS_INCLUDE_DIRS
+    ${INSTALLER_TESTS_DEPS_INCLUDE_DIRS}
+    ${CMAKE_SOURCE_DIR}/src/wrt-installer
+)
 
 # Functions used to build test targets (proper sources, includes, libs are
 # added automatically)
 FUNCTION(WRT_TEST_BUILD TARGET_NAME)
-    SET(SOURCES "${ARGN}")
-    ADD_EXECUTABLE("${TARGET_NAME}" ${SOURCES})
-
     # get include dirs global property
     GET_PROPERTY(INCLUDE_DIRS GLOBAL PROPERTY TESTS_INCLUDE_DIRS)
     GET_PROPERTY(TEST_INCLUDE_DIRS GLOBAL PROPERTY ${TARGET_NAME}_INCLUDE_DIRS)
@@ -94,6 +103,9 @@ FUNCTION(WRT_TEST_BUILD TARGET_NAME)
         ${TEST_LIBRARY_DIRS}
     )
 
+    SET(SOURCES "${ARGN}")
+    ADD_EXECUTABLE("${TARGET_NAME}" ${SOURCES})
+
     # get link libraries global property
     GET_PROPERTY(LINK_LIBRARIES GLOBAL PROPERTY TESTS_LIBRARIES)
     GET_PROPERTY(TEST_LIBRARIES GLOBAL PROPERTY ${TARGET_NAME}_LIBRARIES)
@@ -120,6 +132,11 @@ FUNCTION(WRT_TEST_INSTALL)
     )
 ENDFUNCTION(WRT_TEST_INSTALL)
 
+FUNCTION(WRT_TEST_INCLUDE_DIRS TARGET_NAME)
+    SET_PROPERTY(GLOBAL APPEND PROPERTY ${TARGET_NAME}_INCLUDE_DIRS ${ARGN})
+ENDFUNCTION(WRT_TEST_INCLUDE_DIRS)
+
+WRT_TEST_INCLUDE_DIRS(${INSTALLER_TESTS_TARGET} ${INSTALLER_TESTS_INCLUDE_DIRS})
 WRT_TEST_BUILD(${INSTALLER_TESTS_TARGET} ${INSTALLER_TESTS_SOURCES})
 WRT_TEST_INSTALL(${INSTALLER_TESTS_TARGET})
 target_link_libraries(${INSTALLER_TESTS_TARGET}
@@ -128,6 +145,7 @@ target_link_libraries(${INSTALLER_TESTS_TARGET}
   ${WRT_TEST_LIBRARY}
   ${TARGET_CORE_MODULE_LIB}
   ${COMMON_LIB_PKGS_LIBRARIES}
+  ${INSTALLER_TESTS_DEPS_LIBRARIES}
 )
 
 #widgets
diff --git a/tests/general/LanguageSubtagRstTreeTests.cpp b/tests/general/LanguageSubtagRstTreeTests.cpp
new file mode 100644 (file)
index 0000000..bd05f87
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/**
+ * @file    LanguageSubtagRstTreeTests.cpp
+ * @author  Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief   Language tags tests
+ */
+
+#include <dpl/test/test_runner.h>
+#include <language_subtag_rst_tree.h>
+
+namespace {
+const char LANGUAGE_TAG_VALID[] = "en-us";
+const char LANGUAGE_TAG_INVALID[] = "invalid0";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+RUNNER_TEST_GROUP_INIT(LanguageSubtagRstTree)
+
+/*
+Name: ValidateLanguageTag_Valid
+Description: tests result returned for valid language tag
+Expected: value true should be returned
+*/
+RUNNER_TEST(ValidateLanguageTag_Valid)
+{
+  RUNNER_ASSERT(LanguageSubtagRstTreeSingleton::Instance().
+          ValidateLanguageTag(LANGUAGE_TAG_VALID));
+}
+
+/*
+Name: ValidateLanguageTag_Invalid
+Description: tests result returned for invalid language tag
+Expected: value false should be returned
+*/
+RUNNER_TEST(ValidateLanguageTag_Invalid)
+{
+  RUNNER_ASSERT(!LanguageSubtagRstTreeSingleton::Instance().
+          ValidateLanguageTag(LANGUAGE_TAG_INVALID));
+}
index 62e30a4..4e4e635 100644 (file)
@@ -26,7 +26,7 @@
 
 int main (int argc, char *argv[])
 {
-    LogInfo("Starting tests");
+    LogDebug("Starting tests");
 
     WrtDB::WrtDatabase::attachToThreadRW();
     int status =