struct timeval tv;
gettimeofday(&tv, NULL);
srand(time(NULL) + tv.tv_usec);
- WrtDB::DbWidgetHandle handle;
- do {
- handle = rand() % INT_MAX + 1;
- LogInfo("Random widget handle: " << handle);
- } while (WidgetDAOReadOnly::isWidgetInstalled(handle));
- m_installerContext.widgetHandle = handle; //TODO: mvoe to wrt-commons (ace_widget_handle_t not int needed)
m_installerContext.m_quiet = m_jobStruct.m_quiet;
if(!browserRequest)
if (needEncryption) {
AddTask(new TaskEncryptResource(m_installerContext));
}
- AddTask(new TaskDatabase(m_installerContext)); //TODO: this should belast task (or almost)
AddTask(new TaskFileManipulation(m_installerContext));
// TODO: Update progress information for this task
AddTask(new TaskPrivateStorage(m_installerContext));
- AddTask(new TaskAceCheck(m_installerContext));
+
//This is sort of quick solution, because ACE verdicts are based upon
//data from DAO (DB). So AceCheck for now has to be AFTER DbUpdate
//task.
AddTask(new TaskLiveboxConf(m_installerContext));
#endif
AddTask(new TaskPluginsCopy(m_installerContext));
+
+ AddTask(new TaskDatabase(m_installerContext));
+ AddTask(new TaskAceCheck(m_installerContext));
} else if (result == ConfigureResult::Updated) {
LogInfo("Configure installation updated");
LogInfo("Widget Update");
AddTask(new TaskCertify(m_installerContext));
AddTask(new TaskUpdateFiles(m_installerContext));
- AddTask(new TaskDatabase(m_installerContext)); //TODO: this should belast task (or almost)
/* TODO : To backup file, save md5 values */
- AddTask(new TaskAceCheck(m_installerContext));
AddTask(new TaskSmack(m_installerContext));
AddTask(new TaskManifestFile(m_installerContext));
- AddTask(new TaskRemoveBackupFiles(m_installerContext));
if (m_installerContext.widgetConfig.pType ==
PKG_TYPE_TIZEN_WITHSVCAPP) {
AddTask(new TaskInstallOspsvc(m_installerContext));
}
+ AddTask(new TaskRemoveBackupFiles(m_installerContext));
#ifdef LB_SUPPORT
AddTask(new TaskLiveboxConf(m_installerContext));
#endif
AddTask(new TaskPluginsCopy(m_installerContext));
+
+ AddTask(new TaskDatabase(m_installerContext));
+
+ AddTask(new TaskAceCheck(m_installerContext));
+ //TODO: remove widgetHandle from this task and move before database task
+ // by now widget handle is needed in ace check
+ // Any error in acecheck while update will break widget
+
} else if (result == ConfigureResult::Deferred) {
// Installation is deferred
LogInfo("Configure installation deferred");
bool JobWidgetInstall::setTizenId(
const WrtDB::ConfigParserData &configInfo, ConfigureResult result)
{
- Assert(!!m_installerContext.widgetHandle
- && "Widget Handle should be initialized");
-
regex_t reg;
regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED);
struct stat dirStat;
LogDebug("Setting tizenId provided in config.xml: " << configInfo.tizenId);
if ((regexec(®, DPL::ToUTF8String(*(configInfo.tizenId)).c_str(),
static_cast<size_t>(0), NULL, 0) != REG_NOERROR) ||
- (stat((std::string(GlobalConfig::GetUserInstalledWidgetPath()) + "/"
- + DPL::ToUTF8String(*(configInfo.tizenId))).c_str(), &dirStat) == 0))
+ ((stat((std::string(GlobalConfig::GetUserInstalledWidgetPath()) + "/"
+ + DPL::ToUTF8String(*(configInfo.tizenId))).c_str(), &dirStat) == 0)
+ && result != ConfigureResult::Updated))
{
//it is true when tizenId does not fit REG_TIZENID_PATTERN
LogError("tizen_id provided but not proper.");
return true;
}
-DPL::Optional<WidgetHandle> JobWidgetInstall::getNewWidgetHandle() const
-{
- return m_installerContext.widgetHandle;
-}
-
DPL::OptionalString JobWidgetInstall::getNewTizenId() const
{
return m_installerContext.widgetConfig.pkgname;
// Check policy
WidgetUpdateMode::Type updateTypeCheckBit;
- bool isUpdate = false;
JobWidgetInstall::ConfigureResult ret = ConfigureResult::Ok;
if (update.existingWidgetInfo.isExist == false) {
LogInfo("Widget info does not exist");
updateTypeCheckBit = WidgetUpdateMode::NotInstalled;
} else {
- LogInfo("Widget info exists. Handle: " <<
- update.existingWidgetInfo.existingHandle);
+ LogInfo("Widget info exists. PkgName: " <<
+ update.existingWidgetInfo.pkgname);
- DPL::OptionalString pkgname =
- WidgetDAOReadOnly(update.existingWidgetInfo.existingHandle).getPkgname();
+ DPL::OptionalString pkgname = update.existingWidgetInfo.pkgname;
if(pkgname.IsNull()) {
LogInfo("But package name doesn't exist");
return ConfigureResult::Failed;
} else {
using namespace PackageManager;
- LogInfo("WidgetHandle: " << m_installerContext.widgetHandle);
LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname);
configureWidgetLocation(widgetSource, browserRequest);
widgetGUID,
widgetVersion,
WidgetUpdateInfo::ExistingWidgetInfo(
- dao.getHandle(), dao.getVersion()));
+ *dao.getPkgname(), dao.getVersion()));
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
void JobWidgetInstall::displayWidgetInfo()
{
- DPL::Optional<WidgetHandle> handle = getNewWidgetHandle();
- Assert(!!handle);
-
- WidgetDAOReadOnly dao(*handle);
+ WidgetDAOReadOnly dao(m_installerContext.locations->getPkgname());
std::ostringstream out;
WidgetLocalizedInfo localizedInfo =
- W3CFileLocalization::getLocalizedInfo(*handle);
+ W3CFileLocalization::getLocalizedInfo(dao.getHandle()); //TODO: pkgname arg
out << std::endl <<
"===================================== INSTALLED WIDGET INFO ========="\
out << std::endl << "Width: " << size.width;
out << std::endl << "Height: " << size.height;
out << std::endl << "Start File: " <<
- W3CFileLocalization::getStartFile(*handle);
+ W3CFileLocalization::getStartFile(dao.getHandle()); //TODO: pkgname arg
out << std::endl << "Version: " << dao.getVersion();
out << std::endl << "Licence: " <<
localizedInfo.license;
dao.isDistributorSigned();
out << std::endl << "Widget trusted: " << dao.isTrusted();
- OptionalWidgetIcon icon = W3CFileLocalization::getIcon(*handle);
+ OptionalWidgetIcon icon = W3CFileLocalization::getIcon(dao.getHandle()); //TODO: pkgname arg
DPL::OptionalString iconSrc =
!!icon ? icon->src : DPL::OptionalString::Null;
out << std::endl << "Icon: " << iconSrc;