<xs:attribute name="background-support" type="tizen:activationType" use="optional"/> <!-- default: enable -->
<xs:attribute name="encryption" type="tizen:activationType" use="optional"/> <!-- default: disable -->
<xs:attribute name="install-location" type="tizen:InstallLocationType" use="optional"/>
+ <xs:attribute name="nodisplay" type="tizen:data.boolean" use="optional"/> <!-- default: false -->
</xs:complexType>
</xs:element>
-#git:framework/web/wrt-installer wrt-installer 0.1.22
+#git:framework/web/wrt-installer wrt-installer 0.1.23
Name: wrt-installer
Summary: Installer for tizen Webruntime
-Version: 0.1.22
+Version: 0.1.23
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
cmake . -DCMAKE_INSTALL_PREFIX=/usr \
-DDPL_LOG=ON \
- -DCMAKE_PACKAGE_VERSION=%{version} \
-DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
%{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS}
make %{?jobs:-j%jobs}
--- /dev/null
+/*
+ * Copyright (c) 2011 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 job_exception_error.h
+ * @author Soyoung Kim (sy037.kim@samsung.com)
+ * @version 1.0
+ * @brief This file contains declarations of wrt api
+ */
+
+/*
+ * @defgroup wrt_engine_group WebRunTime engine Library
+ * @ingroup internet_FW
+ * Functions to APIs to access wrt-engine
+ */
+
+#ifndef JOB_EXCEPTION_ERROR_H
+#define JOB_EXCEPTION_ERROR_H
+
+#include <stdbool.h>
+#include <stddef.h>
+
+namespace Jobs {
+namespace Exceptions {
+enum Type
+{
+ Success = 0, ///< Success
+
+ /* pkgmgr error */
+ ErrorPackageNotFound, ///<
+ ErrorPackageInvalid, ///< invalid widget package
+ ErrorPackageLowerVersion, ///< given version is lower
+ ///< than existing version
+ ErrorManifestNotFound, ///<
+ ErrorManifestInvalid, ///<
+ ErrorConfigNotFound, ///< couldn't find config.xml
+ ///< in package.
+ ErrorConfigInvalid, ///< invalid config.xml
+ ErrorSignatureNotFound, ///< signature file not exist.
+ ErrorSignatureInvalid, ///< invalid signature file
+ ErrorSignatureVerificationFailed, ///< failure in verificate
+ ///< signature
+ ErrorRootCertificateNotFound, ///< couldn't find root
+ ///< certificate.
+ ErrorCertificationInvaid, ///< invalid certification
+ ErrorCertificateChainVerificationFailed, ///< failure in verificate
+ ///< certification chain.
+ ErrorCertificateExpired, ///< expire cerification.
+ ErrorInvalidPrivilege, ///< invalid privilege.
+ ErrorMenuIconNotFound, ///<
+ ErrorFatalError, ///< failure in db operation
+ ///< or file opertion..
+ ErrorOutOfStorage, ///< failure in shortage of
+ ///< memory
+ ErrorOutOfMemory, ///< failure in shortage of RAM
+
+ /* wrt-installer error */
+ /* 121-140 : reserved for Web installer */
+ ErrorPackageAlreadyInstalled = 121, ///< package already in target.
+ ErrorAceCheckFailed, ///< failure in ace check.
+ ErrorManifestCreateFailed, ///< failure in creating manifest
+ ErrorEncryptionFailed, ///< failure in encryption resource
+ ErrorInstallOspServcie, ///< Failure in installing osp service
+ ErrorPluginInstallationFailed, ///< failure in plugin installation
+ ErrorWidgetUninstallationFailed, ///< failure in uninstallation
+
+ ErrorUnknown = 140, ///< do not use this error code.
+};
+}
+}
+
+#endif /* JOB_EXCEPTION_ERROR_H */
{
LogDebug("Call Plugin install success finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- Exceptions::Success);
+ Jobs::Exceptions::Success);
} else {
LogDebug("Call Plugin install waiting finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- Exceptions::InstallationWaiting);
+ Jobs::Exceptions::ErrorPluginInstallationFailed);
LogInfo("Installation: " << getFilePath() <<
" NOT possible");
void JobPluginInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
{
- m_exceptionCaught = static_cast<Exceptions::Type>(e.getParam());
+ m_exceptionCaught = static_cast<Jobs::Exceptions::Type>(e.getParam());
m_exceptionMessage = e.GetMessage();
}
} //namespace Jobs
//TODO move it to base class of all jobs
//maybe separate JobBase class for this?
- Exceptions::Type m_exceptionCaught;
+ Jobs::Exceptions::Type m_exceptionCaught;
std::string m_exceptionMessage;
};
} //namespace Jobs
WRT_SRC_INSTALLER_CORE_PLUGIN_INSTALLER_TASKS_PLUGIN_INSTALLER_ERRORS_H_
#include <job_exception_base.h>
+#include <job_exception_error.h>
+
+using namespace Jobs::Exceptions;
namespace Jobs {
namespace PluginInstall {
namespace Exceptions {
-enum Type
-{
- Success, ///< Success
-
- WrongPluginPath, ///< Wrong plugin path
- MetafileError, ///< Metafile parse error
- AlreadyInstalled, ///< Plugin already installed
- LoadingLibraryError, ///< Loading library by dlopen failed.
- /// It may be caused by missing symbols
- InstallationWaiting, /// Installation failed due to dependencies
- Unknown ///< Temporary error. Try to not use this.
-};
-DECLARE_JOB_EXCEPTION_BASE(JobExceptionBase, Base, Unknown)
-DECLARE_JOB_EXCEPTION(Base, PluginPathFailed, WrongPluginPath)
-DECLARE_JOB_EXCEPTION(Base, PluginMetafileFailed, MetafileError)
-DECLARE_JOB_EXCEPTION(Base, PluginAlreadyInstalled, AlreadyInstalled)
-DECLARE_JOB_EXCEPTION(Base, PluginLibraryError, LoadingLibraryError)
-DECLARE_JOB_EXCEPTION(Base, InstallationWaitingError, InstallationWaiting)
-DECLARE_JOB_EXCEPTION(Base, UnknownError, Unknown)
+DECLARE_JOB_EXCEPTION_BASE(JobExceptionBase, Base, ErrorUnknown)
+DECLARE_JOB_EXCEPTION(Base, PluginPathFailed, ErrorPluginInstallationFailed)
+DECLARE_JOB_EXCEPTION(Base, PluginMetafileFailed, ErrorPluginInstallationFailed)
+DECLARE_JOB_EXCEPTION(Base, PluginAlreadyInstalled,
+ ErrorPluginInstallationFailed)
+DECLARE_JOB_EXCEPTION(Base, PluginLibraryError, ErrorPluginInstallationFailed)
+DECLARE_JOB_EXCEPTION(Base, InstallationWaitingError,
+ ErrorPluginInstallationFailed)
+DECLARE_JOB_EXCEPTION(Base, UnknownError, ErrorUnknown)
} //namespace
} //namespace
} //namespace
//Plugin Installer typedefs
typedef void (*PluginInstallerFinishedCallback)(
void *userParam,
- Jobs::PluginInstall::Exceptions::Type);
+ Jobs::Exceptions::Type);
//installer progress
typedef void (*PluginInstallerProgressCallback)(
#include <widget_install_to_external.h>
using namespace WrtDB;
+using namespace Jobs::Exceptions;
namespace // anonymous
{
const DPL::String SETTING_VALUE_INSTALLTOEXT_PREPER_EXT =
L"prefer-external";
-class InstallerTaskFail :
- public DPL::TaskDecl<InstallerTaskFail>
-{
- private:
- bool m_deferred;
-
- void StepFail()
- {
- if (m_deferred) {
- ThrowMsg(Jobs::WidgetInstall::Exceptions::Deferred,
- "Widget installation or update deferred!");
- } else {
- ThrowMsg(Jobs::WidgetInstall::Exceptions::NotAllowed,
- "Widget installation or update not allowed!");
- }
- }
-
- public:
- InstallerTaskFail(bool deferred) :
- DPL::TaskDecl<InstallerTaskFail>(this),
- m_deferred(deferred)
- {
- AddStep(&InstallerTaskFail::StepFail);
- }
-};
-
const std::string XML_EXTENSION = ".xml";
bool hasExtension(const std::string& filename, const std::string& extension)
}
return (0 == filename.compare(fileLen - extLen, extLen, extension));
}
+} // namespace anonymous
-bool checkTizenPkgIdExist(const std::string& tizenPkgId)
+namespace Jobs {
+namespace WidgetInstall {
+class InstallerTaskFail :
+ public DPL::TaskDecl<InstallerTaskFail>
{
- std::string installPath =
- std::string(GlobalConfig::GetUserInstalledWidgetPath()) +
- "/" + tizenPkgId;
- std::string preinstallPath =
- std::string(GlobalConfig::GetUserPreloadedWidgetPath()) +
- "/" + tizenPkgId;
+ private:
+ ConfigureResult m_result;
- struct stat dirStat;
- if ((stat(installPath.c_str(), &dirStat) == 0) ||
- (stat(preinstallPath.c_str(), &dirStat) == 0))
+ void StepFail()
{
- return true;
+ if (m_result == ConfigureResult::Deferred) {
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::Deferred,
+ "widget installation or update deferred!");
+ } else if (m_result == ConfigureResult::Failed_InvalidConfig) {
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::WidgetConfigFileInvalid,
+ "invalid config");
+ } else if (m_result == ConfigureResult::Failed_LowerVersion) {
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::PackageLowerVersion,
+ "package version is lower than installed version");
+ } else if (m_result == ConfigureResult::Failed_AlreadyInstalled) {
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::PackageAlreadyInstalled,
+ "package is already installed");
+ } else if (m_result == ConfigureResult::Failed_WidgetRunning) {
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::WidgetRunningError,
+ "widget is running");
+ } else if (m_result == ConfigureResult::Failed_DrmError) {
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::DRMFailed,
+ "drm failed");
+ } else {
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::NotAllowed,
+ "widget installation or update not allowed!");
+ }
}
- return false;
-}
-} // namespace anonymous
-namespace Jobs {
-namespace WidgetInstall {
+ public:
+ InstallerTaskFail(ConfigureResult result) :
+ DPL::TaskDecl<InstallerTaskFail>(this),
+ m_result(result)
+ {
+ AddStep(&InstallerTaskFail::StepFail);
+ }
+};
+
JobWidgetInstall::JobWidgetInstall(
std::string const &widgetPath,
const WidgetInstallationStruct &
installerStruct) :
Job(Installation),
JobContextBase<WidgetInstallationStruct>(installerStruct),
- m_exceptionCaught(Exceptions::Success)
+ m_exceptionCaught(Jobs::Exceptions::Success)
{
m_installerContext.m_quiet = m_jobStruct.m_quiet;
}
AddTask(new TaskCertify(m_installerContext));
+ if (m_needEncryption) {
+ AddTask(new TaskEncryptResource(m_installerContext));
+ }
+
if (m_installerContext.widgetConfig.packagingType !=
WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
{
// Installation is deferred
LogInfo("Configure installation deferred");
- AddTask(new InstallerTaskFail(true));
- } else if (result == ConfigureResult::Failed) {
+ AddTask(new InstallerTaskFail(result));
+ } else if (result >= ConfigureResult::Failed &&
+ result <= ConfigureResult::Failed_DrmError) {
// Installation is not allowed to proceed due to widget update policy
LogWarning("Configure installation failed!");
- AddTask(new InstallerTaskFail(false));
+ AddTask(new InstallerTaskFail(result));
} else {
Assert(false && "Invalid configure result!");
}
}
-JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
+ConfigureResult JobWidgetInstall::PrePareInstallation(
const std::string &widgetPath)
{
ConfigureResult result;
Try
{
std::string tempDir =
- Jobs::WidgetInstall::createTempPath(m_jobStruct.m_preload);
+ Jobs::WidgetInstall::createTempPath(m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_PRELOAD);
m_isDRM = isDRMWidget(widgetPath);
if (true == m_isDRM) {
LogDebug("decrypt DRM widget");
if (DecryptDRMWidget(widgetPath, tempDir)) {
LogDebug("Failed decrypt DRM widget");
- return ConfigureResult::Failed;
+ return ConfigureResult::Failed_DrmError;
}
}
Catch(Exceptions::ExtractFileFailed)
{
LogError("Failed to create temporary path for widget");
- result = ConfigureResult::Failed;
+ result = ConfigureResult::Failed_InvalidConfig;
}
return result;
TizenPkgId pkgId = WidgetDAOReadOnly::generatePkgId();
LogDebug("Checking if pkg id is unique");
while (true) {
- if (checkTizenPkgIdExist(DPL::ToUTF8String(pkgId))) {
+ if (!validateTizenPackageID(pkgId)) {
//path exist, chose another one
pkgId = WidgetDAOReadOnly::generatePkgId();
continue;
LogInfo("widgetSource " << widgetPath);
}
-JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
+ConfigureResult JobWidgetInstall::ConfigureInstallation(
const std::string &widgetSource,
const WrtDB::ConfigParserData &configData,
const std::string &tempPath)
{
- WidgetUpdateInfo update = detectWidgetUpdate(
- configData,
- m_installerContext.
- widgetConfig.webAppType,
- m_installerContext.
- widgetConfig.tzAppid);
- ConfigureResult result = checkWidgetUpdate(update);
-
- // Validate tizenId
- regex_t reg;
- if (regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
- LogDebug("Regcomp failed");
+ ConfigureResult result = ConfigureResult::Failed;
+ WidgetUpdateInfo update;
+
+ // checking installed web application
+ Try {
+ // checking existing application is installed
+ WidgetDAOReadOnly dao(m_installerContext.widgetConfig.tzAppid);
+ // no excpetion means, it isn't update mode
+ getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_START_KEY,
+ PKGMGR_START_UPDATE);
+
+ update = detectWidgetUpdate(configData,
+ m_installerContext.widgetConfig.tzAppid);
+ result = checkWidgetUpdate(update);
+ if (result != ConfigureResult::Updated) {
+ // Already installed TizenAppId. return failed
+ return ConfigureResult::Failed_AlreadyInstalled;
+ }
+ m_installerContext.isUpdateMode = true;
}
+ Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
+ result = ConfigureResult::Ok;
+ getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_START_KEY,
+ PKGMGR_START_INSTALL);
+ m_installerContext.isUpdateMode = false;
- if ((regexec(®,
- DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid).
- c_str(),
- static_cast<size_t>(0), NULL, 0) == REG_NOMATCH) ||
- (checkTizenPkgIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig
- .tzPkgid)) &&
- result != ConfigureResult::Updated))
- {
- //it is true when tizenId does not fit REG_TIZENID_PATTERN
- LogError("tizen_id provided but not proper or pkgId directory exists");
- //TODO(t.iwanek): appId is unique, what about installation of
- // abcdefghij.test1 and abcdefghij.test2?
- regfree(®);
- return ConfigureResult::Failed;
+ if (!validateTizenApplicationID(
+ m_installerContext.widgetConfig.tzAppid))
+ {
+ LogError("tizen application ID is already used");
+ return ConfigureResult::Failed_InvalidConfig;
+ }
+ if (!validateTizenPackageID(m_installerContext.widgetConfig.tzPkgid)) {
+ LogError("tizen package ID is already used");
+ return ConfigureResult::Failed_AlreadyInstalled;
+ }
}
- regfree(®);
configureWidgetLocation(widgetSource, tempPath);
// Init installer context
m_installerContext.installStep = InstallerContext::INSTALL_START;
m_installerContext.job = this;
- m_installerContext.existingWidgetInfo = update.existingWidgetInfo;
m_installerContext.widgetConfig.shareHref = std::string();
return result;
}
-JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate(
- const WidgetUpdateInfo &update)
+bool JobWidgetInstall::validateTizenApplicationID(
+ const WrtDB::TizenAppId &tizenAppId)
{
- LogInfo(
- "Widget install/update: incoming guid = '" <<
- update.incomingGUID << "'");
- LogInfo(
- "Widget install/update: incoming version = '" <<
- update.incomingVersion << "'");
+ LogInfo("tizen application ID = [" << tizenAppId << "]");
- // Check policy
- WidgetUpdateMode::Type updateTypeCheckBit;
-
- if (update.existingWidgetInfo.isExist == false) {
- LogInfo("Widget info does not exist");
- updateTypeCheckBit = WidgetUpdateMode::NotInstalled;
-
- getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_START_KEY,
- PKGMGR_START_INSTALL);
-
- } else {
- LogInfo("Widget info exists. appid: " <<
- update.existingWidgetInfo.tzAppid);
-
- getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_START_KEY,
- PKGMGR_START_UPDATE);
+ regex_t reg;
+ if (regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
+ LogDebug("Regcomp failed");
+ }
- TizenAppId tzAppid = update.existingWidgetInfo.tzAppid;
+ if (regexec(®, DPL::ToUTF8String(tizenAppId).c_str(), 0, NULL, 0)
+ == REG_NOMATCH)
+ {
+ regfree(®);
+ return false;
+ }
+ regfree(®);
+ return true;
+}
- LogInfo("Widget model exists. tizen app id: " << tzAppid);
+bool JobWidgetInstall::validateTizenPackageID(
+ const WrtDB::TizenPkgId &tizenPkgId)
+{
+ std::string pkgId = DPL::ToUTF8String(tizenPkgId);
- // Check running state
- bool isRunning = false;
- int retval = app_manager_is_running(DPL::ToUTF8String(
- tzAppid).c_str(), &isRunning);
- if (APP_MANAGER_ERROR_NONE != retval) {
- LogError("Fail to get running state");
- return ConfigureResult::Failed;
- }
+ std::string installPath =
+ std::string(GlobalConfig::GetUserInstalledWidgetPath()) +
+ "/" + pkgId;
+ std::string preinstallPath =
+ std::string(GlobalConfig::GetUserPreloadedWidgetPath()) +
+ "/" + pkgId;
- if (true == isRunning) {
- // Must be deferred when update in progress
- if (m_jobStruct.updateMode == WidgetUpdateMode::PolicyWac) {
- LogInfo(
- "Widget is already running. Policy is update according to WAC");
+ struct stat dirStat;
+ if ((stat(installPath.c_str(), &dirStat) == 0) ||
+ (stat(preinstallPath.c_str(), &dirStat) == 0))
+ {
+ return false;
+ }
+ return true;
+}
- return ConfigureResult::Deferred;
- } else {
- LogInfo(
- "Widget is already running. Policy is not update according to WAC");
+ConfigureResult JobWidgetInstall::checkWidgetUpdate(
+ const WidgetUpdateInfo &update)
+{
+ LogInfo("incoming version = '" << update.incomingVersion);
+ LogInfo("Tizen AppID = " << update.tzAppId);
+
+ // Check running state
+ bool isRunning = false;
+ int retval =
+ app_manager_is_running(DPL::ToUTF8String(update.tzAppId).c_str(),
+ &isRunning);
+ if (APP_MANAGER_ERROR_NONE != retval || isRunning) {
+ LogError("Fail to get running state");
+ return ConfigureResult::Failed_WidgetRunning;
+ }
- return ConfigureResult::Failed;
- }
- }
+ m_installerContext.widgetConfig.tzAppid = update.tzAppId;
- m_installerContext.widgetConfig.tzAppid = tzAppid;
- OptionalWidgetVersion existingVersion;
- existingVersion = update.existingWidgetInfo.existingVersion;
- OptionalWidgetVersion incomingVersion = update.incomingVersion;
-
- updateTypeCheckBit = CalcWidgetUpdatePolicy(existingVersion,
- incomingVersion);
- // Calc proceed flag
- if ((m_jobStruct.updateMode & updateTypeCheckBit) > 0 ||
- m_jobStruct.updateMode ==
- WidgetUpdateMode::PolicyDirectoryForceInstall)
- {
- LogInfo("Whether widget policy allow proceed ok");
- return ConfigureResult::Updated;
- } else {
- return ConfigureResult::Failed;
- }
+ if (isUpperVersion(update.existingVersion, update.incomingVersion) ||
+ m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY)
+ {
+ LogInfo("Whether widget policy allow proceed ok");
+ return ConfigureResult::Updated;
+ } else {
+ return ConfigureResult::Failed_LowerVersion;
}
- return ConfigureResult::Ok;
+
+ return ConfigureResult::Failed;
}
-WidgetUpdateMode::Type JobWidgetInstall::CalcWidgetUpdatePolicy(
+bool JobWidgetInstall::isUpperVersion(
const OptionalWidgetVersion &existingVersion,
- const OptionalWidgetVersion &incomingVersion) const
+ const OptionalWidgetVersion &incomingVersion)
{
- // Widget is installed, check versions
+ LogInfo("Existing version = '" << *existingVersion);
+ LogInfo("Incoming version = '" << *incomingVersion);
+
if (!existingVersion && !incomingVersion) {
- return WidgetUpdateMode::ExistingVersionEqual;
+ return false;
} else if (!existingVersion && !!incomingVersion) {
- return WidgetUpdateMode::ExistingVersionNewer;
+ return false;
} else if (!!existingVersion && !incomingVersion) {
- return WidgetUpdateMode::ExistingVersionOlder;
+ return true;
} else {
- LogInfo("Existing widget: version = '" << *existingVersion << "'");
-
- if (!existingVersion->IsWac() && !incomingVersion->IsWac()) {
- return WidgetUpdateMode::BothVersionsNotStd;
- } else if (!existingVersion->IsWac()) {
- return WidgetUpdateMode::ExistingVersionNotStd;
- } else if (!incomingVersion->IsWac()) {
- return WidgetUpdateMode::IncomingVersionNotStd;
+ if (!existingVersion->IsWac() || !incomingVersion->IsWac()) {
+ return false;
} else {
- // Both versions are WAC-comparable. Do compare.
if (*incomingVersion == *existingVersion) {
- return WidgetUpdateMode::ExistingVersionEqual;
+ return false;
} else if (*incomingVersion > *existingVersion) {
- return WidgetUpdateMode::ExistingVersionOlder;
+ return true;
} else {
- return WidgetUpdateMode::ExistingVersionNewer;
+ return false;
}
}
}
WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
const ConfigParserData &configInfo,
- const WrtDB::WidgetType appType,
const WrtDB::TizenAppId &tizenId)
{
LogInfo("Checking up widget package for config.xml...");
+ OptionalWidgetVersion incomingVersion;
- DPL::OptionalString widgetGUID;
- OptionalWidgetVersion widgetVersion;
-
- // Check widget id
- widgetGUID = configInfo.widget_id;
-
- if (widgetGUID.IsNull()) {
- LogWarning("Installed widget has no GUID");
- return WidgetUpdateInfo();
- }
-
- LogDebug("Installed widget GUID: " << *widgetGUID);
-
- // Locate widget ID with this GUID
- // Incoming widget version
if (!configInfo.version.IsNull()) {
- widgetVersion =
+ incomingVersion =
DPL::Optional<WidgetVersion>(
WidgetVersion(*configInfo.version));
}
- if (appType == APP_TYPE_WAC20) {
- Try
- {
- // Search widget handle by GUID
- WidgetDAOReadOnly dao(widgetGUID);
- return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo(
- dao.getTzAppId(), dao.getVersion()));
- }
- Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
- {
- // GUID isn't installed
- return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo());
- }
- } else {
- Try
- {
- // Search widget handle by appId
- WidgetDAOReadOnly dao(tizenId);
- return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo(
- dao.getTzAppId(), dao.getVersion()));
- }
- Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
- {
- // GUID isn't installed
- return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo());
- }
- }
+ WidgetDAOReadOnly dao(tizenId);
+ return WidgetUpdateInfo(
+ dao.getTzAppId(),
+ WidgetVersion(*dao.getVersion()),
+ incomingVersion);
}
void JobWidgetInstall::SendProgress()
sync();
if (INSTALL_LOCATION_TYPE_EXTERNAL == m_installerContext.locationType) {
- if (false == m_installerContext.existingWidgetInfo.isExist) {
- WidgetInstallToExtSingleton::Instance().postInstallation(true);
- } else {
+ if (m_installerContext.isUpdateMode) {
WidgetInstallToExtSingleton::Instance().postUpgrade(true);
+ } else {
+ WidgetInstallToExtSingleton::Instance().postInstallation(true);
}
WidgetInstallToExtSingleton::Instance().deinitialize();
}
LogDebug("Call widget install successfinishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
DPL::ToUTF8String(
- tizenId), Exceptions::Success);
+ tizenId), Jobs::Exceptions::Success);
}
void JobWidgetInstall::SendFinishedFailure()
// remove widget install information file
unlink(m_installerContext.installInfo.c_str());
- LogError("Error in installation step: " << m_exceptionCaught);
+ LogError("Error number: " << m_exceptionCaught);
LogError("Message: " << m_exceptionMessage);
TizenAppId & tizenId = m_installerContext.widgetConfig.tzAppid;
LogDebug("Call widget install failure finishedCallback");
+ std::stringstream errorNum;
+ errorNum << m_exceptionCaught;
// send signal of pkgmgr
getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_ERROR,
+ errorNum.str());
+
+ getInstallerStruct().pkgmgrInterface->sendSignal(
PKGMGR_END_KEY,
PKGMGR_END_FAILURE);
void JobWidgetInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
{
- m_exceptionCaught = static_cast<Exceptions::Type>(e.getParam());
+ m_exceptionCaught = static_cast<Jobs::Exceptions::Type>(e.getParam());
m_exceptionMessage = e.GetMessage();
}
localizedInfo.description;
out << std::endl << "Widget Id: " << dao.getGUID();
out << std::endl << "Widget recognized: " << dao.isRecognized();
- out << std::endl << "Widget wac signed: " << dao.isWacSigned();
out << std::endl << "Widget distributor signed: " <<
dao.isDistributorSigned();
out << std::endl << "Widget trusted: " << dao.isTrusted();
const std::string &tempPath)
{
// Check installation type (direcotory/ or config.xml or widget.wgt)
- if (WidgetUpdateMode::PolicyDirectoryForceInstall ==
- m_jobStruct.updateMode)
+ if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY)
{
LogDebug("Install directly from directory");
return PKG_TYPE_DIRECTORY_WEB_APP;
{
m_installerContext.locationType = INSTALL_LOCATION_TYPE_NOMAL;
- if (true == m_jobStruct.m_preload) {
+ if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_PRELOAD) {
m_installerContext.locationType =
INSTALL_LOCATION_TYPE_PRELOAD;
} else {
#include <dpl/wrt-dao-ro/config_parser_data.h>
#include "widget_installer_struct.h"
+using namespace Jobs::Exceptions;
+
namespace Jobs {
namespace WidgetInstall {
+enum class ConfigureResult
+{
+ Ok,
+ Deferred,
+ Updated,
+ Failed,
+ Failed_InvalidConfig,
+ Failed_LowerVersion,
+ Failed_AlreadyInstalled,
+ Failed_WidgetRunning,
+ Failed_DrmError,
+};
+
class JobWidgetInstall :
public Job,
public JobProgressBase<InstallerContext::InstallStep,
InstallerContext m_installerContext;
//TODO move it to base class of all jobs -> make it base template class??
- Exceptions::Type m_exceptionCaught;
+ Jobs::Exceptions::Type m_exceptionCaught;
std::string m_exceptionMessage;
WidgetUpdateInfo m_widgetUpdateInfo;
bool m_needEncryption;
bool m_isDRM;
- enum class ConfigureResult
- {
- Ok, Failed, Deferred, Updated
- };
-
ConfigureResult ConfigureInstallation(const std::string &widgetSource,
const WrtDB::ConfigParserData
&configData,
bool isDRM);
static WidgetUpdateInfo detectWidgetUpdate(
const WrtDB::ConfigParserData &configInfo,
- const WrtDB::WidgetType appType,
const WrtDB::TizenAppId &tizenId);
- WidgetUpdateMode::Type CalcWidgetUpdatePolicy(
+ bool isUpperVersion(
const OptionalWidgetVersion &existingVersion,
- const OptionalWidgetVersion &incomingVersion) const;
+ const OptionalWidgetVersion &incomingVersion);
void setTizenId(const WrtDB::ConfigParserData &configInfo);
void displayWidgetInfo();
void configureWidgetLocation(const std::string & widgetPath,
bool isDRMWidget(std::string widgetPath);
bool DecryptDRMWidget(std::string widgetPath, std::string destPath);
ConfigureResult PrePareInstallation(const std::string &widgetPath);
+ bool validateTizenApplicationID(const WrtDB::TizenAppId &tizenAppId);
+ bool validateTizenPackageID(const WrtDB::TizenPkgId &tizenPkgId);
ConfigureResult checkWidgetUpdate(const WidgetUpdateInfo &update);
void setApplicationType(const WrtDB::ConfigParserData &configInfo);
dao.getHandle(),
&policyResult);
if (ACE_OK != ret) {
- ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
+ ThrowMsg(Exceptions::AceCheckFailed, "Instalation failure. "
"ACE check failure");
}
ace_return_t ret = ace_set_requested_dev_caps(dao.getHandle(),
&list);
if (ACE_OK != ret) {
- ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
+ ThrowMsg(Exceptions::AceCheckFailed, "Instalation failure. "
"ACE failure");
}
delete[] list.items;
if (ACE_OK != ret) {
LogError("Error in ace_set_feature");
- ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
+ ThrowMsg(Exceptions::AceCheckFailed, "Instalation failure. "
"ace_set_feature failure.");
}
return;
if (m_context.featureLogic->isRejected()) {
LogError("Installation failure. Some devCap was not accepted by ACE.");
ThrowMsg(
- Exceptions::NotAllowed,
+ Exceptions::AceCheckFailed,
"Instalation failure. "
"Some deviceCap was not accepted by ACE.");
}
#include <vcore/SignatureReader.h>
#include <vcore/SignatureFinder.h>
#include <vcore/WrtSignatureValidator.h>
-#include <vcore/DeveloperModeValidator.h>
#include <dpl/utils/wrt_global_settings.h>
#include <dpl/wrt-dao-ro/global_dao_read_only.h>
{
AddStep(&TaskCertify::stepSignature);
// certi comparison determines whether the update.
- if (true == m_contextData.existingWidgetInfo.isExist) {
+ if (true == m_contextData.isUpdateMode) {
AddStep(&TaskCertify::stepVerifyUpdate);
}
// no point in check domain WAC_ROOT and WAC_RECOGNIZED
m_contextData.wacSecurity.setDistributorSigned(true);
- if (data.getStorageType().contains(CertStoreId::WAC_ROOT)) {
- m_contextData.wacSecurity.setWacSigned(true);
- }
-
CertificateCollection collection;
collection.load(data.getCertList());
Assert(collection.sort() &&
SignatureFinder signatureFinder(widgetPath);
if (SignatureFinder::NO_ERROR != signatureFinder.find(signatureFiles)) {
LogError("Error in Signature Finder");
- ThrowMsg(Exceptions::InvalidPackage,
+ ThrowMsg(Exceptions::SignatureNotFound,
"Error openig temporary widget directory");
}
SignatureFileInfoSet::reverse_iterator iter = signatureFiles.rbegin();
LogInfo("Number of signatures: " << signatureFiles.size());
- bool testCertificate = false;
-
bool complianceMode = GlobalDAOReadOnly::getComplianceMode();
for (; iter != signatureFiles.rend(); ++iter) {
if (result == WrtSignatureValidator::SIGNATURE_REVOKED) {
LogWarning("Certificate is REVOKED");
- ThrowMsg(Exceptions::InvalidPackage,
+ ThrowMsg(Exceptions::CertificateExpired,
"Certificate is REVOKED");
}
if (result == WrtSignatureValidator::SIGNATURE_INVALID) {
LogWarning("Signature is INVALID");
// TODO change exception name
- ThrowMsg(Exceptions::InvalidPackage,
+ ThrowMsg(Exceptions::SignatureInvalid,
"Invalid Package");
}
// now signature _must_ be verified
processDistributorSignature(data);
}
-
- bool developerMode = GlobalDAOReadOnly::GetDeveloperMode();
-
- std::string realMEID;
- /*
- TapiHandle *tapiHandle = tel_init(NULL);
- char *meid = tel_get_misc_me_sn_sync(tapiHandle);
- if (meid) {
- realMEID = meid;
- free(meid);
- }
- tel_deinit(tapiHandle);
- */
-
- DeveloperModeValidator developerModeValidator(
- complianceMode,
- developerMode,
- GlobalDAOReadOnly::getComplianceFakeImei(),
- GlobalDAOReadOnly::getComplianceFakeMeid(),
- realMEID);
-
- developerModeValidator.check(data);
-
- testCertificate |=
- data.getStorageType().contains(CertStoreId::DEVELOPER);
-
- if (testCertificate && !developerMode) {
- LogError("Widget signed by test certificate, "
- "but developer mode is off.");
- ThrowMsg(Exceptions::InvalidPackage,
- "Widget signed by test certificate, "
- "but developer mode is off.");
- }
- m_contextData.widgetConfig.isTestWidget = testCertificate;
} Catch(ParserSchemaException::Base) {
LogError("Error occured in ParserSchema.");
- ReThrowMsg(Exceptions::InvalidPackage,
+ ReThrowMsg(Exceptions::SignatureInvalid,
"Error occured in ParserSchema.");
}
- Catch(DeveloperModeValidator::Exception::Base) {
- LogError("Cannot validate developer certificate.");
- ReThrowMsg(Exceptions::InvalidPackage,
- "Cannot validate developer certificate.");
- }
}
if (signatureFiles.empty()) {
oldCertificate->getBase64());
LogDebug("new widget's author signer certificate : " <<
newCertificate->getBase64());
- ThrowMsg(Exceptions::InvalidPackage,
+ ThrowMsg(Exceptions::NotMatchedCertification,
"Author signer certificates doesn't match \
between old widget and installing widget");
}
} else {
if (!(NULL == newCertificate.Get() && NULL == oldCertificate.Get())) {
- ThrowMsg(Exceptions::InvalidPackage,
+ ThrowMsg(Exceptions::NotMatchedCertification,
"Author signer certificates doesn't match \
between old widget and installing widget");
}
}
// Create new path
if (!WrtUtilMakeDir(tempPath, TEMPORARY_PATH_MODE)) {
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"Failed to create temporary directory");
}
void createTempPath(const std::string& path)
{
if (!WrtUtilMakeDir(path, TEMPORARY_PATH_MODE)) {
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"Failed to create temporary directory");
}
}
//TODO make directory like jobs common?
std::string createTempPath(bool preload = false);
-std::string createTempPath(bool preload);
-
void createTempPath(const std::string& path);
} // WidgetInstall
} // Jobs
/* Set install Time */
time(&m_context.widgetConfig.installedTime);
- if (m_context.existingWidgetInfo.isExist) { //update
+ if (m_context.isUpdateMode) { //update
LogInfo("Registering widget... (update)");
Try
{
{
LogError(
"Given tizenId not found for update installation (Same GUID?)");
- ThrowMsg(Exceptions::InvalidPackage,
+ ThrowMsg(Exceptions::DatabaseFailure,
"Given tizenId not found for update installation");
}
WidgetDAO::registerOrUpdateWidget(
{
WrtDB::ExternalLocationList externalLocationsUpdate =
m_context.locations->listExternalLocations();
- if (m_context.existingWidgetInfo.isExist) { //update
+ if (m_context.isUpdateMode) { //update
Try
{
WidgetDAO dao(m_context.widgetConfig.tzAppid);
if (NULL == result)
{
- ThrowMsg(Jobs::WidgetInstall::Exceptions::InternalError,
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::EncryptionFailed,
"Could not open file " << path);
}
{
if (EINTR != error)
{
- ThrowMsg(Jobs::WidgetInstall::Exceptions::InternalError,
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::ErrorExternalInstallingFailure,
"Error while reading data" <<
" [" << DPL::GetErrnoString(error) << "]");
}
if ((bytesWritten != bytesToWrite) && (EINTR != errno))
{
int error = errno;
- ThrowMsg(Jobs::WidgetInstall::Exceptions::InternalError,
+ ThrowMsg(Jobs::WidgetInstall::Exceptions::EncryptionFailed,
"Error while writing data" <<
" [" << DPL::GetErrnoString(error) << "]");
}
int error = errno;
LogWarning(__PRETTY_FUNCTION__ << ": fts_open failed with error: "
<< strerror(error));
- ThrowMsg(Exceptions::InternalError, "Error reading directory: "
+ ThrowMsg(Exceptions::EncryptionFailed, "Error reading directory: "
<< path);
}
<< ftsent->fts_path
<< " with error: "
<< strerror(ftsent->fts_errno));
- ThrowMsg(Exceptions::InternalError, "Error reading file");
+ ThrowMsg(Exceptions::EncryptionFailed, "Error reading file");
break;
}
}
void TaskEncryptResource::EncryptFile(const std::string &fileName)
{
- try
- {
- LogDebug("Encrypt file: " << fileName);
- std::string encFile = fileName + ".enc";
-
- struct stat info;
- memset(&info, 0, sizeof(info));
- if (stat(fileName.c_str(), &info) != 0)
- {
- int error = errno;
- ThrowMsg(Exceptions::InternalError,
- "Could not access file " << fileName <<
- "[" << DPL::GetErrnoString(error) << "]");
- }
- const std::size_t fileSize = info.st_size;
-
- DPL::ScopedFClose inFile(openFile(fileName, "r"));
- DPL::ScopedFClose outFile(openFile(encFile, "w"));
+ LogDebug("Encrypt file: " << fileName);
+ std::string encFile = fileName + ".enc";
- const std::size_t chunkSize = (fileSize > ENCRYPTION_CHUNK_MAX_SIZE
- ? ENCRYPTION_CHUNK_MAX_SIZE : fileSize);
-
- std::unique_ptr<unsigned char[]> inChunk(new unsigned char[chunkSize]);
- std::unique_ptr<unsigned char[]> outChunk;
-
- std::size_t bytesRead = 0;
- using namespace Tizen::Base;
+ struct stat info;
+ memset(&info, 0, sizeof(info));
+ if (stat(fileName.c_str(), &info) != 0)
+ {
+ int error = errno;
+ ThrowMsg(Exceptions::EncryptionFailed,
+ "Could not access file " << fileName <<
+ "[" << DPL::GetErrnoString(error) << "]");
+ }
+ const std::size_t fileSize = info.st_size;
- std::string pkgid =
- DPL::ToUTF8String(m_context.widgetConfig.tzAppid).c_str();
- const byte *b_pkgid = reinterpret_cast<const byte*>(
- pkgid.c_str());
- ByteBuffer appInfo;
- appInfo.Construct(pkgid.length());
- appInfo.SetArray(b_pkgid, 0, pkgid.length());
- appInfo.Flip();
+ DPL::ScopedFClose inFile(openFile(fileName, "r"));
+ DPL::ScopedFClose outFile(openFile(encFile, "w"));
- do
- {
- bytesRead = readBytes(inChunk.get(), chunkSize, inFile.Get());
- if (0 != bytesRead) {
- ByteBuffer *getBuffer = EncryptChunkByTrustZone(
- &appInfo,
- inChunk.get(), bytesRead);
- int decBufSize = getBuffer->GetRemaining();
-
- outChunk.reset(new unsigned char[decBufSize]);
- memcpy(outChunk.get(), getBuffer->GetPointer(), getBuffer->GetRemaining());
- getBuffer->Reset();
-
- char writeSize[ENCRYPTION_DEC_CHUNK_SIZE];
- memset(writeSize, 0x00, ENCRYPTION_DEC_CHUNK_SIZE);
- std::stringstream toString;
- toString << decBufSize;
- strncpy(writeSize, toString.str().c_str(), toString.str().length());
-
- writeBytes((unsigned char*)writeSize,
- ENCRYPTION_DEC_CHUNK_SIZE, outFile.Get());
- writeBytes(outChunk.get(), decBufSize, outFile.Get());
- }
+ const std::size_t chunkSize = (fileSize > ENCRYPTION_CHUNK_MAX_SIZE
+ ? ENCRYPTION_CHUNK_MAX_SIZE : fileSize);
- } while (0 == std::feof(inFile.Get()));
+ std::unique_ptr<unsigned char[]> inChunk(new unsigned char[chunkSize]);
+ std::unique_ptr<unsigned char[]> outChunk;
- outFile.Reset();
- inFile.Reset();
+ std::size_t bytesRead = 0;
+ using namespace Tizen::Base;
- LogDebug("File encrypted successfully");
- LogDebug("Remove plain-text file: " << fileName);
- if (0 != unlink(fileName.c_str()))
- {
- Throw(Exceptions::InternalError);
- }
+ std::string pkgid =
+ DPL::ToUTF8String(m_context.widgetConfig.tzAppid).c_str();
+ const byte *b_pkgid = reinterpret_cast<const byte*>(
+ pkgid.c_str());
+ ByteBuffer appInfo;
+ appInfo.Construct(pkgid.length());
+ appInfo.SetArray(b_pkgid, 0, pkgid.length());
+ appInfo.Flip();
- LogDebug("Rename encrypted file");
- if (0 != std::rename(encFile.c_str(), fileName.c_str()))
- {
- Throw(Exceptions::InternalError);
+ do
+ {
+ bytesRead = readBytes(inChunk.get(), chunkSize, inFile.Get());
+ if (0 != bytesRead) {
+ ByteBuffer *getBuffer = EncryptChunkByTrustZone(
+ &appInfo,
+ inChunk.get(), bytesRead);
+ int decBufSize = getBuffer->GetRemaining();
+
+ outChunk.reset(new unsigned char[decBufSize]);
+ memcpy(outChunk.get(), getBuffer->GetPointer(), getBuffer->GetRemaining());
+ getBuffer->Reset();
+
+ char writeSize[ENCRYPTION_DEC_CHUNK_SIZE];
+ memset(writeSize, 0x00, ENCRYPTION_DEC_CHUNK_SIZE);
+ std::stringstream toString;
+ toString << decBufSize;
+ strncpy(writeSize, toString.str().c_str(), toString.str().length());
+
+ writeBytes((unsigned char*)writeSize,
+ ENCRYPTION_DEC_CHUNK_SIZE, outFile.Get());
+ writeBytes(outChunk.get(), decBufSize, outFile.Get());
}
- std::string realPath = fileName;
- realPath.replace(0,
- m_context.locations->getTemporaryRootDir().length(),
- m_context.locations->getSourceDir());
+ } while (0 == std::feof(inFile.Get()));
- WrtDB::EncryptedFileInfo fileInfo;
- fileInfo.fileName = DPL::FromUTF8String(realPath);
- fileInfo.fileSize = fileSize;
+ outFile.Reset();
+ inFile.Reset();
- m_context.widgetConfig.encryptedFiles.insert(fileInfo);
+ LogDebug("File encrypted successfully");
+ LogDebug("Remove plain-text file: " << fileName);
+ if (0 != unlink(fileName.c_str()))
+ {
+ Throw(Exceptions::EncryptionFailed);
}
- Catch (Exceptions::InternalError)
+
+ LogDebug("Rename encrypted file");
+ if (0 != std::rename(encFile.c_str(), fileName.c_str()))
{
- ReThrowMsg(Exceptions::ExtractFileFailed, fileName);
+ Throw(Exceptions::EncryptionFailed);
}
+
+ std::string realPath = fileName;
+ realPath.replace(0,
+ m_context.locations->getTemporaryRootDir().length(),
+ m_context.locations->getSourceDir());
+
+ WrtDB::EncryptedFileInfo fileInfo;
+ fileInfo.fileName = DPL::FromUTF8String(realPath);
+ fileInfo.fileSize = fileSize;
+
+ m_context.widgetConfig.encryptedFiles.insert(fileInfo);
}
} //namespace WidgetInstall
if (euidaccess(storagePath.c_str(), F_OK) != 0) {
if (!WrtUtilMakeDir(storagePath, PRIVATE_STORAGE_MODE)) {
LogError("Failed to create directory for private storage");
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"Failed to create directory for private storage");
}
// '5000' is default uid, gid for applications.
WEBAPP_DEFAULT_UID,
WEBAPP_DEFAULT_GID) != 0)
{
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"Chown to invaild user");
}
} else if (euidaccess(storagePath.c_str(), W_OK | R_OK | X_OK) == 0) {
WEBAPP_DEFAULT_UID,
WEBAPP_DEFAULT_GID) != 0)
{
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"Chown to invaild user");
}
if (chmod(storagePath.c_str(), PRIVATE_STORAGE_MODE) != 0) {
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"chmod to 0700");
}
} else {
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"No access to private storage.");
}
}
if (!(rename(m_context.locations->getTemporaryPackageDir().c_str(),
instDir.c_str()) == 0))
{
- ThrowMsg(Exceptions::UnknownError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"Error occurs during renaming widget folder");
}
m_context.job->UpdateProgress(
list = g_list_append(list, dirDetail);
}
- if (false == m_context.existingWidgetInfo.isExist) {
- WidgetInstallToExtSingleton::Instance().preInstallation(list,
- folderSize);
- } else {
+ if (m_context.isUpdateMode) {
WidgetInstallToExtSingleton::Instance().preUpgrade(list,
folderSize);
+ } else {
+ WidgetInstallToExtSingleton::Instance().preInstallation(list,
+ folderSize);
}
free(dirDetail);
g_list_free(list);
if (!_FolderCopy(m_context.locations->getTemporaryPackageDir(),
m_context.locations->getSourceDir()))
{
- ThrowMsg(Exceptions::UnknownError,
+ ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
"Error occurs during renaming widget folder");
}
}
void TaskFileManipulation::StepAbortCreateExternalDir()
{
LogError("Abort StepAbortCreateExternalDir");
- if (false == m_context.existingWidgetInfo.isExist) {
- WidgetInstallToExtSingleton::Instance().postInstallation(false);
- } else {
+ if (m_context.isUpdateMode) {
WidgetInstallToExtSingleton::Instance().postUpgrade(false);
+ } else {
+ WidgetInstallToExtSingleton::Instance().postInstallation(false);
}
WidgetInstallToExtSingleton::Instance().deinitialize();
}
m_context(inCont),
writer(NULL)
{
- if (false == m_context.existingWidgetInfo.isExist) {
- AddStep(&TaskManifestFile::stepCopyIconFiles);
- AddStep(&TaskManifestFile::stepCreateExecFile);
- AddStep(&TaskManifestFile::stepGenerateManifest);
- AddStep(&TaskManifestFile::stepParseManifest);
- AddStep(&TaskManifestFile::stepFinalize);
-
- AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
- } else {
+ if (m_context.isUpdateMode) {
// for widget update.
AddStep(&TaskManifestFile::stepBackupIconFiles);
AddStep(&TaskManifestFile::stepCopyIconFiles);
AddStep(&TaskManifestFile::stepUpdateFinalize);
AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
+ } else {
+ AddStep(&TaskManifestFile::stepCopyIconFiles);
+ AddStep(&TaskManifestFile::stepCreateExecFile);
+ AddStep(&TaskManifestFile::stepGenerateManifest);
+ AddStep(&TaskManifestFile::stepParseManifest);
+ AddStep(&TaskManifestFile::stepFinalize);
+
+ AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
}
}
if(error)
LogPedantic("Failed to make a symbolic name for a file "
<< "[" << DPL::GetErrnoString(error) << "]");
- ThrowMsg(Exceptions::InstallationFailed,
+ ThrowMsg(Exceptions::FileOperationFailed,
"Symbolic link creating is not done.");
}
m_context.job->UpdateProgress(
DIR* dir = opendir(path);
if (!dir) {
LogError("icon directory doesn't exist");
- ThrowMsg(Exceptions::InternalError, path);
+ ThrowMsg(Exceptions::FileOperationFailed, path);
}
struct dirent entry;
if (code != 0) {
LogError("Manifest parser error: " << code);
- ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
}
// TODO : It will be removed. AIL update is temporary code request by pkgmgr
if (code != 0) {
LogError("Manifest parser error: " << code);
- ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
}
// TODO : It will be removed. AIL update is temporary code request by pkgmgr
if (0 != code) {
LogWarning("Manifest parser error: " << code);
- ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
}
int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
if (0 != ret) {
dir = opendir(m_npsource.c_str());
if (dir == NULL) {
LogError("Unable to open plugins directory");
- ThrowMsg(Exceptions::InternalError, "Unable to read plugins directory");
+ ThrowMsg(Exceptions::FileOperationFailed, "Unable to read plugins directory");
}
std::string tempname;
struct dirent entry;
LogDebug("Creating destination plugin directory");
if (!WrtUtilMakeDir(m_npdestination, InstallationPluginsDirMode)) {
LogError("Failed to create directory for plugins");
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"Failed to create directory for plugins");
}
if (rename(source.c_str(), destination.c_str()) != 0) {
LogError("Failed to move " << source << " to " << destination);
LogError("(errno: " << errno << ")");
- ThrowMsg(Exceptions::InternalError, "Failed to copy plugin file");
+ ThrowMsg(Exceptions::FileOperationFailed, "Failed to copy plugin file");
}
}
* architectures). */
if (!WrtUtilRemove(source)) {
LogError("Failed to plugins source remove directory");
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::FileOperationFailed,
"Failed to plugins source remove directory");
}
LogDebug("Plugins copying step ended");
int ret = fsync(temp->_fileno);
fclose(temp);
if (-1 == ret) {
- ThrowMsg(Exceptions::InternalError, "Fail to fsync for recovery.");
+ ThrowMsg(Exceptions::FileOperationFailed, "Fail to fsync for recovery.");
}
m_context.installInfo = infoPath.str();
LogDebug("Create file : " << m_context.installInfo);
} else {
- ThrowMsg(Exceptions::InternalError, "Fail to create file for recovery.");
+ ThrowMsg(Exceptions::FileOperationFailed, "Fail to create file for recovery.");
}
m_context.job->UpdateProgress(
DIR* pkgDir = opendir(dirPath.c_str());
if (!pkgDir) {
LogError("Package directory " << dirPath << " doesn't exist");
- ThrowMsg(Exceptions::InternalError,
+ ThrowMsg(Exceptions::BackupFailed,
"Error occurs during read \
directory");
}
std::string dirName = dirent.d_name;
std::string absFileName = dirPath + "/" + dirName;
if (stat(absFileName.c_str(), &statInfo) != 0) {
- ThrowMsg(Exceptions::InternalError, "Error occurs read file");
+ ThrowMsg(Exceptions::BackupFailed, "Error occurs read file");
}
if (S_ISDIR(statInfo.st_mode)) {
struct stat sInfo;
if (stat(resFile.c_str(), &sInfo) != 0) {
- ThrowMsg(Exceptions::InternalError, "Error occurs read file");
+ ThrowMsg(Exceptions::BackupFailed, "Error occurs read file");
}
if (S_ISDIR(sInfo.st_mode)) {
public:
WacSecurity() :
mRecognized(false),
- mDistributorSigned(false),
- mWacSigned(false)
+ mDistributorSigned(false)
{}
// from IWacSecurity
return mDistributorSigned;
}
+ // TODO : remove after wrt-commons released
virtual bool isWacSigned() const
{
- return mWacSigned;
+ return false;
}
virtual void getCertificateChainList(
{
mDistributorSigned = distributorSigned;
}
- void setWacSigned(bool wacSigned)
- {
- mWacSigned = wacSigned;
- }
void setAuthorCertificatePtr(ValidationCore::CertificatePtr certPtr)
{
mAuthorCertificate = certPtr;
bool mRecognized;
// known distribuor
bool mDistributorSigned;
- // distributor is wac
- bool mWacSigned;
// Author end entity certificate.
// Information from this certificate are shown to user
// during installation process.
// information.
InstallStep installStep; ///< current step of installation
Jobs::WidgetInstall::JobWidgetInstall *job;
- ///< pointer of instance of JobWidgetInstall
- WidgetUpdateInfo::ExistingWidgetInfo existingWidgetInfo;
- ///< Whether this is an update or normal installation
+ ///< Whether this is an update or normal installation
Jobs::WidgetInstall::FeatureLogicPtr featureLogic;
/** List of dev-caps that are requested in widget config file.
* Additional flag tells whether dev cap gets "static" permission
std::string installInfo; ///<For recovery>
bool m_quiet;
InstallLocationType locationType;
+ bool isUpdateMode;
};
#endif // INSTALLER_CONTEXT_H
#include <dpl/exception.h>
#include <job_exception_base.h>
+#include <job_exception_error.h>
//TODO SafeException(...)
+using namespace Jobs::Exceptions;
+
namespace Jobs {
namespace WidgetInstall {
namespace Exceptions {
-enum Type
-{
- Success, ///< Success
-
- ErrorInvalidWidgetPackage, ///< invalid widget package
- ErrorWidgetDoesNotExist, ///< given tizenAppId is invalid, no app
- ErrorAreadyUninstalling, ///< Widget is already being uninstalled
- ErrorInvalidPackage, ///< Widget signature is invalid.
- ErrorInternal, ///< Internal error due to inconsistency
- ErrorNotAllowed, ///< Widget installation or update not
- // allowed
- ///< because violation of policy ocurred
- ErrorDeferred, ///< Widget installation was deferred and
- // will be continued when possible
- ErrorDatabaseFailure, ///< Failure in database
- ErrorRemovingFolderFailure, ///< Failure in removing existing widget
- // folder
- ErrorCreateVconfFailure, ///< Failure in creating vconf
- ErrorInstallOspServcie, ///< Failure in installing osp service
- ErrorUpdateWidget, ///< Failure in widget update.
- ErrorInstallToExt, ///< Failure in install to sdcard
- ErrorUnknown ///< Temporary error. Try to not use this.
-};
DECLARE_JOB_EXCEPTION_BASE(JobExceptionBase, Base, ErrorUnknown)
-// PREPARE
-DECLARE_JOB_EXCEPTION(Base, NotAllowed, ErrorNotAllowed)
-DECLARE_JOB_EXCEPTION(Base, Deferred, ErrorDeferred)
+DECLARE_JOB_EXCEPTION(Base, OpenZipFailed, ErrorPackageInvalid)
+DECLARE_JOB_EXCEPTION(Base, ZipEmpty, ErrorPackageInvalid)
+DECLARE_JOB_EXCEPTION(Base, ExtractFileFailed, ErrorPackageInvalid)
+DECLARE_JOB_EXCEPTION(Base, EmptyPluginsDirectory, ErrorPackageInvalid)
+DECLARE_JOB_EXCEPTION(Base, PluginsSubdirectory, ErrorPackageInvalid)
-//UNZIP
-DECLARE_JOB_EXCEPTION(Base, OpenZipFailed, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, ZipEmpty, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, ExtractFileFailed, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, InternalError, ErrorInternal)
+DECLARE_JOB_EXCEPTION(Base, PackageLowerVersion, ErrorPackageLowerVersion)
-//CERTIFY
-DECLARE_JOB_EXCEPTION(Base, InvalidPackage, ErrorInvalidPackage)
+DECLARE_JOB_EXCEPTION(Base, ManifestInvalid, ErrorManifestInvalid)
-//WCONFIG
-DECLARE_JOB_EXCEPTION(Base, WidgetConfigFileInvalid, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, InstallationFailed, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, UnknownError, ErrorUnknown)
-DECLARE_JOB_EXCEPTION(Base, DatabaseFailure, ErrorDatabaseFailure)
-DECLARE_JOB_EXCEPTION(Base, RemovingFolderFailure, ErrorRemovingFolderFailure)
-DECLARE_JOB_EXCEPTION(Base, RemovingFileFailure, ErrorRemovingFolderFailure)
-DECLARE_JOB_EXCEPTION(Base, CreateVconfFailure, ErrorCreateVconfFailure)
+DECLARE_JOB_EXCEPTION(Base, WidgetConfigFileNotFound, ErrorConfigNotFound)
+DECLARE_JOB_EXCEPTION(Base, WidgetConfigFileInvalid, ErrorConfigInvalid)
-DECLARE_JOB_EXCEPTION(Base, CopyIconFailed, ErrorUnknown)
+DECLARE_JOB_EXCEPTION(Base, SignatureNotFound, ErrorSignatureNotFound)
-DECLARE_JOB_EXCEPTION(Base, ErrorExternalInstallingFailure, ErrorInstallToExt)
+DECLARE_JOB_EXCEPTION(Base, SignatureInvalid, ErrorSignatureInvalid)
-// Installation osp service
-DECLARE_JOB_EXCEPTION(Base, InstallOspsvcFailed, ErrorInstallOspServcie)
-//UPDATE
-DECLARE_JOB_EXCEPTION(Base, BackupFailed, ErrorUpdateWidget)
-DECLARE_JOB_EXCEPTION(Base, InsertNewWidgetFailed, ErrorUpdateWidget)
-DECLARE_JOB_EXCEPTION(Base, RemoveBackupFailed, ErrorUpdateWidget)
+DECLARE_JOB_EXCEPTION(Base, SignatureVerificationFailed, ErrorSignatureVerificationFailed)
+
+DECLARE_JOB_EXCEPTION(Base, RootCertificateNotFound, ErrorRootCertificateNotFound)
-//Database
-DECLARE_JOB_EXCEPTION(Base, UpdateFailed, ErrorInvalidWidgetPackage)
+DECLARE_JOB_EXCEPTION(Base, CertificationInvaid, ErrorCertificationInvaid)
+DECLARE_JOB_EXCEPTION(Base, NotMatchedCertification, ErrorCertificationInvaid)
-// Plugins copy errors
-DECLARE_JOB_EXCEPTION(Base, EmptyPluginsDirectory, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, PluginsSubdirectory, ErrorInvalidWidgetPackage)
+DECLARE_JOB_EXCEPTION(Base, CertificateChainVerificationFailed, ErrorCertificateChainVerificationFailed)
-DECLARE_JOB_EXCEPTION(Base, SetCertificateInfoFailed, ErrorUnknown)
+DECLARE_JOB_EXCEPTION(Base, CertificateExpired, ErrorCertificateExpired)
+
+DECLARE_JOB_EXCEPTION(Base, NotAllowed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, Deferred, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, WidgetRunningError, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, DRMFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, DatabaseFailure, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, RemovingFolderFailure, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, RemovingFileFailure, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, CreateVconfFailure, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, CopyIconFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, FileOperationFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, InstallToExternalFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, BackupFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, InsertNewWidgetFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, RemoveBackupFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, UpdateFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, SetCertificateInfoFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, ErrorExternalInstallingFailure, ErrorFatalError)
+
+DECLARE_JOB_EXCEPTION(Base, PackageAlreadyInstalled, ErrorPackageAlreadyInstalled)
+DECLARE_JOB_EXCEPTION(Base, AceCheckFailed, ErrorAceCheckFailed)
+DECLARE_JOB_EXCEPTION(Base, EncryptionFailed, ErrorEncryptionFailed)
+DECLARE_JOB_EXCEPTION(Base, InstallOspsvcFailed, ErrorInstallOspServcie)
} //namespace
} //namespace
} //namespace
typedef void (*InstallerFinishedCallback)(
void *userParam,
std::string tizenId,
- Jobs::WidgetInstall::Exceptions::Type);
+ Jobs::Exceptions::Type);
typedef void (*InstallerProgressCallback)(void *userParam,
ProgressPercent percent,
const ProgressDescription &);
-namespace WidgetUpdateMode {
+namespace InstallMode {
enum Type
{
- Zero = 0,
-
- // Bits
- NotInstalled = 1 << 0,
- IncomingVersionNotStd = 1 << 1,
- ExistingVersionNotStd = 1 << 2,
- BothVersionsNotStd = 1 << 3,
- ExistingVersionOlder = 1 << 4,
- ExistingVersionEqual = 1 << 5,
- ExistingVersionNewer = 1 << 6,
-
- // Policies
- PolicyNeverUpdate = NotInstalled,
-
- PolicyWac = NotInstalled |
- ExistingVersionOlder,
-
- PolicyAlwaysInstall = NotInstalled |
- IncomingVersionNotStd |
- ExistingVersionNotStd |
- BothVersionsNotStd |
- ExistingVersionOlder |
- ExistingVersionEqual |
- ExistingVersionNewer,
-
- PolicyForceInstall = PolicyAlwaysInstall,
- PolicyDirectoryForceInstall
+ INSTALL_MODE_WGT = 0,
+ INSTALL_MODE_DIRECTORY,
+ INSTALL_MODE_PRELOAD,
};
-
-inline Type operator | (const Type &a,
- const Type &b)
-{
- return static_cast<Type>(static_cast<unsigned long>(a) |
- static_cast<unsigned long>(b));
-}
-
-inline Type operator & (const Type &a,
- const Type &b)
-{
- return static_cast<Type>(static_cast<unsigned long>(a) &
- static_cast<unsigned long>(b));
-}
}
//TODO into namespace
//Widget Installation Struct
struct WidgetInstallationStruct : public WidgetInstallCallbackBase
{
- WidgetUpdateMode::Type updateMode;
+ InstallMode::Type m_installMode;
bool m_quiet;
- bool m_preload;
std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrInterface;
// It must be empty-constructible as a parameter of generic event
- WidgetInstallationStruct() : updateMode(WidgetUpdateMode::Zero),
- m_quiet(true),
- m_preload(false)
+ WidgetInstallationStruct() :
+ m_installMode(InstallMode::Type::INSTALL_MODE_WGT),
+ m_quiet(true)
{}
WidgetInstallationStruct(
InstallerFinishedCallback finished,
InstallerProgressCallback progress,
void *param,
- WidgetUpdateMode::Type mode,
+ InstallMode::Type mode,
bool quiet,
- bool preload,
std::shared_ptr<PackageManager::IPkgmgrSignal>
_pkgmgrInterface
) :
WidgetInstallCallbackBase(finished, progress, param),
- updateMode(mode),
+ m_installMode(mode),
m_quiet(quiet),
- m_preload(preload),
pkgmgrInterface(_pkgmgrInterface)
{}
};
#include "widget_update_info.h"
-WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo() :
- isExist(false)
-{}
-
-WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo(
- const WrtDB::TizenAppId & appid,
- const DPL::Optional<WidgetVersion> &version) :
- tzAppid(appid),
- isExist(true),
- existingVersion(version)
-{}
-
-WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo(
- const WrtDB::TizenAppId & appid,
- const DPL::Optional<DPL::String> &version) :
- tzAppid(appid),
- isExist(true)
+WidgetUpdateInfo::WidgetUpdateInfo(
+ const WrtDB::TizenAppId & appId,
+ const DPL::Optional<WidgetVersion> &existingversion,
+ const DPL::Optional<WidgetVersion> &incomingversion) :
+ tzAppId(appId),
+ existingVersion(existingversion),
+ incomingVersion(incomingversion)
{
- if (!!version) {
- existingVersion = WidgetVersion(*version);
- }
}
-WidgetUpdateInfo::WidgetUpdateInfo() :
- existingWidgetInfo()
-{}
-
-WidgetUpdateInfo::WidgetUpdateInfo(
- const DPL::Optional<WrtDB::WidgetGUID> &guid,
- const DPL::Optional<WidgetVersion> &version,
- ExistingWidgetInfo widgetInfo) :
- incomingGUID(guid),
- incomingVersion(version),
- existingWidgetInfo(widgetInfo)
-{}
*/
struct WidgetUpdateInfo
{
- struct ExistingWidgetInfo
- {
- WrtDB::TizenAppId tzAppid;
- bool isExist;
- DPL::Optional<WidgetVersion> existingVersion;
-
- ExistingWidgetInfo();
- ExistingWidgetInfo(const WrtDB::TizenAppId & tzAppid,
- const DPL::Optional<WidgetVersion> &version);
- ExistingWidgetInfo(const WrtDB::TizenAppId & tzAppid,
- const DPL::Optional<DPL::String> &version);
- };
-
+ WrtDB::TizenAppId tzAppId;
+ // Existing widget
+ DPL::Optional<WidgetVersion> existingVersion;
// Incoming widget
- DPL::Optional<WrtDB::WidgetGUID> incomingGUID;
DPL::Optional<WidgetVersion> incomingVersion;
- // Existing widget
- ExistingWidgetInfo existingWidgetInfo;
- WidgetUpdateInfo();
- WidgetUpdateInfo(const DPL::Optional<WrtDB::WidgetGUID> &guid,
- const DPL::Optional<WidgetVersion> &version,
- ExistingWidgetInfo widgetInfo);
+ WidgetUpdateInfo() {};
+ WidgetUpdateInfo(const WrtDB::TizenAppId & tzAppid,
+ const DPL::Optional<WidgetVersion> &existringversion,
+ const DPL::Optional<WidgetVersion> &incomingVersion);
};
#endif // SRC_DOMAIN_WIDGET_UPDATE_INFO_H
LogDebug("Call widget uninstall success finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
getRemovedTizenId(),
- Exceptions::Success);
+ Jobs::Exceptions::Success);
}
void JobWidgetUninstall::SendFinishedFailure()
void JobWidgetUninstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
{
- m_exceptionCaught = static_cast<Exceptions::Type>(e.getParam());
+ m_exceptionCaught = static_cast<Jobs::Exceptions::Type>(e.getParam());
m_exceptionMessage = e.GetMessage();
}
UninstallerContext m_context;
//TODO move it to base class of all jobs
- Exceptions::Type m_exceptionCaught;
+ Jobs::Exceptions::Type m_exceptionCaught;
std::string m_exceptionMessage;
public:
#define WIDGET_UNINSTALL_ERRORS_H_
#include <job_exception_base.h>
+#include <job_exception_error.h>
+
+using namespace Jobs::Exceptions;
namespace Jobs {
namespace WidgetUninstall {
namespace Exceptions {
-enum Type
-{
- Success,
-
- ErrorWidgetDoesNotExist,
- ErrorAlreadyUninstalling,
- ErrorDatabaseFailure,
- ErrorUninstallOspSvcFailed,
- ErrorPlatformAPI,
- ErrorUnknown
-};
DECLARE_JOB_EXCEPTION_BASE(JobExceptionBase, Base, ErrorUnknown)
-DECLARE_JOB_EXCEPTION(Base, DatabaseFailure, ErrorDatabaseFailure)
-DECLARE_JOB_EXCEPTION(Base, AlreadyUninstalling, ErrorAlreadyUninstalling)
-DECLARE_JOB_EXCEPTION(Base, WidgetNotExist, ErrorWidgetDoesNotExist)
-DECLARE_JOB_EXCEPTION(Base, UninstallOspSvcFailed, ErrorUninstallOspSvcFailed)
-DECLARE_JOB_EXCEPTION(Base, PlatformAPIFailure, ErrorPlatformAPI)
+DECLARE_JOB_EXCEPTION(Base, DatabaseFailure, ErrorWidgetUninstallationFailed)
+DECLARE_JOB_EXCEPTION(Base, AlreadyUninstalling,
+ ErrorWidgetUninstallationFailed)
+DECLARE_JOB_EXCEPTION(Base, WidgetNotExist, ErrorWidgetUninstallationFailed)
+DECLARE_JOB_EXCEPTION(Base, UninstallOspSvcFailed,
+ ErrorWidgetUninstallationFailed)
+DECLARE_JOB_EXCEPTION(Base, PlatformAPIFailure, ErrorWidgetUninstallationFailed)
} //namespace
} //namespace
} //namespace
typedef void (*UninstallerFinishedCallback)(
void *userParam,
std::string tizenId,
- Jobs::WidgetUninstall::Exceptions::Type);
+ Jobs::Exceptions::Type);
typedef void (*UninstallerProgressCallback)(
void *userParam,
void InstallerLogic::InstallSingleDeferredPackage()
{
LogWarning("Not implemented");
- // if (m_packagesToInstall.empty())
- // return;
- //
- // // Take single package
- // DPL::String widgetPackage = m_packagesToInstall.front();
- // m_packagesToInstall.pop_front();
- //
- // // Remove it from DB
- // GlobalDAO::RemoveDefferedWidgetPackageInstallation(widgetPackage);
- //
- // // Begin installation
- // LogInfo("Installing deferred widget package: " << widgetPackage);
- //
- // // Post installation
- // CONTROLLER_POST_EVENT(
- // InstallerController,
- // InstallerControllerEvents::InstallWidgetEvent(
- // DPL::ToUTF8String(widgetPackage).c_str(),
- // WidgetInstallationStruct(
- // &DummyInstallCallback, &DummyProgressCallback, NULL,
- // WidgetUpdateMode::PolicyWac)));
}
void InstallerLogic::InstallWaitingPlugins()
*
* @param widgetname name of widget
*/
- WidgetLocation(const std::string & widgetname);
+ explicit WidgetLocation(const std::string & widgetname);
/**
* @brief WidgetLocation Builds paths for widget location during
* installation
* @param icon path of application icon
*/
void setIconTargetFilenameForLocale(const std::string &icon);
- /**
- * @brief getIconTargetFilename gets icon path suffix for locale
- * @param languageTag language tag
- * @return value of suffix of path
- */
- DPL::String getIconTargetFilename(const DPL::String& languageTag) const;
+
/**
* @brief getIconTargetFilename gets icon full path
* @param languageTag language tag
#define PKGMGR_END_FAILURE "fail"
#define PKGMGR_PROGRESS_KEY "install_percent"
#define PKGMGR_ICON_PATH "icon_path"
+#define PKGMGR_ERROR "error"
typedef pkgmgr_installer* PkgmgrHandle;
)
SET(WRT_INSTALLER_SOURCES
- ${WRT_INSTALLER_DIR}/wrt_installer.cpp
+ ${WRT_INSTALLER_DIR}/wrt-installer.cpp
${WRT_INSTALLER_DIR}/wrt_installer_api.cpp
${WRT_INSTALLER_DIR}/installer_callbacks_translate.cpp
${WRT_INSTALLER_DIR}/plugin_utils.cpp
// callback for finished install
void installFinishedCallback(void *userParam,
std::string tizenId,
- Jobs::WidgetInstall::Exceptions::Type status)
+ Jobs::Exceptions::Type status)
{
Assert(userParam != NULL);
WrtErrStatus errorStatus;
switch (status) {
- case Jobs::WidgetInstall::Exceptions::Success:
+ case Jobs::Exceptions::Success:
errorStatus = WRT_SUCCESS;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorWidgetDoesNotExist:
- errorStatus = WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST;
+ case Jobs::Exceptions::ErrorPackageNotFound:
+ errorStatus = WRT_INSTALLER_ERROR_PACKAGE_NOT_FOUND;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorAreadyUninstalling:
- errorStatus = WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING;
+ case Jobs::Exceptions::ErrorPackageLowerVersion:
+ errorStatus = WRT_INSTALLER_ERROR_PACKAGE_LOWER_VERSION;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorInvalidPackage:
- errorStatus = WRT_INSTALLER_ERROR_INVALID_CERTIFICATE;
+ case Jobs::Exceptions::ErrorManifestNotFound:
+ errorStatus = WRT_INSTALLER_ERROR_MANIFEST_NOT_FOUND;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorInternal:
- errorStatus = WRT_INSTALLER_ERROR_INTERNAL;
+ case Jobs::Exceptions::ErrorManifestInvalid:
+ errorStatus = WRT_INSTALLER_ERROR_MANIFEST_INVALID;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorNotAllowed:
- errorStatus = WRT_INSTALLER_ERROR_NOT_ALLOWED;
+ case Jobs::Exceptions::ErrorConfigNotFound:
+ errorStatus = WRT_INSTALLER_CONFIG_NOT_FOUND;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorDeferred:
- errorStatus = WRT_INSTALLER_ERROR_DEFERRED;
+ case Jobs::Exceptions::ErrorConfigInvalid:
+ errorStatus = WRT_INSTALLER_ERROR_CONFIG_INVALID;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorDatabaseFailure:
- errorStatus = WRT_INSTALLER_ERROR_DATABASE_FAILURE;
+ case Jobs::Exceptions::ErrorSignatureNotFound:
+ errorStatus = WRT_INSTALLER_ERROR_SIGNATURE_NOT_FOUND;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorInstallOspServcie:
- errorStatus = WRT_INSTALLER_ERROR_OSPSVC;
+ case Jobs::Exceptions::ErrorSignatureInvalid:
+ errorStatus = WRT_INSTALLER_ERROR_SIGNATURE_INVALID;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorUnknown:
- errorStatus = WRT_INSTALLER_ERROR_UNKNOWN;
+ case Jobs::Exceptions::ErrorSignatureVerificationFailed:
+ errorStatus = WRT_INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED;
+ break;
+
+ case Jobs::Exceptions::ErrorRootCertificateNotFound:
+ errorStatus = WRT_INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND;
+ break;
+
+ case Jobs::Exceptions::ErrorCertificationInvaid:
+ errorStatus = WRT_INSTALLER_ERROR_CERTIFICATION_INVAID;
+ break;
+
+ case
+ Jobs::Exceptions::ErrorCertificateChainVerificationFailed:
+ errorStatus =
+ WRT_INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED;
+ break;
+
+ case Jobs::Exceptions::ErrorCertificateExpired:
+ errorStatus = WRT_INSTALLER_ERROR_CERTIFICATE_EXPIRED;
+ break;
+
+ case Jobs::Exceptions::ErrorInvalidPrivilege:
+ errorStatus = WRT_INSTALLER_ERROR_INVALID_PRIVILEGE;
+ break;
+
+ case Jobs::Exceptions::ErrorMenuIconNotFound:
+ errorStatus = WRT_INSTALLER_ERROR_MENU_ICON_NOT_FOUND;
+ break;
+
+ case Jobs::Exceptions::ErrorFatalError:
+ errorStatus = WRT_INSTALLER_ERROR_FATAL_ERROR;
+ break;
+
+ case Jobs::Exceptions::ErrorOutOfStorage:
+ errorStatus = WRT_INSTALLER_ERROR_OUT_OF_STORAGE;
+ break;
+
+ case Jobs::Exceptions::ErrorOutOfMemory:
+ errorStatus = WRT_INSTALLER_ERROR_OUT_OF_MEMORY;
+ break;
+
+ case Jobs::Exceptions::ErrorPackageAlreadyInstalled:
+ errorStatus = WRT_INSTALLER_ERROR_PACKAGE_ALREADY_INSTALLED;
+ break;
+
+ case Jobs::Exceptions::ErrorAceCheckFailed:
+ errorStatus = WRT_INSTALLER_ERROR_ACE_CHECK_FAILED;
+ break;
+
+ case Jobs::Exceptions::ErrorManifestCreateFailed:
+ errorStatus = WRT_INSTALLER_ERROR_MANIFEST_CREATE_FAILED;
+ break;
+
+ case Jobs::Exceptions::ErrorEncryptionFailed:
+ errorStatus = WRT_INSTALLER_ERROR_ENCRYPTION_FAILED;
+ break;
+
+ case Jobs::Exceptions::ErrorInstallOspServcie:
+ errorStatus = WRT_INSTALLER_ERROR_INSTALL_OSP_SERVCIE;
break;
default:
// callback for finished install
void uninstallFinishedCallback(void *userParam,
std::string tizenId,
- Jobs::WidgetUninstall::Exceptions::Type status)
+ Jobs::Exceptions::Type status)
{
Assert(userParam != NULL);
WrtErrStatus errorStatus;
switch (status) {
- case Jobs::WidgetUninstall::Exceptions::Success:
+ case Jobs::Exceptions::Success:
errorStatus = WRT_SUCCESS;
break;
- case Jobs::WidgetUninstall::Exceptions::ErrorAlreadyUninstalling:
- errorStatus = WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING;
- break;
-
- case Jobs::WidgetUninstall::Exceptions::ErrorWidgetDoesNotExist:
- errorStatus = WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST;
- break;
-
- case Jobs::WidgetUninstall::Exceptions::ErrorDatabaseFailure:
- errorStatus = WRT_INSTALLER_ERROR_DATABASE_FAILURE;
- break;
-
- case Jobs::WidgetUninstall::Exceptions::ErrorUninstallOspSvcFailed:
- errorStatus = WRT_INSTALLER_ERROR_OSPSVC;
+ case Jobs::Exceptions::ErrorWidgetUninstallationFailed:
+ errorStatus = WRT_INSTALLER_ERROR_UNINSTALLATION_FAILED;
break;
- case Jobs::WidgetUninstall::Exceptions::ErrorUnknown:
+ case Jobs::Exceptions::ErrorUnknown:
errorStatus = WRT_INSTALLER_ERROR_UNKNOWN;
break;
}
void pluginInstallFinishedCallback(void *userParam,
- Jobs::PluginInstall::Exceptions::Type status)
+ Jobs::Exceptions::Type status)
{
Assert(userParam);
WrtErrStatus errorStatus;
switch (status) {
- case Jobs::PluginInstall::Exceptions::Success:
+ case Jobs::Exceptions::Success:
errorStatus = WRT_SUCCESS;
break;
- case Jobs::PluginInstall::Exceptions::WrongPluginPath:
- errorStatus = WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH;
- break;
- case Jobs::PluginInstall::Exceptions::MetafileError:
- errorStatus = WRT_PLUGIN_INSTALLER_ERROR_METAFILE;
- break;
- case Jobs::PluginInstall::Exceptions::AlreadyInstalled:
- errorStatus = WRT_PLUGIN_INSTALLER_ERROR_ALREADY_INSTALLED;
- break;
- case Jobs::PluginInstall::Exceptions::LoadingLibraryError:
- errorStatus = WRT_PLUGIN_INSTALLER_ERROR_LIBRARY_ERROR;
- break;
- case Jobs::PluginInstall::Exceptions::InstallationWaiting:
- errorStatus = WRT_PLUGIN_INSTALLER_ERROR_WAITING;
- break;
+ case Jobs::Exceptions::ErrorPluginInstallationFailed:
+ errorStatus = WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED;
default:
errorStatus = WRT_INSTALLER_ERROR_UNKNOWN;
break;
void installFinishedCallback(void *userParam,
std::string tizenId,
- Jobs::WidgetInstall::Exceptions::Type status);
+ Jobs::Exceptions::Type status);
void uninstallFinishedCallback(void *userParam,
std::string tizenId,
- Jobs::WidgetUninstall::Exceptions::Type status);
+ Jobs::Exceptions::Type status);
void pluginInstallFinishedCallback(void *userParam,
- Jobs::PluginInstall::Exceptions::Type status);
+ Jobs::Exceptions::Type status);
// callback for progress of install OR uninstall
void installProgressCallback(void *userParam,
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/* @file wrt_installer.cpp
+/* @file wrt-installer.cpp
* @version 1.0
* @brief Implementation file for installer
*/
-#include "wrt_installer.h"
+#include "wrt-installer.h"
#include "plugin_utils.h"
-#include <cstdlib>
#include <string>
-#include <fstream>
-#include <unistd.h>
-#include <memory>
+#include <cstring>
+#include <cstdlib>
+#include <dirent.h>
#include <sys/resource.h>
+
+#include <dpl/log/log.h>
#include <dpl/optional.h>
-#include <dpl/scoped_free.h>
#include <dpl/optional_typedefs.h>
#include <dpl/exception.h>
-#include <dpl/sstream.h>
-#include <vconf.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/wrt-dao-ro/config_parser_data.h>
-#include <dpl/localization/localization_utils.h>
-#include <dpl/optional_typedefs.h>
#include <dpl/string.h>
#include <dpl/abstract_waitable_input_adapter.h>
#include <dpl/abstract_waitable_output_adapter.h>
#include <dpl/copy.h>
#include <dpl/errno_string.h>
#include <dpl/utils/wrt_global_settings.h>
-#include "option_parser.h"
#include <parser_runner.h>
#include <widget_parser.h>
#include <root_parser.h>
-#define NOFILE_CNT_FOR_INSTALLER 9999
+#include <Elementary.h>
+
+#include <pkg-manager/pkgmgr_signal_interface.h>
+#include <pkg-manager/pkgmgr_signal_dummy.h>
+#include <pkg-manager/pkgmgr_signal.h>
using namespace WrtDB;
namespace { // anonymous
-const char AUL_ARG_KEY[] = "widget_arg";
const char * const PKGMGR_INSTALL_MSG = "Install widget";
const char * const PKGMGR_UNINSTALL_MSG = "Uninstall widget";
-const double BASE_LAYOUT_W = 720.0f;
-const double BASE_LAYOUT_H = 1280.0f;
-
const char * const CONFIG_XML = "config.xml";
const char * const HYBRID_CONFIG_XML = "res/wgt/config.xml";
+const unsigned int NOFILE_CNT_FOR_INSTALLER = 9999;
+
struct free_deleter
{
void operator()(void* x)
WrtInstaller::WrtInstaller(int argc, char **argv) :
Application(argc, argv, "backend", false),
DPL::TaskDecl<WrtInstaller>(this),
- m_installPolicy(WRT_WIM_NOT_INSTALLED),
+ m_installMode(WRT_INSTALL_MODE_UNKNOWN),
m_packagePath(),
- m_handle(-1),
m_initialized(false),
m_numPluginsToInstall(0),
m_totalPlugins(0),
m_installByPkgmgr(false),
m_quiet(true),
m_popup(NULL),
- m_startupPluginInstallation(false),
- m_preloadWidget(false)
+ m_startupPluginInstallation(false)
{
Touch();
LogDebug("App Created");
LogDebug("App Finished");
}
+int WrtInstaller::getReturnStatus() const
+{
+ if (!m_returnStatus) {
+ return RE_SUCCESS;
+ } else {
+ return RE_FAIL;
+ }
+}
+
+WrtInstaller::InstallerPopup::InstallerPopup() :
+ m_win(NULL),
+ m_popup(NULL),
+ m_progressbar(NULL)
+{}
+
+WrtInstaller::InstallerPopup::~InstallerPopup()
+{
+ LogDebug("App Finished");
+}
+
+void WrtInstaller::InstallerPopup::init()
+{
+ LogDebug("Window Init");
+
+ if (m_win == NULL) {
+ // create window
+ m_win = createWin("wrt-installer");
+
+ // create popup
+ m_popup = elm_popup_add(m_win);
+
+ // create progressbar
+ m_progressbar = elm_progressbar_add(m_popup);
+ elm_object_style_set(m_progressbar, "list_progress");
+ elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
+ evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_object_content_set(m_popup, m_progressbar);
+ elm_progressbar_value_set(m_progressbar, 0.0);
+ evas_object_show(m_progressbar);
+
+ evas_object_show(m_popup);
+ evas_object_show(m_win);
+ }
+}
+
+Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name)
+{
+ Evas_Object *win;
+ win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
+
+ int w, h;
+ if (!win) {
+ return NULL;
+ }
+
+ elm_win_alpha_set(win, EINA_TRUE);
+ elm_win_title_set(win, name);
+ elm_win_borderless_set(win, EINA_TRUE);
+ elm_win_raise(win);
+
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(win, w, h);
+ return win;
+}
+
+void WrtInstaller::InstallerPopup::showPopup(void* userdata,
+ const DPL::String& pkgMsg,
+ ShowResultCallback callback)
+{
+ Evas_Object *btn;
+
+ LogDebug("Result Popup Created");
+ evas_object_del(m_popup);
+ m_popup = NULL;
+
+ m_popup = elm_popup_add(m_win);
+ if (!m_popup) {
+ return;
+ }
+
+ btn = elm_button_add(m_popup);
+ if (!btn) {
+ evas_object_del(m_popup);
+ return;
+ }
+ elm_object_text_set(btn, "OK");
+ evas_object_smart_callback_add(btn, "clicked", callback, userdata);
+ elm_object_part_content_set(m_popup, "button1", btn);
+ elm_object_part_text_set(m_popup, "title,text", "RESULT");
+ elm_object_text_set(m_popup, DPL::ToUTF8String(pkgMsg).c_str());
+
+ evas_object_show(m_popup);
+ evas_object_show(m_win);
+}
+
void WrtInstaller::OnStop()
{
LogInfo("Stopping Dummy Client");
struct stat info;
if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) {
LogInfo("Installing package directly from directory");
- m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_DIRECTORY;
} else {
LogInfo("Installing from regular location");
- m_installPolicy = WRT_WIM_POLICY_WAC;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_WGT;
}
m_packagePath = m_argv[2];
AddStep(&WrtInstaller::installStep);
- } else if (arg == "-if" || arg == "--install-force") {
- if (m_argc != 3) {
- return showHelpAndQuit();
- }
-
- m_packagePath = m_argv[2];
- m_installPolicy = WRT_WIM_POLICY_FORCE_INSTALL;
- AddStep(&WrtInstaller::installStep);
} else if (arg == "-il" || arg == "--install-preload") {
if (m_argc != 3) {
return showHelpAndQuit();
}
-
m_packagePath = m_argv[2];
- m_preloadWidget = true;
- m_installPolicy = WRT_WIM_POLICY_WAC;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_PRELOAD;
AddStep(&WrtInstaller::installStep);
} else if (arg == "-un" || arg == "--uninstall-name") {
if (m_argc != 3) {
}
m_name = m_argv[2];
AddStep(&WrtInstaller::uninstallPkgNameStep);
- } else if (arg == "-ug" || arg == "--uninstall-guid") {
- if (m_argc != 3) {
- return showHelpAndQuit();
- }
- m_name = m_argv[2];
- AddStep(&WrtInstaller::uninstallGuidStep);
} else if (arg == "-up" || arg == "--uninstall-packagepath") {
if (m_argc != 3) {
return showHelpAndQuit();
struct stat info;
if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
LogInfo("Installing package directly from directory");
- m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_DIRECTORY;
} else {
LogInfo("Installing from regular location");
- m_installPolicy = WRT_WIM_POLICY_WAC;
+ m_installMode = WRT_INSTALL_MODE_INSTALL_WGT;
}
AddStep(&WrtInstaller::installStep);
break;
WRTInstallerNS::NextStepEvent());
}
-void WrtInstaller::OnReset(bundle *b)
+void WrtInstaller::OnReset(bundle* /*b*/)
{
- const char * bundledVal = bundle_get_val(b, AUL_ARG_KEY);
- if (bundledVal != NULL) {
- m_bundleValue = bundledVal;
- LogInfo("Bundled value for (" << AUL_ARG_KEY << ") key received: " <<
- m_bundleValue);
- }
-}
-
-int WrtInstaller::getReturnStatus() const
-{
- if (!m_returnStatus) {
- return RE_SUCCESS;
- } else {
- return RE_FAIL;
- }
+ LogDebug("OnReset");
}
void WrtInstaller::OnTerminate()
void WrtInstaller::showHelpAndQuit()
{
- printf("Usage: wrt-installer [OPTION]... [WIDGET: ID/NAME/GUID/PATH]...\n"
+ printf("Usage: wrt-installer [OPTION]... [WIDGET: ID/NAME/PATH]...\n"
"Operate with WebRuntime daemon: install, uninstall"
" and launch widgets.\n"
"Query list of installed widgets and setup up debugging support.\n"
" -p, --install-plugins install plugins\n"
" -i, --install "
"install or update widget package for given path\n"
- " -if, --install-force "
- "install forcibly widget package for given path\n"
" -un, --uninstall-name "
"uninstall widget for given package name\n"
- " -ug, --uninstall-guid "
- "uninstall widget for given Global Unique IDentifier\n"
" -up, --uninstall-packagepath "
"uninstall widget for given package file path\n"
"\n");
this, &staticWrtStatusCallback,
(!m_quiet || m_installByPkgmgr)
? &staticWrtInstallProgressCallback : NULL,
- m_installPolicy,
+ m_installMode,
m_quiet,
- m_preloadWidget,
pkgmgrSignalInterface);
}
} else if (!PluginUtils::lockPluginInstallation()) {
LogError("Failed to open plugin installation lock file"
" Plugins are currently installed by other process");
- staticWrtPluginInstallationCallback(WRT_PLUGIN_INSTALLER_ERROR_LOCK,
+ staticWrtPluginInstallationCallback(WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED,
this);
return;
}
pkgmgrSignalInterface);
}
-void WrtInstaller::uninstallGuidStep()
-{
- LogDebug("Uninstalling widget ...");
- std::string appid;
- WrtErrStatus status = wrt_get_widget_by_guid(appid, m_name);
- if (status == WRT_SUCCESS) {
- LogDebug("Guid : " << m_name);
- wrt_uninstall_widget(
- appid.c_str(), this, &staticWrtStatusCallback,
- !m_quiet ? &staticWrtUninstallProgressCallback :
- NULL,
- pkgmgrSignalInterface);
- } else {
- printf("failed: can not uninstall widget\n");
- LogError("Fail to uninstalling widget... ");
- m_returnStatus = -1;
- DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
- PostEvent(
- WRTInstallerNS::QuitEvent());
- }
-}
-
void WrtInstaller::unistallWgtFileStep()
{
LogDebug("Uninstalling widget ...");
resultMsg = DPL::FromUTF8String(PKGMGR_INSTALL_MSG);
printMsg = "installation";
} else if (current == &WrtInstaller::uninstallPkgNameStep ||
- current == &WrtInstaller::uninstallGuidStep ||
current == &WrtInstaller::unistallWgtFileStep)
{
resultMsg = DPL::FromUTF8String(PKGMGR_UNINSTALL_MSG);
}
switch (status) {
- case WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE:
+ case WRT_INSTALLER_ERROR_PACKAGE_NOT_FOUND:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - widget package does not exist\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_PACKAGE_INVALID:
This->m_returnStatus = 1; //this status is specific
fprintf(stderr, "## wrt-installer : %s %s has failed - invalid widget package\n",
tizenId.c_str(), printMsg.c_str());
break;
- case WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST:
- fprintf(stderr, "## wrt-installer : %s %s has failed - widget package does not exist\n",
+ case WRT_INSTALLER_ERROR_PACKAGE_LOWER_VERSION:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - given"
+ " version is lower than existing version\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_MANIFEST_NOT_FOUND:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - manifest"
+ " file doesn't find in package.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_MANIFEST_INVALID:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid manifestx.xml\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_CONFIG_NOT_FOUND:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "config.xml does not exist\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_CONFIG_INVALID:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid config.xml\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_SIGNATURE_NOT_FOUND:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "signature doesn't exist in package.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_SIGNATURE_INVALID:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid signature.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "signature verification failed.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "root certificate could not find.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_CERTIFICATION_INVAID:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid certification.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "certificate chain verification failed.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_CERTIFICATE_EXPIRED:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "certificate expired.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_INVALID_PRIVILEGE:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid privilege\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_MENU_ICON_NOT_FOUND:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "menu icon could not find\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_FATAL_ERROR:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "fatal error\n",
tizenId.c_str(), printMsg.c_str());
break;
- case WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING:
- fprintf(stderr, "## wrt-installer : %s %s has failed - already uninstalling\n",
+ case WRT_INSTALLER_ERROR_OUT_OF_STORAGE:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "out of storage\n",
tizenId.c_str(), printMsg.c_str());
break;
- case WRT_INSTALLER_ERROR_INVALID_CERTIFICATE:
- fprintf(stderr,"## wrt-installer : %s %s has failed - invalid certificate - invalid signature\n",
+ case WRT_INSTALLER_ERROR_OUT_OF_MEMORY:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "out of memory\n",
tizenId.c_str(), printMsg.c_str());
break;
- case WRT_INSTALLER_ERROR_ALREADY_INSTALLED:
- fprintf(stderr,"## wrt-installer : %s %s has failed - already installed\n",
+ case WRT_INSTALLER_ERROR_PACKAGE_ALREADY_INSTALLED:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "package already installed\n",
tizenId.c_str(), printMsg.c_str());
break;
- case WRT_INSTALLER_ERROR_INTERNAL:
- fprintf(stderr,"## wrt-installer : %s %s has failed - internal error\n",
+ case WRT_INSTALLER_ERROR_ACE_CHECK_FAILED:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "ace check failure\n",
tizenId.c_str(), printMsg.c_str());
break;
- case WRT_INSTALLER_ERROR_NOT_ALLOWED:
- fprintf(stderr,"## wrt-installer : %s %s has failed - installation or update not allowed; invalid"
- " mode\n", tizenId.c_str(), printMsg.c_str());
+ case WRT_INSTALLER_ERROR_MANIFEST_CREATE_FAILED:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "to create manifest failed\n",
+ tizenId.c_str(), printMsg.c_str());
break;
- case WRT_INSTALLER_ERROR_DEFERRED:
- fprintf(stderr,"## wrt-installer : deferred: widget update will continue after the widget"
- " has been stopped\n");
+ case WRT_INSTALLER_ERROR_ENCRYPTION_FAILED:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "encryption of resource failed\n",
+ tizenId.c_str(), printMsg.c_str());
break;
- case WRT_INSTALLER_ERROR_DATABASE_FAILURE:
- fprintf(stderr,"## wrt-installer : %s %s has failed - database failure\n",
+ case WRT_INSTALLER_ERROR_INSTALL_OSP_SERVCIE:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "installation of osp service failed\n",
tizenId.c_str(), printMsg.c_str());
break;
- case WRT_INSTALLER_ERROR_OSPSVC:
- fprintf(stderr,"## wrt-installer : %s %s has failed - during installation or"
- " uninstallation osp service\n", tizenId.c_str(),
- printMsg.c_str());
+ case WRT_INSTALLER_ERROR_UNINSTALLATION_FAILED:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "widget uninstallation failed\n",
+ tizenId.c_str(), printMsg.c_str());
break;
+
case WRT_INSTALLER_ERROR_UNKNOWN:
fprintf(stderr,"## wrt-installer : %s %s has failed - unknown error\n",
tizenId.c_str(), printMsg.c_str());
// Failure
LogWarning("One of the plugins installation failed!: " << path);
- if (WRT_PLUGIN_INSTALLER_ERROR_WAITING == status) {
- LogInfo("Plugin installation is waiting for dependencies");
- fprintf(stderr, "## wrt-installer : plugin installation failed [%s]\n",
- path.c_str());
- }
-
switch (status) {
- case WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH:
- LogError("failed: wrong path to plugin directory\n");
- break;
-
- case WRT_PLUGIN_INSTALLER_ERROR_METAFILE:
- LogError("failed: plugin metafile error\n");
- break;
-
- case WRT_PLUGIN_INSTALLER_ERROR_ALREADY_INSTALLED:
- LogError("failed: plugin already installed\n");
+ case WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED:
+ LogError("failed: plugin installation failed\n");
break;
- case WRT_PLUGIN_INSTALLER_ERROR_LIBRARY_ERROR:
- LogError("failed: plugin library: missing symbols or structures\n");
- break;
-
- case WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN:
+ case WRT_INSTALLER_ERROR_UNKNOWN:
LogError("failed: unknown error\n");
break;
}
}
-WrtInstaller::InstallerPopup::InstallerPopup() :
- m_win(NULL),
- m_popup(NULL),
- m_progressbar(NULL)
-{}
-
-WrtInstaller::InstallerPopup::~InstallerPopup()
-{
- LogDebug("App Finished");
-}
-
-void WrtInstaller::InstallerPopup::init()
-{
- LogDebug("Window Init");
-
- if (m_win == NULL) {
- // create window
- m_win = createWin("wrt-installer");
-
- // create popup
- m_popup = elm_popup_add(m_win);
-
- // create progressbar
- m_progressbar = elm_progressbar_add(m_popup);
- elm_object_style_set(m_progressbar, "list_progress");
- elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
- evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- elm_object_content_set(m_popup, m_progressbar);
- elm_progressbar_value_set(m_progressbar, 0.0);
- evas_object_show(m_progressbar);
-
- evas_object_show(m_popup);
- evas_object_show(m_win);
- }
-}
-
-Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name)
-{
- Evas_Object *win;
- win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
-
- int w, h;
- if (!win) {
- return NULL;
- }
-
- elm_win_alpha_set(win, EINA_TRUE);
- elm_win_title_set(win, name);
- elm_win_borderless_set(win, EINA_TRUE);
- elm_win_raise(win);
-
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
- evas_object_resize(win, w, h);
- return win;
-}
-
-void WrtInstaller::InstallerPopup::showPopup(void* userdata,
- const DPL::String& pkgMsg,
- ShowResultCallback callback)
-{
- Evas_Object *btn;
-
- LogDebug("Result Popup Created");
- evas_object_del(m_popup);
- m_popup = NULL;
-
- m_popup = elm_popup_add(m_win);
- if (!m_popup) {
- return;
- }
-
- btn = elm_button_add(m_popup);
- if (!btn) {
- evas_object_del(m_popup);
- return;
- }
- elm_object_text_set(btn, "OK");
- evas_object_smart_callback_add(btn, "clicked", callback, userdata);
- elm_object_part_content_set(m_popup, "button1", btn);
- elm_object_part_text_set(m_popup, "title,text", "RESULT");
- elm_object_text_set(m_popup, DPL::ToUTF8String(pkgMsg).c_str());
-
- evas_object_show(m_popup);
- evas_object_show(m_win);
-}
-
void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/,
void* /*event_info*/)
{
* limitations under the License.
*/
/**
- * @file wrt_installer.h
+ * @file wrt-installer.h
* @version 1.0
* @brief Implementation file for installer
*/
-#ifndef WRT_CLIENT_H
-#define WRT_CLIENT_H
+#ifndef WRT_INSTALLER_H
+#define WRT_INSTALLER_H
#include <dpl/application.h>
#include <dpl/generic_event.h>
#include <dpl/event/controller.h>
-#include <dpl/type_list.h>
#include <dpl/task.h>
-#include <dpl/log/log.h>
#include <dpl/string.h>
#include <string>
-#include <utilX.h>
#include <wrt_installer_api.h>
-#include <pkg-manager/pkgmgr_signal_interface.h>
-#include <pkg-manager/pkgmgr_signal_dummy.h>
-#include <pkg-manager/pkgmgr_signal.h>
-#include <memory>
-
namespace WRTInstallerNS { //anonymous
DECLARE_GENERIC_EVENT_0(QuitEvent)
DECLARE_GENERIC_EVENT_0(NextStepEvent)
// Installation steps
void initStep();
void installStep();
- void installNewPlugins();
void installPluginsStep();
void uninstallPkgNameStep();
- void uninstallGuidStep();
void unistallWgtFileStep();
void shutdownStep();
- void registerCallbackStep();
- void queryListStep();
// Static callbacks
static void staticWrtInitCallback(WrtErrStatus status,
static void failResultCallback(void *data, Evas_Object *obj,
void *event_info);
+ void installNewPlugins();
bool popupsEnabled() const;
// Private data
std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrSignalInterface;
- wrt_widget_install_mode_e m_installPolicy;
- std::string m_bundleValue;
+ WrtInstallMode m_installMode;
std::string m_packagePath;
- int m_handle;
std::string m_name;
bool m_initialized;
size_t m_numPluginsToInstall;
bool m_quiet;
InstallerPopup *m_popup;
bool m_startupPluginInstallation;
- std::string m_webAppConfig;
- std::string m_webAppIcon;
- bool m_preloadWidget;
typedef std::list<std::string> PluginPathList;
DPL::Optional<PluginPathList> m_pluginsPaths;
};
-#endif // WRT_CLIENT_H
+#endif // WRT_INSTALLER_H
\ No newline at end of file
using namespace WrtDB;
-#undef TRUE
-#undef FALSE
-#define TRUE 0
-#define FALSE -1
-
#ifdef __cplusplus
#define EXPORT_API __attribute__((visibility("default")))
extern "C"
{
#endif
-inline WidgetUpdateMode::Type translateWidgetUpdateMode(
- wrt_widget_update_mode_t updateMode)
+inline InstallMode::Type translateInstallMode(
+ WrtInstallMode installMode)
{
- if (updateMode == WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL) {
- return WidgetUpdateMode::PolicyDirectoryForceInstall;
- }
-
- WidgetUpdateMode::Type result = WidgetUpdateMode::Zero;
- if (updateMode & WRT_WIM_NOT_INSTALLED) {
- result = result | WidgetUpdateMode::NotInstalled;
- }
-
- if (updateMode & WRT_WIM_INCOMING_VERSION_NOT_STD) {
- result = result | WidgetUpdateMode::IncomingVersionNotStd;
- }
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_NOT_STD) {
- result = result | WidgetUpdateMode::ExistingVersionNotStd;
- }
-
- if (updateMode & WRT_WIM_BOTH_VERSIONS_NOT_STD) {
- result = result | WidgetUpdateMode::BothVersionsNotStd;
- }
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_OLDER) {
- result = result | WidgetUpdateMode::ExistingVersionOlder;
+ if (WRT_INSTALL_MODE_INSTALL_WGT == installMode) {
+ return InstallMode::INSTALL_MODE_WGT;
+ } else if (WRT_INSTALL_MODE_INSTALL_DIRECTORY == installMode) {
+ return InstallMode::INSTALL_MODE_DIRECTORY;
+ } else if (WRT_INSTALL_MODE_INSTALL_PRELOAD == installMode) {
+ return InstallMode::INSTALL_MODE_PRELOAD;
}
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_EQUAL) {
- result = result | WidgetUpdateMode::ExistingVersionEqual;
- }
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_NEWER) {
- result = result | WidgetUpdateMode::ExistingVersionNewer;
- }
-
- return result;
+ Assert(true && "wrong argument is inputed");
}
const char PLUGIN_INSTALL_SEMAPHORE[] = "/.wrt_plugin_install_lock";
LogError("Fail to install plugin : " << plugin_data->plugin_path);
switch (status) {
- case WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH:
+ case WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED:
LogError("Failed : Plugin install path is wrong");
break;
- case WRT_PLUGIN_INSTALLER_ERROR_METAFILE:
- LogError("Failed : Plugin Metafile Error");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_ALREADY_INSTALLED:
- LogError("Failed : This Plugin is already installed");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_LIBRARY_ERROR:
- LogError("Failed : Library Error. Missing symbol or structures");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_WAITING:
- LogError("Failed : Waiting for plugin dependencies");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_LOCK:
- LogError("Failed : Lock Error");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN:
+ case WRT_INSTALLER_ERROR_UNKNOWN:
LogError("Failed : Unkown Error");
break;
default:
", Description : " << description);
}
-EXPORT_API int wrt_installer_init(void *userdata,
+EXPORT_API void wrt_installer_init(void *userdata,
WrtInstallerInitCallback callback)
{
// Set DPL/LOG MID
// Check paths
if (!checkPaths()) {
if (callback) {
- callback(WRT_ERROR_NO_PATH, userdata);
+ callback(WRT_INSTALLER_ERROR_FATAL_ERROR, userdata);
}
- return TRUE;
+ return;
}
// Initialize ValidationCore - this must be done before AttachDatabases
InstallerMainThreadSingleton::Instance().AttachDatabases();
- //checking for correct DB version
- // if (!WrtDB::WrtDatabase::CheckTableExist(DB_CHECKSUM_STR))
- // {
- // LogError("WRONG VERSION OF WRT DATABASE");
- // Assert(false && "WRONG VERSION OF WRT DATABASE");
- // return FALSE;
- // }
- LogWarning("Database check not implemented!");
-
LogInfo("Prepare libxml2 to work in multithreaded program.");
xmlInitParser();
LogError("Internal Error during Init:");
DPL::Exception::DisplayKnownException(ex);
if (callback) {
- callback(WRT_ERROR_INTERNAL, userdata);
+ callback(WRT_INSTALLER_ERROR_FATAL_ERROR, userdata);
+ return;
}
- return FALSE;
}
- // OK
- return TRUE;
+ return;
}
EXPORT_API void wrt_installer_shutdown()
void* userdata,
WrtInstallerStatusCallback status_cb,
WrtProgressCallback progress_cb,
- wrt_widget_update_mode_t update_mode,
+ WrtInstallMode installMode,
bool quiet,
- bool preload,
std::shared_ptr<PackageManager::
IPkgmgrSignal> pkgmgrInterface
)
InstallerCallbacksTranslate::installProgressCallback,
new InstallerCallbacksTranslate::StatusCallbackStruct(
userdata, status_cb, progress_cb),
- translateWidgetUpdateMode(update_mode),
+ translateInstallMode(installMode),
quiet,
- preload,
pkgmgrInterface)));
}
UNHANDLED_EXCEPTION_HANDLER_END
UNHANDLED_EXCEPTION_HANDLER_END
}
-EXPORT_API int wrt_installer_init_for_tests(void *userdata,
- WrtInstallerInitCallback callback)
-{
- // Set DPL/LOG MID
- DPL::Log::LogSystemSingleton::Instance().SetTag("WRT");
-
- try {
- LogInfo("[WRT-API] INITIALIZING WRT INSTALLER...");
- LogInfo("[WRT-API] BUILD: " << __TIMESTAMP__);
-
- // Touch InstallerController Singleton
- InstallerMainThreadSingleton::Instance().
- TouchArchitectureOnlyInstaller();
-
- // Check paths
- if (!checkPaths()) {
- if (callback) {
- callback(WRT_ERROR_NO_PATH, userdata);
- }
- return TRUE;
- }
-
- CONTROLLER_POST_SYNC_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::
- InitializeEvent());
-
- if (callback) {
- LogInfo("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK");
- callback(WRT_SUCCESS, userdata);
- }
- } catch (const DPL::Exception& ex) {
- LogError("Internal Error during Init:");
- DPL::Exception::DisplayKnownException(ex);
- if (callback) {
- callback(WRT_ERROR_INTERNAL, userdata);
- }
- return FALSE;
- }
-
- // OK
- return TRUE;
-}
-
-EXPORT_API void wrt_installer_shutdown_for_tests()
-{
- try {
- LogInfo("[WRT-API] DEINITIALIZING WRT INSTALLER...");
-
- // Installer termination
- CONTROLLER_POST_SYNC_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::
- TerminateEvent());
-
- // Global deinit check
- LogInfo("Cleanup libxml2 global values.");
- xmlCleanupParser();
- } catch (const DPL::Exception& ex) {
- LogError("Internal Error during Shutdown:");
- DPL::Exception::DisplayKnownException(ex);
- }
-}
-
-EXPORT_API WrtErrStatus wrt_get_widget_by_guid(std::string & tzAppid,
- const std::string & guid)
-{
- try {
- LogInfo("[WRT-API] GETTING WIDGET PACKAGE NAME BY WidgetID : "
- << guid);
-
- WidgetGUID widget_guid = DPL::FromUTF8String(guid);
- WrtDB::WidgetDAOReadOnly dao(widget_guid);
- tzAppid = DPL::ToUTF8String(dao.getTzAppId());
- return WRT_SUCCESS;
- } catch (WidgetDAOReadOnly::Exception::WidgetNotExist&) {
- LogError("Error package name is not found");
- return WRT_ERROR_PKGNAME_NOT_FOUND;
- } catch (const DPL::Exception& ex) {
- LogError("Internal Error during get widget id by package name");
- DPL::Exception::DisplayKnownException(ex);
- return WRT_ERROR_INTERNAL;
- }
-}
#ifdef __cplusplus
}
#endif
* @brief This file contains declarations of wrt_installer_api
*/
-/*
- * @defgroup wrt_engine_group WebRunTime engine Library
- * @ingroup internet_FW
- * Functions to APIs to access wrt-engine
- */
-
#ifndef WRT_INSTALLER_API_H_
#define WRT_INSTALLER_API_H_
extern "C" {
#endif
-/**
- * Callback function type invoked after async init function
- */
typedef void (*WrtInstallerInitCallback)(WrtErrStatus status,
void *data);
-
-/**
- * Callback function type invoked after async functions
- */
typedef void (*WrtPluginInstallerStatusCallback)(WrtErrStatus status,
void *data);
-
-/**
- * Callback function type invoked after async functions
- */
typedef void (*WrtInstallerStatusCallback)(std::string tizenId,
WrtErrStatus status,
void *data);
-
-/**
- * Callback function type invoked after async functions
- */
typedef void (*WrtProgressCallback)(float percent,
const char *description,
void *data);
-
-/**
- * Callback function type invoked when all plugin installations are finished
- */
typedef void (*WrtAllPluginInstalledCallback)(void *userdata);
typedef struct
void *user_data;
} wrt_plugin_data;
-/**
- * @fn int wrt_installer_init(void *userdata, WrtInstallerInitCallback callback)
- * @brief Initializes WRT
- *
- * This method is used to initialize wrt-engine.
- * It connects to database, initializes webkit, widget and plugin logic.
- *
- * @param [in] userdata - User parameters to be passed to the callback
- * @param [in] callback - The callback function that is launched, after
- * wrt initialization.
- * The callback is called in the context of the
- * application's main loop.
- *
- * @return 0 on success, -1 on failure
- *
- * Sample code:
- * @code
- * int main (int argc, char *argv[])
- * {
- * init_loop(argc, argv);
- * printf("Initializing WRT");
- * wrt_init(NULL, &init_cb);
- *
- * wait_for_wrt_init();
- * printf("Starting tests");
- *
- * int status = DPL_TestRunnerSingleton_Instance().ExecTestRunner(argc,
- * argv);
- *
- * wrt_installer_shutdown();
- * quit_loop();
- * return status;
- * }
- * @endcode
- *
- * @see wrt_installer_shutdown
- */
-typedef enum wrt_widget_install_mode_e
+enum WrtInstallMode
{
- /**
- * Raw install bit flags
- */
- WRT_WIM_NOT_INSTALLED = (1 << 0),
- WRT_WIM_INCOMING_VERSION_NOT_STD = (1 << 1),
- WRT_WIM_EXISTING_VERSION_NOT_STD = (1 << 2),
- WRT_WIM_BOTH_VERSIONS_NOT_STD = (1 << 3),
- WRT_WIM_EXISTING_VERSION_OLDER = (1 << 4),
- WRT_WIM_EXISTING_VERSION_EQUAL = (1 << 5),
- WRT_WIM_EXISTING_VERSION_NEWER = (1 << 6),
-
- /**
- * Update default policies
- */
-
- /* Never update policy
- */
- WRT_WIM_POLICY_NEVER_UPDATE = WRT_WIM_NOT_INSTALLED,
-
- /* WAC update policy
- */
- WRT_WIM_POLICY_WAC = WRT_WIM_NOT_INSTALLED |
- WRT_WIM_EXISTING_VERSION_OLDER,
-
- /* Always update policy
- */
- WRT_WIM_POLICY_ALWAYS_INSTALL = WRT_WIM_NOT_INSTALLED |
- WRT_WIM_INCOMING_VERSION_NOT_STD |
- WRT_WIM_EXISTING_VERSION_NOT_STD |
- WRT_WIM_BOTH_VERSIONS_NOT_STD |
- WRT_WIM_EXISTING_VERSION_OLDER |
- WRT_WIM_EXISTING_VERSION_EQUAL |
- WRT_WIM_EXISTING_VERSION_NEWER,
-
- /* Force install policy
- */
- WRT_WIM_POLICY_FORCE_INSTALL = WRT_WIM_POLICY_ALWAYS_INSTALL,
- /* Installation from directory - forced update
- */
- WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL
-} wrt_widget_update_mode_t;
-
-int wrt_installer_init(void *userdata,
- WrtInstallerInitCallback callback);
-
-/**
- * @fn void wrt_installer_shutdown(void)
- * @brief Deinitializes WRT
- *
- * This method is used to deinitialize wrt-engine.
- * It deinitializes widget logic, plugin logic, shuts down connection to
- * database, switchs back to single thread and does deinit checks.
- *
- * @return nothing
- *
- * Sample code:
- * @code
- * int main (int argc, char *argv[])
- * {
- * init_loop(argc, argv);
- * printf("Initializing WRT");
- * wrt_init(NULL, &init_cb);
- *
- * wait_for_wrt_init();
- * printf("Starting tests");
- *
- * int status = DPL_TestRunnerSingleton_Instance().ExecTestRunner(argc,
- * argv);
- *
- * wrt_installer_shutdown();
- * quit_loop();
- * return status;
- * }
- * @endcode
- *
- * @see wrt_init
- */
+ WRT_INSTALL_MODE_UNKNOWN = 0,
+ WRT_INSTALL_MODE_INSTALL_WGT,
+ WRT_INSTALL_MODE_INSTALL_DIRECTORY,
+ WRT_INSTALL_MODE_INSTALL_PRELOAD
+};
+
+void wrt_installer_init(
+ void *userdata,
+ WrtInstallerInitCallback callback);
void wrt_installer_shutdown(void);
-
-/**
- * @fn void wrt_install_widget(const char *widget_package_path,
- * void *user_parameter,
- * WrtInstallerStatusCallback status_callback,
- * WrtProgressCallback progress_callback,
- * wrt_widget_update_mode_t update_mode,
- * bool quiet,
- * bool preload);
- *
- * @brief Installs widget from given path
- *
- * This method is used to install widget from a given path.
- *
- * @param [in] widget_package_path Path of the widget package.
- * @param [in] user_parameter User parameters to be passed to the callback
- * @param [in] status_cb Call to this one will be done at the end of
- * operation
- * The callback is called in the context of the
- * application's
- * @param [in] progress_cb Callback function to get data of install
- * progress
- * If you don't want to get progress data, this
- * should be NULL
- * @param [in] install_mode Installation mode
- * @param [in] quiet quiet mode
- * @param [in] preload preload widget install
- * @return Nothing (status returned in callback).
- *
- * Sample code:
- * @code
- * wrt_install_widget(path.c_str(),
- * NULL,
- * install_cb,
- * progress_cb,
- * WRT_WIM_POLICY_WAC,
- * false,
- * false);
- * @endcode
- *
- * @see wrt_installer_uninstall_widget
- */
void wrt_install_widget(
const char *path,
void *user_parameter,
WrtInstallerStatusCallback status_callback,
WrtProgressCallback progress_callback,
- wrt_widget_update_mode_t update_mode,
+ WrtInstallMode install_mode,
bool quiet,
- bool preload,
std::shared_ptr<PackageManager::IPkgmgrSignal>
pkgmgrInterface
);
-
-/**
- * @fn void wrt_installer_uninstall_widget (const char * const tizenAppid,
- * void* userdata,
- * WrtInstallerStatusCallback cb)
- * @brief Uninstalls widget using its name
- *
- * This method is used to uninstall the widget specified by its appid.
- * The callback function is called when the uninstall operation is done.
- *
- * @param [in] tzAppid - tizen appid
- * @param [in] userdata - user parameters to be passed to the callback
- * @param [in] status_cb - Call to this one will be done at the end of
- * operation
- * The callback is called in the context of the
- * application's
- * @param [in] progress_cb - Callback function to get data of install progress
- * If you don't want to get progress data, this
- * should be NULL
- *
- * @return nothing (status returned in callback).
- *
- * Sample code:
- * @code //TODO SAMPLE
- * wrt_installer_uninstall_widget( appId, NULL, uninstall_cb, progress_cb);
- * @endcode
- *
- * @see wrt_installer_install_widget
- */
void wrt_uninstall_widget (
const char * const tzAppid,
void* userdata,
WrtProgressCallback progress_cb,
std::shared_ptr<PackageManager::IPkgmgrSignal>
pkgmgrSignalInterface);
-
-/**
- * @fn void wrt_install_plugin(const char *pluginDirectory,
- * void *userData,
- * WrtInstallerStatusCallback statusCallback,
- * WrtProgressCallback progressCallback)
- *
- * @brief Installs plugin from given path
- *
- * This method installs new plugin from specified location and calls a callback
- * function when the operation is done.
- *
- * @param [in] pluginDirectory - plugin directory
- * @param [in] userData - user parameters to be passed to the callback
- * @param [in] statusCallback - user callback to call after installation
- * @param [in] progressCallback - user callback to call when plugin
- * installation progress has changed
- *
- * @return nothing (status returned in callback).
- *
- * Sample code:
- * @code
- * wrt_install_plugin("/usr/lib/wrt-plugins/",NULL,NULL,NULL);
- * @endcode
- *
- * @see wrt_install_plugin
- */
void wrt_install_plugin(const char *pluginDirectory,
void *userData,
WrtPluginInstallerStatusCallback statusCallback,
WrtProgressCallback progressCallback);
-
-/**
- * @brief To install plugins for first excution
- *
- * This method install plugins
- *
- * @return nothing
- */
void wrt_install_all_plugins(WrtAllPluginInstalledCallback installed_cb,
void *user_param);
-/**
- * @brief To initialize for tests
- *
- * This method is wrt init for tests
- *
- * @return int
- */
-int wrt_installer_init_for_tests(void *userdata,
- WrtInstallerInitCallback callback);
-
-/**
- * @brief To shutdown for tests
- *
- * This method is wrt shutdown for tests
- *
- * @return int
- */
-void wrt_installer_shutdown_for_tests();
-
-/**
- * @brief wrt_get_widget_by_guid Returns tizenAppid by pkg guid (widgetId)
- * @param tzAppid tizen appid argument ot be set
- * @param guid guid that we look for
- * @return error code
- */
-WrtErrStatus wrt_get_widget_by_guid(std::string &tzAppid,
- const std::string &guid);
#ifdef __cplusplus
}
#endif
/* Generic success */
WRT_SUCCESS = 0, /*< Success*/
- /* Error result */
- WRT_ERROR_INTERNAL = -128, /*< Internal library error.
- * Should never occur */
+ /* pkgmgr error */
+ WRT_INSTALLER_ERROR_PACKAGE_NOT_FOUND, ///<
+ WRT_INSTALLER_ERROR_PACKAGE_INVALID, ///< invalid widget package
+ WRT_INSTALLER_ERROR_PACKAGE_LOWER_VERSION, ///< given version is lower than existing version
+ WRT_INSTALLER_ERROR_MANIFEST_NOT_FOUND, ///<
+ WRT_INSTALLER_ERROR_MANIFEST_INVALID, ///<
+ WRT_INSTALLER_CONFIG_NOT_FOUND, ///< couldn't find config.xml
+ ///< in package.
+ WRT_INSTALLER_ERROR_CONFIG_INVALID, ///< invalid config.xml
+ WRT_INSTALLER_ERROR_SIGNATURE_NOT_FOUND, ///< signature file not exist.
+ WRT_INSTALLER_ERROR_SIGNATURE_INVALID, ///< invalid signature file
+ WRT_INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED, ///< failure in verificate
+ ///< signature
+ WRT_INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND, ///< couldn't find root certificate.
+ WRT_INSTALLER_ERROR_CERTIFICATION_INVAID, ///< invalid certification
+ WRT_INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED, ///< failure in verificate
+ ///< certification chain.
+ WRT_INSTALLER_ERROR_CERTIFICATE_EXPIRED, ///< expire cerification.
+ WRT_INSTALLER_ERROR_INVALID_PRIVILEGE, ///< invalid privilege.
+ WRT_INSTALLER_ERROR_MENU_ICON_NOT_FOUND, ///<
+ WRT_INSTALLER_ERROR_FATAL_ERROR, ///< failure in db operation or file opertion..
+ WRT_INSTALLER_ERROR_OUT_OF_STORAGE, ///< failure in shortage of memory
+ WRT_INSTALLER_ERROR_OUT_OF_MEMORY, ///< failure in shortage of RAM
- WRT_ERROR_PKGNAME_NOT_FOUND, /*< package name was not found */
- WRT_ERROR_NO_PATH, /*<One of specific directory does not
- * exist*/
+ /* wrt-installer error */
+ /* 121-140 : reserved for Web installer */
- /* Installer Errors*/
- WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE, /*< package is malformed */
- WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST, /*< given tizenAppId is invalid */
+ /* installation */
+ WRT_INSTALLER_ERROR_PACKAGE_ALREADY_INSTALLED = 121,
+ WRT_INSTALLER_ERROR_ACE_CHECK_FAILED,
+ WRT_INSTALLER_ERROR_MANIFEST_CREATE_FAILED, ///<
+ WRT_INSTALLER_ERROR_ENCRYPTION_FAILED, ///< Failure in reousrce encrypttion
+ WRT_INSTALLER_ERROR_INSTALL_OSP_SERVCIE, ///< Failure in installing osp service
+ WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED,
+ WRT_INSTALLER_ERROR_UNINSTALLATION_FAILED,
+
+ WRT_INSTALLER_ERROR_UNKNOWN, ///< do not use this error code.
- WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING, /*< Widget is already being
- * uninstalled */
- WRT_INSTALLER_ERROR_INVALID_CERTIFICATE, /*< */
- WRT_INSTALLER_ERROR_ALREADY_INSTALLED, /*< Widget is already installed
- */
- WRT_INSTALLER_ERROR_INTERNAL, /*< Internal error due to inconsistency */
- WRT_INSTALLER_ERROR_NOT_ALLOWED, /*< Widget installation or
- * update not allowed */
- /*< because violation of policy
- * ocurred */
- WRT_INSTALLER_ERROR_DEFERRED, /*< Widget installation deferred
- */
- WRT_INSTALLER_ERROR_DATABASE_FAILURE, /*< Failure in database */
- WRT_INSTALLER_ERROR_UNKNOWN, /*< Temporary error. Try to not
- * use this. */
- WRT_INSTALLER_ERROR_OSPSVC, /*< Error of installation
- * of osp service */
- /* Plugin Installer Errors */
- WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH, /*< Wrong Path to plugin Dir */
- WRT_PLUGIN_INSTALLER_ERROR_METAFILE, /*< Plugin metafile error */
- WRT_PLUGIN_INSTALLER_ERROR_ALREADY_INSTALLED, /*< Plugin already installed*/
- WRT_PLUGIN_INSTALLER_ERROR_LIBRARY_ERROR, /*< Shared library error*/
- WRT_PLUGIN_INSTALLER_ERROR_WAITING, /*< Missing dependencies*/
- WRT_PLUGIN_INSTALLER_ERROR_LOCK, /*< Another installation
- * in progress or lock file
- * error*/
- WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN /*< Unknown error*/
} WrtErrStatus;
#ifdef __cplusplus