From: Jihoon Chung Date: Tue, 8 Jan 2013 04:41:47 +0000 (+0900) Subject: [Release] wrt-installer_0.0.90 X-Git-Tag: accepted/tizen_2.1/20130425.023916~20^2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=2026b6513920b4627c013538a79080966290b5ac;p=framework%2Fweb%2Fwrt-installer.git [Release] wrt-installer_0.0.90 --- diff --git a/configuration/config.tizen.xsd b/configuration/config.tizen.xsd old mode 100755 new mode 100644 index 46adddc..f0795d3 --- a/configuration/config.tizen.xsd +++ b/configuration/config.tizen.xsd @@ -44,15 +44,6 @@ - - - - - - - - - @@ -73,7 +64,6 @@ - @@ -100,49 +90,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -186,8 +139,10 @@ - + + + diff --git a/configuration/config.xsd b/configuration/config.xsd old mode 100755 new mode 100644 index 07d19e8..7daac44 --- a/configuration/config.xsd +++ b/configuration/config.xsd @@ -160,6 +160,7 @@ + diff --git a/debian/changelog b/debian/changelog index a9505da..d117240 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +wrt-installer (0.0.90) unstable; urgency=low + + * Change vconf create mechanism + * [Custom handler] Remove custom handlers during uninstall + * Add required attribute name + * For livebox, xsd has been changed + * Add log for command + * Changed PkgName type from DPL::Optional to DPL::String. PART 2 + + -- Jihoon Chung Tue, 08 Jan 2013 11:28:01 +0900 + wrt-installer (0.0.89) unstable; urgency=low * Throw error on no ElementParser diff --git a/packaging/wrt-installer.spec b/packaging/wrt-installer.spec index 1e54895..0e417e7 100644 --- a/packaging/wrt-installer.spec +++ b/packaging/wrt-installer.spec @@ -1,7 +1,7 @@ -#git:framework/web/wrt-installer wrt-installer 0.0.89 +#git:framework/web/wrt-installer wrt-installer 0.0.90 Name: wrt-installer Summary: Installer for tizen Webruntime -Version: 0.0.89 +Version: 0.0.90 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 @@ -10,6 +10,7 @@ Source0: %{name}-%{version}.tar.gz Source100: wrt-preinstall-widgets.service BuildRequires: cmake BuildRequires: edje-tools +BuildRequires: pkgconfig(appsvc) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(dpl-efl) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6da67e5..c07dbab 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -85,6 +85,7 @@ SET(INSTALLER_SOURCES ${INSTALLER_JOBS}/widget_uninstall/job_widget_uninstall.cpp ${INSTALLER_JOBS}/widget_uninstall/task_check.cpp ${INSTALLER_JOBS}/widget_uninstall/task_remove_files.cpp + ${INSTALLER_JOBS}/widget_uninstall/task_remove_custom_handlers.cpp ${INSTALLER_JOBS}/widget_uninstall/task_db_update.cpp ${INSTALLER_JOBS}/widget_uninstall/task_smack.cpp ${INSTALLER_JOBS}/widget_uninstall/task_uninstall_ospsvc.cpp @@ -117,6 +118,7 @@ PKG_CHECK_MODULES(INSTALLER_STATIC_DEP dpl-utils-efl dpl-wrt-dao-ro dpl-wrt-dao-rw + wrt-commons-custom-handler-dao-rw dpl-encryption wrt-plugins-types pkgmgr-installer @@ -125,6 +127,7 @@ PKG_CHECK_MODULES(INSTALLER_STATIC_DEP ) PKG_CHECK_MODULES(SYS_INSTALLER_STATIC_DEP + appsvc libxml-2.0 openssl cert-svc-vcore diff --git a/src/configuration_parser/WidgetConfigurationManager.cpp b/src/configuration_parser/WidgetConfigurationManager.cpp index 54b458c..94a7c54 100644 --- a/src/configuration_parser/WidgetConfigurationManager.cpp +++ b/src/configuration_parser/WidgetConfigurationManager.cpp @@ -189,14 +189,10 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile( } if (!!configInfo.tizenId) { - if (!pWidgetConfigInfo.pkgname) { - pWidgetConfigInfo.pkgname = configInfo.tizenId; - } else { - if (pWidgetConfigInfo.pkgname != configInfo.tizenId) { - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - LogDebug("Invalid archive - Tizen ID not same error"); - return false; - } + if (pWidgetConfigInfo.pkgName != *configInfo.tizenId) { + *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; + LogDebug("Invalid archive - Tizen ID not same error"); + return false; } } diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp index ad57eb7..ce93dcd 100644 --- a/src/jobs/widget_install/job_widget_install.cpp +++ b/src/jobs/widget_install/job_widget_install.cpp @@ -354,7 +354,7 @@ bool JobWidgetInstall::setTizenId( regfree(®); return false; } - m_installerContext.widgetConfig.pkgname = configInfo.tizenId; + m_installerContext.widgetConfig.pkgName = *configInfo.tizenId; } else { WidgetPkgName tizenId = WidgetDAOReadOnly::generateTizenId(); @@ -373,19 +373,19 @@ bool JobWidgetInstall::setTizenId( break; } - m_installerContext.widgetConfig.pkgname = tizenId; + m_installerContext.widgetConfig.pkgName = tizenId; } LogInfo("tizen_id name was generated by WRT: " << tizenId); // send start signal of pkgmgr getInstallerStruct().pkgmgrInterface->setPkgname(DPL::ToUTF8String( - *m_installerContext.widgetConfig.pkgname)); + m_installerContext.widgetConfig.pkgName)); getInstallerStruct().pkgmgrInterface->sendSignal( PKGMGR_START_KEY, PKGMGR_START_INSTALL); } regfree(®); - LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgname); + LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgName); LogInfo("W3C Widget GUID : " << m_installerContext.widgetConfig.guid); return true; } @@ -394,7 +394,7 @@ void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath, const std::string& tempPath) { m_installerContext.locations = - WidgetLocation(DPL::ToUTF8String(*m_installerContext.widgetConfig.pkgname), + WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.pkgName), widgetPath, tempPath, m_installerContext.widgetConfig.packagingType, m_installerContext.locationType); @@ -412,7 +412,7 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation( if (!setTizenId(configData, update, m_jobStruct.m_preload)) { return ConfigureResult::Failed; } else { - LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname); + LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgName); configureWidgetLocation(widgetSource, tempPath); } @@ -446,19 +446,14 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate( LogInfo("Widget info exists. PkgName: " << update.existingWidgetInfo.pkgname); - DPL::OptionalString pkgname = update.existingWidgetInfo.pkgname; - - if(pkgname.IsNull()) { - LogInfo("But package name doesn't exist"); - return ConfigureResult::Failed; - } + WidgetPkgName pkgname = update.existingWidgetInfo.pkgname; LogInfo("Widget model exists. package name: " << pkgname); // Check running state int retval = APP_MANAGER_ERROR_NONE; bool isRunning = false; - retval = app_manager_is_running(DPL::ToUTF8String(*pkgname).c_str(), &isRunning); + retval = app_manager_is_running(DPL::ToUTF8String(pkgname).c_str(), &isRunning); if (APP_MANAGER_ERROR_NONE != retval) { LogError("Fail to get running state"); return ConfigureResult::Failed; @@ -479,7 +474,7 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate( } } - m_installerContext.widgetConfig.pkgname = pkgname; + m_installerContext.widgetConfig.pkgName = pkgname; OptionalWidgetVersion existingVersion; existingVersion = update.existingWidgetInfo.existingVersion; OptionalWidgetVersion incomingVersion = update.incomingVersion; @@ -665,7 +660,7 @@ WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate( widgetGUID, widgetVersion, WidgetUpdateInfo::ExistingWidgetInfo( - *dao.getPkgname(), dao.getVersion())); + dao.getPkgName(), dao.getVersion())); } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { @@ -718,7 +713,7 @@ void JobWidgetInstall::SendFinishedSuccess() //inform widget info JobWidgetInstall::displayWidgetInfo(); - DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname; + WidgetPkgName& tizenId = m_installerContext.widgetConfig.pkgName; // send signal of pkgmgr getInstallerStruct().pkgmgrInterface->sendSignal( @@ -727,7 +722,7 @@ void JobWidgetInstall::SendFinishedSuccess() LogDebug("Call widget install successfinishedCallback"); getInstallerStruct().finishedCallback(getInstallerStruct().userParam, - tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), Exceptions::Success); + DPL::ToUTF8String(tizenId), Exceptions::Success); } void JobWidgetInstall::SendFinishedFailure() @@ -738,7 +733,7 @@ void JobWidgetInstall::SendFinishedFailure() LogError("Error in installation step: " << m_exceptionCaught); LogError("Message: " << m_exceptionMessage); - DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname; + WidgetPkgName & tizenId = m_installerContext.widgetConfig.pkgName; LogDebug("Call widget install failure finishedCallback"); @@ -748,7 +743,7 @@ void JobWidgetInstall::SendFinishedFailure() PKGMGR_END_FAILURE); getInstallerStruct().finishedCallback(getInstallerStruct().userParam, - tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), m_exceptionCaught); + DPL::ToUTF8String(tizenId), m_exceptionCaught); } void JobWidgetInstall::SaveExceptionData(const Jobs::JobExceptionBase &e) @@ -763,18 +758,18 @@ void JobWidgetInstall::displayWidgetInfo() std::ostringstream out; WidgetLocalizedInfo localizedInfo = - W3CFileLocalization::getLocalizedInfo(*dao.getPkgname()); + W3CFileLocalization::getLocalizedInfo(dao.getPkgName()); out << std::endl << "===================================== INSTALLED WIDGET INFO ========="\ "============================"; out << std::endl << "Name: " << localizedInfo.name; - out << std::endl << "PkgName: " << dao.getPkgname(); + out << std::endl << "PkgName: " << dao.getPkgName(); WidgetSize size = dao.getPreferredSize(); out << std::endl << "Width: " << size.width; out << std::endl << "Height: " << size.height; out << std::endl << "Start File: " << - W3CFileLocalization::getStartFile(*dao.getPkgname()); + W3CFileLocalization::getStartFile(dao.getPkgName()); out << std::endl << "Version: " << dao.getVersion(); out << std::endl << "Licence: " << localizedInfo.license; @@ -789,9 +784,8 @@ void JobWidgetInstall::displayWidgetInfo() dao.isDistributorSigned(); out << std::endl << "Widget trusted: " << dao.isTrusted(); - OptionalWidgetIcon icon = W3CFileLocalization::getIcon(*dao.getPkgname()); - DPL::OptionalString iconSrc = - !!icon ? icon->src : DPL::OptionalString::Null; + OptionalWidgetIcon icon = W3CFileLocalization::getIcon(dao.getPkgName()); + DPL::OptionalString iconSrc = !!icon ? icon->src : DPL::OptionalString::Null; out << std::endl << "Icon: " << iconSrc; out << std::endl << "Preferences:"; diff --git a/src/jobs/widget_install/task_certificates.cpp b/src/jobs/widget_install/task_certificates.cpp old mode 100755 new mode 100644 index 4e41048..92fc86f --- a/src/jobs/widget_install/task_certificates.cpp +++ b/src/jobs/widget_install/task_certificates.cpp @@ -61,7 +61,7 @@ void TaskCertificates::StepSetCertiInfo() if ((pkgmgr_installer_save_certinfo( const_cast(DPL::ToUTF8String( - *m_context.widgetConfig.pkgname).c_str()), + m_context.widgetConfig.pkgName).c_str()), m_pkgHandle)) < 0) { LogError("pkgmgrInstallerSaveCertinfo fail"); ThrowMsg(Exceptions::SetCertificateInfoFailed, @@ -159,7 +159,7 @@ void TaskCertificates::StepAbortCertiInfo() { if ((pkgmgr_installer_delete_certinfo( const_cast(DPL::ToUTF8String( - *m_context.widgetConfig.pkgname).c_str()))) < 0) { + m_context.widgetConfig.pkgName).c_str()))) < 0) { LogError("pkgmgr_installer_delete_certinfo fail"); } } diff --git a/src/jobs/widget_install/task_database.cpp b/src/jobs/widget_install/task_database.cpp index 696a962..ee543c8 100644 --- a/src/jobs/widget_install/task_database.cpp +++ b/src/jobs/widget_install/task_database.cpp @@ -39,6 +39,7 @@ #include #include #include +#include using namespace WrtDB; @@ -191,41 +192,40 @@ void TaskDatabase::StepRemoveExternalFiles() void TaskDatabase::StepCreateVconf() { LogDebug("StepCreateVconf"); - std::string popupUsageKey = + std::map vconfData; + vconfData[ WrtDB::VconfConfig::GetVconfKeyPopupUsage( - m_context.locations->getPkgname()); - std::string geolocationUsageKey = + m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON; + vconfData[ WrtDB::VconfConfig::GetVconfKeyGeolocationUsage( - m_context.locations->getPkgname()); - std::string webNotificationUsageKey = + m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON; + vconfData[ WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage( - m_context.locations->getPkgname()); - std::string webDatabaseUsageKey = + m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON; + vconfData[ WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage( - m_context.locations->getPkgname()); - std::string filesystemUsageKey = + m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON; + vconfData[ WrtDB::VconfConfig::GetVconfKeyFilesystemUsage( - m_context.locations->getPkgname()); - std::string memorySavingModeKey = + m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON; + vconfData[ WrtDB::VconfConfig::GetVconfKeyMemorySavingMode( - m_context.locations->getPkgname()); - - vconf_set_int(popupUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - // prevent permission error - vconf_unset(popupUsageKey.c_str()); - vconf_set_int(popupUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(geolocationUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(webNotificationUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(webDatabaseUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(filesystemUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(memorySavingModeKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_OFF)); + m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_OFF; + + // vconftool -g 5000 set -t int initialize value + // Current installer should use vconftool for setting group ID + // In case of install application by pkgcmd, permission for others + // set to read-only + FOREACH(it, vconfData) { + std::ostringstream command; + command << "vconftool -g 5000 set -t int "; + command << (*it).first; + command << " \"" << static_cast((*it).second) << "\""; + int ret = system(command.str().c_str()); + if (-1 == ret) { + ThrowMsg(Exceptions::CreateVconfFailure, "Failed to create vconf files"); + } + } } void TaskDatabase::StepAbortDBInsert() diff --git a/src/jobs/widget_install/task_encrypt_resource.cpp b/src/jobs/widget_install/task_encrypt_resource.cpp index 2ea97ee..71752e5 100644 --- a/src/jobs/widget_install/task_encrypt_resource.cpp +++ b/src/jobs/widget_install/task_encrypt_resource.cpp @@ -78,8 +78,8 @@ void TaskEncryptResource::StepEncryptResource() { LogDebug("Step Encrypt resource"); m_resEnc = new ResourceEncryptor; - m_resEnc->CreateEncryptionKey(DPL::ToUTF8String(*m_context. - widgetConfig.pkgname)); + m_resEnc->CreateEncryptionKey(DPL::ToUTF8String(m_context. + widgetConfig.pkgName)); EncryptDirectory(m_context.locations->getTemporaryRootDir()); } diff --git a/src/jobs/widget_install/task_file_manipulation.cpp b/src/jobs/widget_install/task_file_manipulation.cpp index a41239e..79edb47 100644 --- a/src/jobs/widget_install/task_file_manipulation.cpp +++ b/src/jobs/widget_install/task_file_manipulation.cpp @@ -121,10 +121,6 @@ TaskFileManipulation::TaskFileManipulation(InstallerContext& context) : void TaskFileManipulation::StepCreateDirs() { std::string widgetPath; - DPL::OptionalString pkgname = m_context.widgetConfig.pkgname; - if (pkgname.IsNull()) { - ThrowMsg(Exceptions::InternalError, "No Package name exists."); - } widgetPath = m_context.locations->getPackageInstallationDir(); @@ -236,10 +232,6 @@ void TaskFileManipulation::StepCreateShareDir() void TaskFileManipulation::StepRenamePath() { std::string instDir; - DPL::OptionalString pkgname = m_context.widgetConfig.pkgname; - if (pkgname.IsNull()) { - ThrowMsg(Exceptions::InternalError, "No Package name exists."); - } if (m_context.widgetConfig.packagingType == PKG_TYPE_HYBRID_WEB_APP) { instDir = m_context.locations->getPackageInstallationDir(); diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp old mode 100755 new mode 100644 index 908109a..ba3b2ae --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -312,12 +312,9 @@ DPL::String TaskManifestFile::getIconTargetFilename( const DPL::String& languageTag) const { DPL::OStringStream filename; - DPL::Optional pkgname = m_context.widgetConfig.pkgname; - if (pkgname.IsNull()) { - ThrowMsg(Exceptions::InternalError, "No Package name exists."); - } + WidgetPkgName pkgname = m_context.widgetConfig.pkgName; - filename << DPL::ToUTF8String(*pkgname).c_str(); + filename << DPL::ToUTF8String(pkgname).c_str(); if (!languageTag.empty()) { DPL::OptionalString tag = getLangTag(languageTag); // translate en -> en_US etc @@ -361,7 +358,7 @@ void TaskManifestFile::updateAilInfo() { // Update ail for desktop std::string cfgPkgname = - DPL::ToUTF8String(*m_context.widgetConfig.pkgname); + DPL::ToUTF8String(m_context.widgetConfig.pkgName); const char* pkgname = cfgPkgname.c_str(); LogDebug("Update ail desktop : " << pkgname ); @@ -396,7 +393,7 @@ void TaskManifestFile::backupIconFiles() std::list fileList; getFileList(GlobalConfig::GetUserWidgetDesktopIconPath(), fileList); - std::string pkgname = DPL::ToUTF8String(*m_context.widgetConfig.pkgname); + std::string pkgname = DPL::ToUTF8String(m_context.widgetConfig.pkgName); FOREACH(it, fileList) { @@ -465,7 +462,7 @@ void TaskManifestFile::getFileList(const char* path, void TaskManifestFile::stepGenerateManifest() { - DPL::String pkgname = *m_context.widgetConfig.pkgname; + WidgetPkgName pkgname = m_context.widgetConfig.pkgName; manifest_name = pkgname + L".xml"; manifest_file += L"/tmp/" + manifest_name; @@ -594,12 +591,9 @@ void TaskManifestFile::setWidgetName(Manifest & manifest, UiApplication & uiApp) generateWidgetName(manifest, uiApp, DPL::OptionalString::Null, name, defaultNameSaved); } //appid - DPL::String pkgname; - if(!!m_context.widgetConfig.pkgname) - { - pkgname = *m_context.widgetConfig.pkgname; - uiApp.setAppid(pkgname); - } + WidgetPkgName pkgname = m_context.widgetConfig.pkgName; + uiApp.setAppid(pkgname); + //extraid if(!!m_context.widgetConfig.guid) { @@ -644,11 +638,6 @@ void TaskManifestFile::generateWidgetName(Manifest & manifest, UiApplication &ui void TaskManifestFile::setWidgetIcons(UiApplication & uiApp) { - DPL::OptionalString pkgname = m_context.widgetConfig.pkgname; - if (pkgname.IsNull()) { - ThrowMsg(Exceptions::InternalError, "No Package name exists."); - } - //TODO this file will need to be updated when user locale preferences //changes. bool defaultIconSaved = false; @@ -715,10 +704,8 @@ void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp, const DPL::Opti void TaskManifestFile::setWidgetManifest(Manifest & manifest) { - if(!!m_context.widgetConfig.pkgname) - { - manifest.setPackage(*m_context.widgetConfig.pkgname); - } + manifest.setPackage(m_context.widgetConfig.pkgName); + if(!!m_context.widgetConfig.version) { manifest.setVersion(*m_context.widgetConfig.version); diff --git a/src/jobs/widget_install/task_smack.cpp b/src/jobs/widget_install/task_smack.cpp index 7c36c65..b468d3b 100644 --- a/src/jobs/widget_install/task_smack.cpp +++ b/src/jobs/widget_install/task_smack.cpp @@ -53,10 +53,9 @@ void TaskSmack::Step() devcaps << utf8; } } - DPL::OptionalString pkgName = m_context.widgetConfig.Pkgname; - Assert(!pkgName.IsNull() && "widget doesn't have a pkg name"); + WidgetPkgName pkgName = m_context.widgetConfig.pkgName; int result = handle_access_control_conf_forWAC( - DPL::ToUTF8String(*pkgName).c_str(), + DPL::ToUTF8String(pkgName).c_str(), devcaps.str().c_str(), OPERATION_INSTALL); Assert(result==PC_OPERATION_SUCCESS && "access control setup failed"); diff --git a/src/jobs/widget_install/task_widget_config.cpp b/src/jobs/widget_install/task_widget_config.cpp index bf5301a..eefaf0a 100644 --- a/src/jobs/widget_install/task_widget_config.cpp +++ b/src/jobs/widget_install/task_widget_config.cpp @@ -823,14 +823,10 @@ bool TaskWidgetConfig::fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfig } } if (!!configInfo.tizenId) { - if (!pWidgetConfigInfo.pkgname) { - pWidgetConfigInfo.pkgname = configInfo.tizenId; - } else { - if (pWidgetConfigInfo.pkgname != configInfo.tizenId) { - LogError("Invalid archive - Tizen ID not same error"); - return false; - } - } + if (pWidgetConfigInfo.pkgName != *configInfo.tizenId) { + LogError("Invalid archive - Tizen ID not same error"); + return false; + } } if (!!configInfo.version) { if (!pWidgetConfigInfo.version) { diff --git a/src/jobs/widget_uninstall/job_widget_uninstall.cpp b/src/jobs/widget_uninstall/job_widget_uninstall.cpp index e6153ff..3cb8d82 100644 --- a/src/jobs/widget_uninstall/job_widget_uninstall.cpp +++ b/src/jobs/widget_uninstall/job_widget_uninstall.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -84,6 +85,7 @@ JobWidgetUninstall::JobWidgetUninstall(const std::string & widgetPkgName, } AddTask(new TaskRemoveFiles(m_context)); AddTask(new TaskDbUpdate(m_context)); + AddTask(new TaskRemoveCustomHandlers(m_context)); AddTask(new TaskDeleteCertificates(m_context)); // send start signal of pkgmgr diff --git a/src/jobs/widget_uninstall/task_remove_custom_handlers.cpp b/src/jobs/widget_uninstall/task_remove_custom_handlers.cpp new file mode 100644 index 0000000..5c020a9 --- /dev/null +++ b/src/jobs/widget_uninstall/task_remove_custom_handlers.cpp @@ -0,0 +1,55 @@ +/* + * 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 task_remove_custom_handlers.cpp + * @author Przemyslaw Ciezkowski (p.ciezkowski@samsung.com) + * @version 1.0 + * @brief File for uninstaller - remove custom handlers + */ + +#include +#include +#include +#include +#include +#include +#include + +namespace Jobs { +namespace WidgetUninstall { +TaskRemoveCustomHandlers::TaskRemoveCustomHandlers(UninstallerContext& context) : + DPL::TaskDecl(this), + m_context(context) +{ + AddStep(&TaskRemoveCustomHandlers::Step); +} + +void TaskRemoveCustomHandlers::Step() +{ + LogDebug("Removing widget from appsvc"); + int result = appsvc_unset_defapp(m_context.pkgname.c_str()); + LogDebug("Result: " << result); + + CustomHandlerDB::Interface::attachDatabaseRW(); + CustomHandlerDB::CustomHandlerDAO handlersDao( + DPL::FromASCIIString(m_context.pkgname)); + handlersDao.removeWidgetProtocolHandlers(); + handlersDao.removeWidgetContentHandlers(); + CustomHandlerDB::Interface::detachDatabase(); +} + +} //namespace WidgetUninstall +} //namespace Jobs diff --git a/src/jobs/widget_uninstall/task_remove_custom_handlers.h b/src/jobs/widget_uninstall/task_remove_custom_handlers.h new file mode 100644 index 0000000..c0812c1 --- /dev/null +++ b/src/jobs/widget_uninstall/task_remove_custom_handlers.h @@ -0,0 +1,45 @@ +/* + * 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 task_remove_custom_handlers.h + * @author Przemyslaw Ciezkowski (p.ciezkowski@samsung.com) + * @version 1.0 + * @brief Header file for uninstaller - remove custom handlers + */ +#ifndef INSTALLER_CORE_JOBS_WIDGET_UNINSTALL_TASK_REMOVE_CUSTOM_HANDLERS_H +#define INSTALLER_CORE_JOBS_WIDGET_UNINSTALL_TASK_REMOVE_CUSTOM_HANDLERS_H + +#include + +class UninstallerContext; + +namespace Jobs { +namespace WidgetUninstall { +class TaskRemoveCustomHandlers: + public DPL::TaskDecl +{ + private: + UninstallerContext& m_context; + + void Step(); + + public: + TaskRemoveCustomHandlers(UninstallerContext& context); +}; +} //namespace WidgetUninstall +} //namespace Jobs + +#endif /* INSTALLER_CORE_JOBS_WIDGET_UNINSTALL_TASK_REMOVE_CUSTOM_HANDLERS_H */ diff --git a/src/jobs/widget_uninstall/task_smack.cpp b/src/jobs/widget_uninstall/task_smack.cpp index c6c1a57..23d2df6 100644 --- a/src/jobs/widget_uninstall/task_smack.cpp +++ b/src/jobs/widget_uninstall/task_smack.cpp @@ -43,11 +43,10 @@ void TaskSmack::Step() #ifdef WRT_SMACK_ENABLED try { WrtDB::WidgetDAOReadOnly dao(m_context.locations->getPkgname()); - DPL::OptionalString pkgName = dao.getPkgname(); - Assert(!pkgName.IsNull() && "widget doesn't have a pkg name"); + WidgetPkgName pkgName = dao.getPkgName(); const char *devCap = ""; int result = handle_access_control_conf_forWAC( - DPL::ToUTF8String(*pkgName).c_str(), + DPL::ToUTF8String(pkgName).c_str(), NULL, OPERATION_UNINSTALL); Assert(result==PC_OPERATION_SUCCESS && "access control setup failed"); diff --git a/src/pkg-manager/backendlib.cpp b/src/pkg-manager/backendlib.cpp index 27af8cb..685f371 100644 --- a/src/pkg-manager/backendlib.cpp +++ b/src/pkg-manager/backendlib.cpp @@ -91,7 +91,7 @@ static int pkg_plugin_get_installed_apps_list(const char * /*category*/, WrtDB::WrtDatabase::attachToThreadRO(); - WidgetPkgNameList pkgnameslList = WidgetDAOReadOnly::getPkgnameList(); + WidgetPkgNameList_TEMPORARY_API pkgnameslList = WidgetDAOReadOnly::getPkgnameList_TEMPORARY_API(); *count = 0; FOREACH(iterator, pkgnameslList) { @@ -106,7 +106,7 @@ static int pkg_plugin_get_installed_apps_list(const char * /*category*/, pkg_last->next = pkg_info; } - WidgetPkgName pkgname = **iterator; + WidgetPkgName pkgname = *iterator; WidgetDAOReadOnly widget(pkgname); strncpy(pkg_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX); snprintf(pkg_info->pkg_name, PKG_NAME_STRING_LEN_MAX, "%s", diff --git a/src/wrt-installer/wrt_installer.cpp b/src/wrt-installer/wrt_installer.cpp index 425d655..8deea1d 100644 --- a/src/wrt-installer/wrt_installer.cpp +++ b/src/wrt-installer/wrt_installer.cpp @@ -110,6 +110,15 @@ void WrtInstaller::OnStop() void WrtInstaller::OnCreate() { LogInfo("Creating DummyClient"); + fprintf(stderr, + "===========================================================\n"); + fprintf(stderr, "# wrt-installer #\n"); + fprintf(stderr, "# argc [%ld]\n", m_argc); + fprintf(stderr, "# argv[0] = [%s]\n", m_argv[0]); + fprintf(stderr, "# argv[1] = [%s]\n", m_argv[1]); + fprintf(stderr, "# argv[2] = [%s]\n", m_argv[2]); + fprintf(stderr, + "===========================================================\n"); AddStep(&WrtInstaller::initStep); @@ -373,6 +382,7 @@ void WrtInstaller::installStep() void WrtInstaller::installPluginsStep() { LogDebug("Installing plugins ..."); + fprintf(stderr,"Installing plugins ...\n"); if (m_startupPluginInstallation) { LogInfo("Plugin installation started because new plugin package found"); @@ -594,13 +604,13 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId, if (current == &WrtInstaller::installStep) { resultMsg = DPL::FromUTF8String(PKGMGR_INSTALL_MSG); - printMsg = "installed"; + printMsg = "installation"; } else if (current == &WrtInstaller::uninstallPkgNameStep || current == &WrtInstaller::uninstallGuidStep || current == &WrtInstaller::unistallWgtFileStep) { resultMsg = DPL::FromUTF8String(PKGMGR_UNINSTALL_MSG); - printMsg = "uninstalled"; + printMsg = "uninstallation"; } if (WRT_SUCCESS != status) { @@ -619,61 +629,72 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId, switch (status) { case WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE: This->m_returnStatus = 1; //this status is specific - printf("failed: invalid widget package\n"); + 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: - printf("failed: widget package does not exist\n"); + 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_ALREADY_UNINSTALLING: - printf("failed: already uninstalling\n"); + fprintf(stderr, "## wrt-installer : %s %s has failed - already uninstalling\n", + tizenId.c_str(), printMsg.c_str()); break; case WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE: - printf("failed: out of disk space\n"); + fprintf(stderr,"## wrt-installer : %s %s has failed - out of disk space\n", + tizenId.c_str(), printMsg.c_str()); break; case WRT_INSTALLER_ERROR_INVALID_CERTIFICATE: - printf("failed: invalid certificate\n"); + fprintf(stderr,"## wrt-installer : %s %s has failed - invalid certificate\n", + tizenId.c_str(), printMsg.c_str()); break; case WRT_INSTALLER_ERROR_ALREADY_INSTALLED: - printf("failed: already installed\n"); + fprintf(stderr,"## wrt-installer : %s %s has failed - already installed\n", + tizenId.c_str(), printMsg.c_str()); break; case WRT_INSTALLER_ERROR_INTERNAL: - printf("failed: internal error\n"); + fprintf(stderr,"## wrt-installer : %s %s has failed - internal error\n", + tizenId.c_str(), printMsg.c_str()); break; case WRT_INSTALLER_ERROR_NOT_ALLOWED: - printf("failed: installation or update not allowed; invalid" - " mode\n"); + fprintf(stderr,"## wrt-installer : %s %s has failed - installation or update not allowed; invalid" + " mode\n", tizenId.c_str(), printMsg.c_str()); break; case WRT_INSTALLER_ERROR_DEFERRED: - printf("deferred: widget update will continue after the widget" + fprintf(stderr,"## wrt-installer : deferred: widget update will continue after the widget" " has been stopped\n"); break; case WRT_INSTALLER_ERROR_DATABASE_FAILURE: - printf("failed: database failure\n"); + fprintf(stderr,"## wrt-installer : %s %s has failed - database failure\n", + tizenId.c_str(), printMsg.c_str()); break; case WRT_INSTALLER_ERROR_OSPSVC: - printf("failed: during installation or uninstallation osp service\n"); + fprintf(stderr,"## wrt-installer : %s %s has failed - during installation or" + " uninstallation osp service\n", tizenId.c_str(), + printMsg.c_str()); break; case WRT_INSTALLER_ERROR_UNKNOWN: - printf("failed: unknown error\n"); + fprintf(stderr,"## wrt-installer : %s %s has failed - unknown error\n", + tizenId.c_str(), printMsg.c_str()); break; default: break; + } } else { - - printf("%s : %s\n", printMsg.c_str(), tizenId.c_str()); + fprintf(stderr, "## wrt-installer : %s %s was successful.\n", tizenId.c_str(), printMsg.c_str()); LogDebug("Status succesfull"); This->m_returnStatus = 0; resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS); @@ -704,6 +725,7 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status, if (This->m_numPluginsToInstall < 1) { LogDebug("All plugins installation completed"); + fprintf(stderr,"All plugins installation completed.\n"); //remove installation request if (!PluginUtils::removeInstallationRequiredFlag()) { @@ -737,6 +759,8 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status, if (WRT_SUCCESS == status) { This->m_returnStatus = 0; + fprintf(stderr, "## wrt-installer : plugin installation successfull [%s]\n", + path.c_str()); LogDebug("One plugin Installation succesfull: " << path); return; } @@ -746,6 +770,8 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status, 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) { diff --git a/src/wrt-installer/wrt_installer_api.cpp b/src/wrt-installer/wrt_installer_api.cpp old mode 100755 new mode 100644 index d643991..e481f2f --- a/src/wrt-installer/wrt_installer_api.cpp +++ b/src/wrt-installer/wrt_installer_api.cpp @@ -599,7 +599,7 @@ extern "C" WidgetGUID widget_guid = DPL::FromUTF8String(guid); WrtDB::WidgetDAOReadOnly dao(widget_guid); - pkgname = DPL::ToUTF8String(*dao.getPkgname()); + pkgname = DPL::ToUTF8String(dao.getPkgName()); return WRT_SUCCESS; } catch (WidgetDAOReadOnly::Exception::WidgetNotExist)