{
const char * const CONFIG_XML = "config.xml";
const char * const WITH_OSP_XML = "res/wgt/config.xml";
+const char * const OSP_MANIFEST_XML = "info/manifest.xml";
//allowed: a-z, A-Z, 0-9
const char* REG_TIZENID_PATTERN = "^[a-zA-Z0-9]{10}.{1,}$";
AddTask(new TaskEncryptResource(m_installerContext));
}
- if (m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
- {
+ if (m_installerContext.mode.extension !=
+ InstallMode::ExtensionType::DIR) {
AddTask(new TaskUpdateFiles(m_installerContext));
AddTask(new TaskFileManipulation(m_installerContext));
}
widgetPath, tempPath,
m_installerContext.widgetConfig.packagingType,
m_installerContext.mode.rootPath ==
- InstallMode::RootPath::RO);
+ InstallMode::RootPath::RO,
+ m_installerContext.mode.extension);
m_installerContext.locations->registerAppid(
DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
new RootParser<WidgetParser>(configInfo,
DPL::FromUTF32String(
L"widget"))));
- } else if (pkgType == PKG_TYPE_DIRECTORY_WEB_APP) {
- std::string configPath;
- configPath = tempPath;
- configPath += "/";
- configPath += WITH_OSP_XML;
+ } else {
+ std::string configFile;
+ configFile = tempPath + "/" + CONFIG_XML;
+ if (!WrtUtilFileExists(configFile)) {
+ configFile = tempPath + "/" + WITH_OSP_XML;
+ }
if (isReinstall) {
// checking RDS data directory
- if (access(configPath.c_str(), F_OK) != 0) {
+ if (access(configFile.c_str(), F_OK) != 0) {
std::string tzAppId =
widgetSource.substr(widgetSource.find_last_of("/")+1);
WidgetDAOReadOnly dao(WidgetDAOReadOnly::getTzAppId(DPL::FromUTF8String(tzAppId)));
- configPath = DPL::ToUTF8String(*dao.getWidgetInstalledPath());
- configPath += "/";
- configPath += WITH_OSP_XML;
- }
- }
- parser.Parse(configPath,
- ElementParserPtr(
- new RootParser<WidgetParser>(
- configInfo,
- DPL::FromUTF32String(L"widget"))));
- } else {
- DPL::Utils::Path configFile;
- if (pkgType == PKG_TYPE_HYBRID_WEB_APP) {
- configFile = DPL::Utils::Path(tempPath);
- configFile /= WITH_OSP_XML;
- } else {
- configFile = DPL::Utils::Path(tempPath);
- configFile /= CONFIG_XML;
- if(!configFile.Exists()){
- Throw(Exceptions::WidgetConfigFileNotFound);
+ configFile = DPL::ToUTF8String(*dao.getWidgetInstalledPath());
+ configFile += "/";
+ configFile += WITH_OSP_XML;
}
}
- parser.Parse(configFile.Fullpath(),
+
+ parser.Parse(configFile,
ElementParserPtr(
new RootParser<WidgetParser>(configInfo,
DPL::
const std::string &widgetSource,
const std::string &tempPath)
{
- // Check installation type (direcotory/ or config.xml or widget.wgt)
- if (m_installerContext.mode.extension == InstallMode::ExtensionType::DIR) {
- LogDebug("Install directly from directory");
- return PKG_TYPE_DIRECTORY_WEB_APP;
- }
if (hasExtension(widgetSource, XML_EXTENSION)) {
LogInfo("Hosted app installation");
return PKG_TYPE_HOSTED_WEB_APP;
}
- std::string configFile = tempPath + "/" + CONFIG_XML;
- if (WrtUtilFileExists(configFile)) {
- return PKG_TYPE_NOMAL_WEB_APP;
- }
-
- configFile = tempPath + "/" + WITH_OSP_XML;
+ std::string configFile = tempPath + "/" + OSP_MANIFEST_XML;
if (WrtUtilFileExists(configFile)) {
return PKG_TYPE_HYBRID_WEB_APP;
}
- return PKG_TYPE_UNKNOWN;
+
+ return PKG_TYPE_NOMAL_WEB_APP;
}
void JobWidgetInstall::setApplicationType(
//SYSTEM INCLUDES
#include <cstring>
#include <string>
+#include <sstream>
#include <dpl/assert.h>
#include <appcore-common.h> //TODO is it necessary here?
#include <pcrecpp.h>
}
}
+void TaskCertify::getSignatureFiles(std::string path, SignatureFileInfoSet& file)
+{
+ SignatureFileInfoSet signatureFiles;
+ SignatureFinder signatureFinder(path);
+ if (SignatureFinder::NO_ERROR != signatureFinder.find(file)) {
+ LogError("Error in Signature Finder : " << path);
+ ThrowMsg(Exceptions::SignatureNotFound,
+ "Error openig temporary widget directory");
+ }
+}
+
void TaskCertify::stepSignature()
{
LogInfo("================ Step: <<Signature>> ENTER ===============");
std::string widgetPath;
- if (m_contextData.widgetConfig.packagingType ==
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
- {
- widgetPath = m_contextData.locations->getSourceDir() + "/";
- } else {
- widgetPath = m_contextData.locations->getTemporaryPackageDir() + "/";
- }
+ widgetPath = m_contextData.locations->getTemporaryPackageDir() + "/";
SignatureFileInfoSet signatureFiles;
- SignatureFinder signatureFinder(widgetPath);
- if (SignatureFinder::NO_ERROR != signatureFinder.find(signatureFiles)) {
- LogError("Error in Signature Finder");
- ThrowMsg(Exceptions::SignatureNotFound,
- "Error openig temporary widget directory");
+
+ Try {
+ getSignatureFiles(widgetPath, signatureFiles);
+
+ if (signatureFiles.size() <= 0) {
+ widgetPath = m_contextData.locations->getTemporaryPackageDir() +
+ WrtDB::GlobalConfig::GetWidgetSrcPath() + "/";
+ getSignatureFiles(widgetPath, signatureFiles);
+ }
+ } Catch(Exceptions::SignatureNotFound) {
+ ReThrowMsg(Exceptions::SignatureNotFound, widgetPath);
}
SignatureFileInfoSet::reverse_iterator iter = signatureFiles.rbegin();
//SYSTEM INCLUDES
#include <string>
#include <libxml/c14n.h>
+#include <vcore/SignatureFinder.h>
//WRT INCLUDES
#include <dpl/task.h>
void processDistributorSignature(const ValidationCore::SignatureData &data);
void processAuthorSignature(const ValidationCore::SignatureData &data);
+ void getSignatureFiles(std::string path,
+ ValidationCore::SignatureFileInfoSet& file);
bool isTizenWebApp() const;
};
m_context.locationType)
{
AddStep(&TaskFileManipulation::StepCreateDirs);
- if (m_context.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+ if (m_context.mode.extension != InstallMode::ExtensionType::DIR)
{
AddStep(&TaskFileManipulation::StepRenamePath);
AddAbortStep(&TaskFileManipulation::StepAbortRenamePath);
manifest_file << ".xml";
LogDebug("manifest file : " << manifest_file.str());
- int ret = pkgmgr_parser_parse_manifest_for_uninstallation(
- manifest_file.str().c_str(), NULL);
-
- if (ret != 0) {
- LogError("Manifest parser error: " << ret);
- }
-
- int code = pkgmgr_parser_parse_manifest_for_installation(
+ int code = pkgmgr_parser_parse_manifest_for_upgrade(
manifest_file.str().c_str(), NULL);
if (code != 0) {
commitManifest();
- if (!m_context.isUpdateMode) {
- code = pkgmgr_parser_parse_manifest_for_installation(
+ if (m_context.isUpdateMode || (
+ m_context.mode.rootPath == InstallMode::RootPath::RO
+ && m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
+ && m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
+
+ code = pkgmgr_parser_parse_manifest_for_upgrade(
commit_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
if (code != 0) {
ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
}
} else {
- code = pkgmgr_parser_parse_manifest_for_upgrade(
+ code = pkgmgr_parser_parse_manifest_for_installation(
commit_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
if (code != 0) {
DPL::TaskDecl<TaskRemoveBackupFiles>(this),
m_context(context)
{
- if (m_context.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+ if (m_context.mode.extension != InstallMode::ExtensionType::DIR)
{
AddStep(&TaskRemoveBackupFiles::StepRemoveBackupFiles);
}
WidgetLocation::WidgetLocation(const std::string & widgetname,
std::string sourcePath,
WrtDB::PackagingType t,
- bool isReadonly) :
+ bool isReadonly,
+ InstallMode::ExtensionType eType) :
m_pkgid(widgetname),
m_widgetSource(sourcePath),
m_type(t),
m_temp(
- new WidgetLocation::DirectoryDeletor(isReadonly))
+ new WidgetLocation::DirectoryDeletor(isReadonly)),
+ m_extensionType(eType)
{
if (isReadonly) {
m_installedPath += WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
std::string sourcePath,
std::string dirPath,
WrtDB::PackagingType t,
- bool isReadonly) :
+ bool isReadonly,
+ InstallMode::ExtensionType eType) :
m_pkgid(widgetname),
m_widgetSource(sourcePath),
m_type(t),
- m_temp(new WidgetLocation::DirectoryDeletor(dirPath))
+ m_temp(new WidgetLocation::DirectoryDeletor(dirPath)),
+ m_extensionType(eType)
{
if (isReadonly) {
m_installedPath += WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
std::string WidgetLocation::getTemporaryRootDir() const
{
- if (m_type == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP) {
+ if (m_extensionType == InstallMode::ExtensionType::DIR) {
return getWidgetSource() + WrtDB::GlobalConfig::GetWidgetSrcPath();
}
if (m_type == WrtDB::PKG_TYPE_HYBRID_WEB_APP) {
path = m_widgetSource.substr(0, index);
}
return path;
- } else if (m_type == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP) {
- return getWidgetSource() + WrtDB::GlobalConfig::GetWidgetSrcPath();
} else {
return getTemporaryRootDir();
}
#include <dpl/wrt-dao-ro/common_dao_types.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <wrt_common_types.h>
+#include <wrt_install_mode.h>
/**
* @brief The WidgetLocation class
*/
WidgetLocation(const std::string & widgetname, std::string sourcePath,
WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP,
- bool isReadonly = false);
+ bool isReadonly = false,
+ InstallMode::ExtensionType eType =
+ InstallMode::ExtensionType::WGT);
WidgetLocation(const std::string & widgetname, std::string sourcePath,
std::string dirPath,
WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP,
- bool isReadonly = false);
+ bool isReadonly = false,
+ InstallMode::ExtensionType eType =
+ InstallMode::ExtensionType::WGT);
~WidgetLocation();
std::shared_ptr<DirectoryDeletor> m_temp; //directory
WrtDB::ExternalLocationList m_externals;
std::string m_installedPath;
+ InstallMode::ExtensionType m_extensionType;
};
#endif // WRT_INSTALLER_SRC_MISC_WIDGET_LOCATION_H