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")
</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,}"/>
<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>
#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
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)
${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
${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
#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>
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;
}
virtual void Accept(const Text& text)
{
- if (m_properNamespace) {
+ if (m_properNamespace)
+ {
m_origin = text.value;
}
}
virtual void Verify()
{
+ if (m_data.allowNavigationEncountered || !m_properNamespace)
+ {
+ return;
+ }
+ m_data.allowNavigationEncountered = true;
+
if (m_origin.IsNull()) {
LogWarning("data is empty");
return;
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;
//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 <<
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
Jobs::Exceptions::ErrorPluginInstallationFailed);
- LogInfo("Installation: " << getFilePath() <<
+ LogDebug("Installation: " << getFilePath() <<
" NOT possible");
}
}
void PluginInstallTask::stepCheckPluginPath()
{
- LogInfo("Plugin installation: step CheckPluginPath");
+ LogDebug("Plugin installation: step CheckPluginPath");
if(!m_context->pluginFilePath.Exists()){
ThrowMsg(Exceptions::PluginPathFailed,
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();
return;
}
- LogInfo("Plugin Config file::" << filename.Filename());
+ LogDebug("Plugin Config file::" << filename.Filename());
Try
{
void PluginInstallTask::stepLoadPluginLibrary()
{
- LogInfo("Plugin installation: step load library");
+ LogDebug("Plugin installation: step load library");
DISABLE_IF_PLUGIN_WITHOUT_LIB()
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);
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());
void PluginInstallTask::stepRegisterFeatures()
{
- LogInfo("Plugin installation: step register features");
+ LogDebug("Plugin installation: step register features");
FOREACH(it, m_pluginInfo.m_featureContainer)
{
void PluginInstallTask::stepRegisterPluginObjects()
{
- LogInfo("Plugin installation: step register objects");
+ LogDebug("Plugin installation: step register objects");
DISABLE_IF_PLUGIN_WITHOUT_LIB()
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()) {
#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>
if (fileLen < extLen) {
LogError("Filename " << filename << " is shorter than extension "
<< extension);
- return false;
+ false;
}
return (0 == filename.compare(fileLen - extLen, extLen, extension));
}
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));
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 ==
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 ==
}
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));
{
ConfigureResult result;
m_needEncryption = false;
-
Try
{
std::string tempDir;
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);
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);
}
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,
m_installerContext.locations->registerAppid(
DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
- LogInfo("widgetSource " << widgetPath);
+ LogDebug("widgetSource " << widgetPath);
}
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(
bool JobWidgetInstall::validateTizenApplicationID(
const WrtDB::TizenAppId &tizenAppId)
{
- LogInfo("tizen application ID = [" << tizenAppId << "]");
+ LogDebug("tizen application ID = [" << tizenAppId << "]");
regex_t reg;
if (regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
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;
LogError("Fail to terminate running application");
return ConfigureResult::Failed_WidgetRunning;
}
- LogInfo("terminate application");
+ LogDebug("terminate application");
}
}
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()) {
out << std::endl;
- LogInfo(out.str());
+ LogDebug(out.str());
}
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;
}
{
AppType widgetAppType = APP_TYPE_UNKNOWN;
FOREACH(iterator, configInfo.nameSpaces) {
- LogInfo("namespace = [" << *iterator << "]");
+ LogDebug("namespace = [" << *iterator << "]");
if (*iterator == ConfigurationNamespace::TizenWebAppNamespaceName) {
if (widgetAppType != APP_TYPE_UNKNOWN &&
m_installerContext.widgetConfig.webAppType = widgetAppType;
- LogInfo("type = [" <<
+ LogDebug("type = [" <<
m_installerContext.widgetConfig.webAppType.getApptypeToString() <<
"]");
}
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)
{
{
this->version = x;
}
+ void setStoreClientId(const NcnameType &x)
+ {
+ this->storeClientId= x;
+ }
private:
std::list<LabelType> label;
NmtokenType version;
std::list<Account> account;
PrivilegeType privileges;
+ NcnameType storeClientId;
};
} //namespace Jobs
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;
}
}
- 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));
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);
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(
"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) {
dao.updateFeatureRejectStatus(*it);
}
}
- LogInfo("Installation continues...");
+ LogDebug("Installation continues...");
m_context.job->UpdateProgress(
InstallerContext::INSTALL_ACE_CHECK,
{
LogDebug("Set CertiInfo to pkgmgr : " << source);
CertificateChainList certificateChainList;
- m_context.wacSecurity.getCertificateChainList(certificateChainList, source);
+ m_context.widgetSecurity.getCertificateChainList(certificateChainList, source);
FOREACH(it, certificateChainList)
{
{
// 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());
"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));
}
}
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
"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;
}
}
void TaskCertify::stepSignature()
{
- LogInfo("================ Step: <<Signature>> ENTER ===============");
+ LogDebug("================ Step: <<Signature>> ENTER ===============");
std::string widgetPath;
widgetPath = m_contextData.locations->getTemporaryPackageDir() + "/";
}
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());
}
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,
void TaskCertify::stepFinalize()
{
- LogInfo("Step: <<CERTYFYING DONE>>");
+ LogDebug("Step: <<CERTYFYING DONE>>");
m_contextData.job->UpdateProgress(
InstallerContext::INSTALL_CERT_CHECK,
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);
--- /dev/null
+/*
+ * 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
+
--- /dev/null
+/*
+ * 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
std::string createTempPath(bool preload)
{
- LogInfo("Step: Creating temporary path");
+ LogDebug("Step: Creating temporary path");
// Temporary path
std::ostringstream tempPathBuilder;
time(&m_context.widgetConfig.installedTime);
if (m_context.isUpdateMode) { //update
- LogInfo("Registering widget... (update)");
+ LogDebug("Registering widget... (update)");
Try
{
m_handleToRemove = WidgetDAOReadOnly::getHandle(
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)
{
}
if (!AceApi::registerAceWidget(m_handle, m_context.widgetConfig,
- m_context.wacSecurity.getCertificateList()))
+ m_context.widgetSecurity.getCertificateList()))
{
LogError("ace database insert failed");
ThrowMsg(Exceptions::UpdateFailed,
} 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(),
"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(),
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(
}
#else
//default widget
- LogInfo("link -s " << clientExeStr << " " << exec);
+ LogDebug("link -s " << clientExeStr << " " << exec);
errno = 0;
if (symlink(clientExeStr.c_str(), exec.c_str()) != 0)
{
void TaskManifestFile::backupIconFiles()
{
- LogInfo("Backup Icon Files");
+ LogDebug("Backup Icon Files");
std::ostringstream b_icon_dir;
b_icon_dir << backup_dir.str() << "icons";
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);
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)
m_context.widgetConfig.configInfo.appControlList;
if (appControlList.empty()) {
- LogInfo("Widget doesn't contain app control");
+ LogDebug("Widget doesn't contain app control");
return;
}
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) {
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) {
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;
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;
AccountProviderType provider;
if (account.m_iconSet.empty()) {
- LogInfo("Widget doesn't contain Account");
+ LogDebug("Widget doesn't contain Account");
return;
}
if (account.m_multiAccountSupport) {
void TaskPrepareReinstall::StepPrepare()
{
- LogInfo("Prepare");
+ LogDebug("Prepare");
m_sourcePath = m_context.locations->getTemporaryPackageDir();
m_sourcePath += "/";
void TaskPrepareReinstall::StepParseRDSDelta()
{
- LogInfo("parse RDS delta");
+ LogDebug("parse RDS delta");
std::string rdsDeltaPath = m_sourcePath;
rdsDeltaPath += ".rds_delta";
std::ifstream delta(rdsDeltaPath);
while (std::getline(delta, line) &&!delta.eof()) {
FOREACH(keyIt, keyList) {
if (line == *keyIt) {
- LogInfo("find key = [" << line << "]");
+ LogDebug("find key = [" << line << "]");
key = line;
break;
}
}
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;
existingFilePath += *file;
verifyFile(existingFilePath);
}
- LogInfo("Finished veify RDS Delta");
+ LogDebug("Finished veify RDS Delta");
m_context.job->UpdateProgress(
InstallerContext::INSTALL_RDS_DELTA_CHECK,
void TaskPrepareReinstall::StepAddFile()
{
- LogInfo("Add file");
+ LogDebug("Add file");
FOREACH(file, m_addFileList) {
std::string newfile = m_sourcePath;
newfile += *file;
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;
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;
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,
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;
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);
void TaskSmack::StepSmackFolderLabeling()
{
- LogInfo("----------------> SMACK:\
+ LogDebug("----------------> SMACK:\
Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()");
#ifdef WRT_SMACK_ENABLED
/* /opt/usr/apps/[pkgid] directory's label is "_" */
void TaskSmack::StepSmackPrivilege()
{
- LogInfo("----------------> SMACK:\
+ LogDebug("----------------> SMACK:\
Jobs::WidgetInstall::TaskSmack::SmackPrivilegeStep()");
#ifdef WRT_SMACK_ENABLED
/* TODO :
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",
void TaskSmack::StepRevokeForUpdate()
{
- LogInfo("----------------> SMACK:\
+ LogDebug("----------------> SMACK:\
Jobs::WidgetInstall::TaskSmack::StepRevokePrivilegeForUpdate()");
#ifdef WRT_SMACK_ENABLED
if (PC_OPERATION_SUCCESS != app_revoke_permissions(m_pkgId)) {
void TaskSmack::StepAbortSmack()
{
- LogInfo("----------------> SMACK:\
+ LogDebug("----------------> SMACK:\
Jobs::WidgetInstall::TaskSmack::StepAbortSmack()");
#ifdef WRT_SMACK_ENABLED
}
/* /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());
namespace Jobs {
namespace WidgetInstall {
-void InstallerTaskWidgetPopupData::PopupData::addWidgetInfo(
- const DPL::String &info)
-{
- widgetInfo = info;
-}
TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) :
DPL::TaskDecl<TaskWidgetConfig>(this),
Try
{
std::string path = m_installContext.locations->getConfigurationDir();
- LogInfo("path: " << path);
+ LogDebug("path: " << path);
processFile(path, m_installContext.widgetConfig);
}
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,
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
if (MimeTypeUtils::isMimeTypeSupportedForIcon(type)) {
isAnyIconValid = true;
localesAvailableForIcon.insert(*i);
- LogInfo("Icon absolutePath :" << absolutePath <<
+ LogDebug("Icon absolutePath :" << absolutePath <<
", assigned locale :" << *i << ", type: " << type);
}
}
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 [" <<
featureInfo += DPL::ToUTF8String(BR);
}
data.featuresList = newList;
- if (!featureInfo.empty()) {
- m_popupData.addWidgetInfo(DPL::FromUTF8String(featureInfo));
- }
m_installContext.job->UpdateProgress(
InstallerContext::INSTALL_WIDGET_CONFIG2,
boxType = DPL::ToUTF8String((**it).m_type);
}
- LogInfo("livebox type: " << boxType);
+ LogDebug("livebox type: " << boxType);
ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList =
(**it).m_boxInfo.m_boxSize;
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);
(majorWidget == majorSupported && minorWidget == minorSupported
&& microWidget > microSupported))
{
- LogInfo("Platform doesn't support this widget.");
+ LogDebug("Platform doesn't support this widget.");
return false;
}
return true;
namespace Jobs {
namespace WidgetInstall {
-namespace InstallerTaskWidgetPopupData {
-struct PopupData
-{
- DPL::String widgetInfo;
- void addWidgetInfo(const DPL::String &info);
-};
-} // InstalllerTaskWidgetPopupData
class TaskWidgetConfig :
public DPL::TaskDecl<TaskWidgetConfig>
InstallerContext& m_installContext;
WrtDB::LocaleSet m_localeFolders;
std::set<DPL::String> m_processedIconSet;
- InstallerTaskWidgetPopupData::PopupData m_popupData;
void StepProcessConfigurationFile();
void ReadLocaleFolders();
#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>
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,
// 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;
InstallLocationType locationType;
bool isUpdateMode;
InstallMode mode;
+ DPL::String callerPkgId;
};
#endif // INSTALLER_CONTEXT_H
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)
* 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
{
* 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;
return mDistributorSigned;
}
- // TODO : remove after wrt-commons released
- virtual bool isWacSigned() const
- {
- return false;
- }
-
virtual void getCertificateChainList(
WrtDB::CertificateChainList& list,
WrtDB::CertificateSource source) const;
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);
// 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);
}
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;
}
decryptedSource.c_str(), decryptedSource.length());
dlclose(pHandle);
if (1 == ret) {
- LogInfo(source << " is decrypted : " << decryptedSource);
+ LogDebug(source << " is decrypted : " << decryptedSource);
return true;
}
return false;
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");
void WidgetUnzip::unzipWgtFile(const std::string &source, const std::string &destination)
{
- LogInfo("Prepare to unzip...");
+ LogDebug("Prepare to unzip...");
std::string wgtFile;
Try
{
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()) {
m_zip.reset();
// Done
- LogInfo("Unzip finished");
+ LogDebug("Unzip finished");
}
Catch(DPL::ZipInput::Exception::OpenFailed)
{
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));
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");
}
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
void TaskRemoveFiles::StepRemoveInstallationDirectory()
{
- LogInfo("StepRemoveInstallationDirectory started");
+ LogDebug("StepRemoveInstallationDirectory started");
Try {
int ret = app2ext_get_app_location(m_context.tzPkgid.c_str());
void TaskRemoveFiles::StepRemoveFinished()
{
- LogInfo("StepRemoveFinished finished");
+ LogDebug("StepRemoveFinished finished");
m_context.job->UpdateProgress(
UninstallerContext::UNINSTALL_REMOVE_FINISHED,
void TaskSmack::Step()
{
- LogInfo(
+ LogDebug(
"------------------------> SMACK: Jobs::WidgetUninstall::TaskSmack::Step()");
#ifdef WRT_SMACK_ENABLED
const char* pkgId = m_context.tzPkgid.c_str();
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);
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");
}
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);
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
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);
#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>
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()) {
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;
}
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);
}
m_pkgname = name;
- LogInfo("Success to set tizen package name: " << m_pkgname);
+ LogDebug("Success to set tizen package name: " << m_pkgname);
return true;
}
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;
}
return false;
}
- LogInfo("Success to send pkgmgr signal: " << key <<
+ LogDebug("Success to send pkgmgr signal: " << key <<
" - " << value);
return true;
}
return m_reqType;
}
+
+std::string PkgmgrSignal::getCallerId() const
+{
+ if (!m_initialized) {
+ LogError("PkgmgrSingal not yet intialized");
+ }
+
+ return m_callerId;
+}
} // 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;
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();
std::string m_type;
std::string m_pkgname;
int m_reqType;
+ std::string m_callerId;
};
} // PackageManager
{
return "";
}
+
+ std::string getCallerId() const
+ {
+ return "";
+ }
};
} // PkgmgrSignalDummy
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
${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
pkgmgr-info
pkgmgr
security-install
+ wrt-commons-i18n-dao-ro
REQUIRED)
INCLUDE_DIRECTORIES(
// Callback
apiStr->status_callback(tizenId, errorStatus, apiStr->userdata);
} else {
- LogInfo("installFinishedCallback: No callback");
+ LogDebug("installFinishedCallback: No callback");
}
}
// Callback
apiStr->status_callback(tizenId, errorStatus, apiStr->userdata);
} else {
- LogInfo("uninstallFinishedCallback: No callback");
+ LogDebug("uninstallFinishedCallback: No callback");
}
}
apiStr->statusCallback(errorStatus, apiStr->userdata);
} else {
- LogInfo("PluginInstallFinishedCallback: No callback");
+ LogDebug("PluginInstallFinishedCallback: No callback");
}
delete apiStr;
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
#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;
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() &&
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() &&
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() &&
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);
bool unlockPluginInstallation(bool isPreload)
{
- LogInfo("Unlock for plugins installation.");
+ LogDebug("Unlock for plugins installation.");
if (isPreload) {
fprintf(stderr, "Skip plugin unlock.. \n");
return true;
#include <parser_runner.h>
#include <widget_parser.h>
#include <root_parser.h>
-#include <package-manager.h>
+#include <pkgmgr-info.h>
#include <Elementary.h>
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);
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) {
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];
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];
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;
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");
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))
{
return;
}
- LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
+ LogDebug("Plugin DIRECTORY IS" << PLUGIN_PATH);
std::list<std::string> pluginsPaths;
struct dirent libdir;
//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;
{
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()
//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>
std::string path = std::string(data->pluginPath);
- LogInfo("Plugin Installation: " << path <<
+ LogDebug("Plugin Installation: " << path <<
" progress: " << percent <<
"description " << description);
}
void* /*userdata*/)
{
//WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
- LogInfo(" progress: " << percent <<
+ LogDebug(" progress: " << percent <<
" description: " << description);
}
void WrtInstaller::staticWrtUninstallProgressCallback(float percent,
void* /*userdata*/)
{
//WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
- LogInfo(" progress: " << percent <<
+ LogDebug(" progress: " << percent <<
" description: " << description);
}
if (!PluginUtils::lockPluginInstallation(
m_installMode.installTime == InstallMode::InstallTime::PRELOAD))
{
- LogInfo("Lock NOT created");
+ LogDebug("Lock NOT created");
return;
}
{
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.
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);
private:
void showHelpAndQuit();
+ void showArguments();
// Events
virtual void OnEventReceived(const WRTInstallerNS::QuitEvent &event);
void installPluginsStep();
void uninstallPkgNameStep();
void unistallWgtFileStep();
+ void removeUpdateStep();
void shutdownStep();
// Static callbacks
void* userdata);
void installNewPlugins();
- bool popupsEnabled() const;
CSCConfiguration::dataMap parseCSCConfiguration(std::string str);
void showErrorMsg(WrtErrStatus status, std::string tizenId, std::string
printMsg);
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();
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(
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) {
void wrt_installer_shutdown()
{
try {
- LogInfo("[WRT-API] DEINITIALIZING WRT INSTALLER...");
+ LogDebug("[WRT-API] DEINITIALIZING WRT INSTALLER...");
// Installer termination
CONTROLLER_POST_SYNC_EVENT(
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:");
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,
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,
{
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*
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
${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)
${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)
)
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}
${WRT_TEST_LIBRARY}
${TARGET_CORE_MODULE_LIB}
${COMMON_LIB_PKGS_LIBRARIES}
+ ${INSTALLER_TESTS_DEPS_LIBRARIES}
)
#widgets
--- /dev/null
+/*
+ * 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));
+}
int main (int argc, char *argv[])
{
- LogInfo("Starting tests");
+ LogDebug("Starting tests");
WrtDB::WrtDatabase::attachToThreadRW();
int status =