[Release] wrt-installer_0.1.92 submit/tizen_2.2/20130629.074256
authorTae-Jeong Lee <taejeong.lee@samsung.com>
Sat, 29 Jun 2013 07:42:34 +0000 (16:42 +0900)
committerTae-Jeong Lee <taejeong.lee@samsung.com>
Sat, 29 Jun 2013 07:42:34 +0000 (16:42 +0900)
Change-Id: I2d60d48b4393f80528b9f86a8b6533f3c3d4a348

packaging/wrt-installer.spec
src/jobs/widget_install/task_certify.cpp
src/jobs/widget_install/task_smack.cpp
src/jobs/widget_install/task_widget_config.cpp

index a52926b..3d5c4bc 100644 (file)
@@ -1,7 +1,7 @@
 #git:framework/web/wrt-installer
 Name:       wrt-installer
 Summary:    Installer for tizen Webruntime
-Version:    0.1.90
+Version:    0.1.92
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 6223426..2b3d81d 100644 (file)
@@ -199,6 +199,7 @@ void TaskCertify::processAuthorSignature(const SignatureData &data)
 
 void TaskCertify::getSignatureFiles(std::string path, SignatureFileInfoSet& file)
 {
+    LogDebug("path : " << path);
     SignatureFileInfoSet signatureFiles;
     SignatureFinder signatureFinder(path);
     if (SignatureFinder::NO_ERROR != signatureFinder.find(file)) {
@@ -215,14 +216,20 @@ void TaskCertify::stepSignature()
     std::string widgetPath;
     widgetPath = m_contextData.locations->getTemporaryPackageDir() + "/";
 
+    if (m_contextData.mode.command ==
+            InstallMode::Command::REINSTALL)
+    {
+        widgetPath = m_contextData.locations->getPackageInstallationDir() + "/";
+    }
+
     SignatureFileInfoSet signatureFiles;
 
     Try {
         getSignatureFiles(widgetPath, signatureFiles);
 
         if (signatureFiles.size() <= 0) {
-            widgetPath = m_contextData.locations->getTemporaryPackageDir() +
-                WrtDB::GlobalConfig::GetWidgetSrcPath() + "/";
+            widgetPath += std::string(WrtDB::GlobalConfig::GetWidgetSrcPath())
+                + "/";
             if (0 == access(widgetPath.c_str(), F_OK)) {
                 getSignatureFiles(widgetPath, signatureFiles);
             }
index 86dfbfd..31ab408 100644 (file)
@@ -91,9 +91,8 @@ void TaskSmack::StepSmackFolderLabeling()
             Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()");
 #ifdef WRT_SMACK_ENABLED
     /* /opt/usr/apps/[pkgid] directory's label is "_" */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
-                m_context.locations->getPackageInstallationDir().c_str(),
-                APP_PATH_ANY_LABEL, "_")) {
+    if (PC_OPERATION_SUCCESS != app_label_dir("_",
+                m_context.locations->getPackageInstallationDir().c_str())) {
         LogWarning("Add label to " <<
                 m_context.locations->getPackageInstallationDir());
     }
@@ -101,41 +100,40 @@ void TaskSmack::StepSmackFolderLabeling()
     /* res directory */
     std::string resDir = m_context.locations->getPackageInstallationDir() +
         "/res";
-
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, resDir.c_str(),
-                APP_PATH_PRIVATE)) {
+    if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId,
+                resDir.c_str())) {
         LogWarning("Add label to " << resDir);
     }
 
-    /* data directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
-                m_context.locations->getPrivateStorageDir().c_str(),
-                APP_PATH_PRIVATE)) {
-        LogWarning("Add label to " << m_context.locations->getPrivateStorageDir());
-    }
-
     /* for prealod */
     if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD &&
             m_context.mode.extension != InstallMode::ExtensionType::DIR)
     {
-        if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
-                    m_context.locations->getUserDataRootDir().c_str(),
-                    APP_PATH_GROUP_RW, "_")) {
+        if (PC_OPERATION_SUCCESS != app_label_dir("_",
+                    m_context.locations->getUserDataRootDir().c_str())) {
+            LogWarning("Add label to " << m_context.locations->getUserDataRootDir());
         }
     }
 
+    /* data directory */
+    if (PC_OPERATION_SUCCESS !=
+        app_label_dir(m_pkgId,
+                      m_context.locations->getPrivateStorageDir().c_str()))
+    {
+        LogWarning("Add label to " << m_context.locations->getPrivateStorageDir());
+    }
+
     /* tmp directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
-                m_context.locations->getPrivateTempStorageDir().c_str(),
-                APP_PATH_PRIVATE))
+    if (PC_OPERATION_SUCCESS !=
+        app_label_dir(m_pkgId,
+                      m_context.locations->getPrivateTempStorageDir().c_str()))
     {
         LogWarning("Add label to " << m_context.locations->getPrivateTempStorageDir());
     }
 
     /* bin directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
-                m_context.locations->getBinaryDir().c_str(),
-                APP_PATH_PRIVATE)) {
+    if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId,
+                m_context.locations->getBinaryDir().c_str())) {
         LogWarning("Add label to " << m_context.locations->getBinaryDir());
     }
 
@@ -213,6 +211,7 @@ void TaskSmack::StepAbortSmack()
 #ifdef WRT_SMACK_ENABLED
     /* TODO :
     std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
+    std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid);
     char* appId = NULL;
     appId = (char*)calloc(1, id.length() + 1);
     snprintf(appId, id.length() + 1, "%s", id.c_str());
@@ -238,11 +237,16 @@ void TaskSmack::StepSetEndofInstallation()
 
 bool TaskSmack::setLabelForSharedDir(const char* pkgId)
 {
+    /* shared directory */
+    if (PC_OPERATION_SUCCESS != app_label_dir("*",
+                m_context.locations->getSharedRootDir().c_str())) {
+        return false;
+    }
+
     /* shared/res directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
-                m_context.locations->getSharedResourceDir().c_str(),
-                APP_PATH_ANY_LABEL, "_")) {
-        LogWarning("Add label to " << m_context.locations->getSharedResourceDir());
+    if (PC_OPERATION_SUCCESS != app_label_dir("_",
+                m_context.locations->getSharedResourceDir().c_str())) {
+        return false;
     }
 
     /* shared/trusted directory */
@@ -260,20 +264,40 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId)
 
         LogDebug("sha1 label string : " << sha1String);
 
-        if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
-                    m_context.locations->getSharedTrustedDir().c_str(),
-                    APP_PATH_GROUP_RW, sha1String.c_str())) {
-            LogWarning("Add label to " << m_context.locations->getBinaryDir());
+        if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
+                    sha1String.c_str(),
+                    m_context.locations->getSharedTrustedDir().c_str())) {
+            return false;
         }
     }
 
     /* shared/data directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
-                m_context.locations->getSharedDataDir().c_str(),
-                APP_PATH_PUBLIC_RO)) {
-        LogWarning("Add label to " << m_context.locations->getSharedDataDir());
+    std::string dataLabel = std::string(pkgId) + "_shareddata";
+    TizenPkgIdList pkgList = WidgetDAOReadOnly::getTizenPkgidList();
+    const char** pList = new (std::nothrow) const char*[pkgList.size() + 1];
+
+    int index = 0;
+    FOREACH(app, pkgList) {
+        std::string id = DPL::ToUTF8String(*app);
+        char *pId = new char[id.size() + 1];
+        snprintf(pId, id.length() + 1, "%s", id.c_str());
+        pList[index++] = pId;
     }
 
+    pList[index] = NULL;
+    if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
+                dataLabel.c_str(),
+                m_context.locations->getSharedDataDir().c_str())) {
+        freeList(pList);
+        return false;
+    }
+    if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
+                "*",
+                m_context.locations->getSharedDataDir().c_str())) {
+        freeList(pList);
+        return false;
+    }
+    freeList(pList);
     return true;
 }
 } //namespace WidgetInstall
index b8db386..7834597 100644 (file)
@@ -428,46 +428,13 @@ void TaskWidgetConfig::ProcessSecurityModel()
 
     bool isSecurityModelV1 = false;
     bool isSecurityModelV2 = false;
-    std::string securityModelV2supportedVersion = "2.2";
     WrtDB::ConfigParserData &data = m_installContext.widgetConfig.configInfo;
 
-    // Parse required version
-    long majorWidget = 0, minorWidget = 0, microWidget = 0;
-    if (!parseVersionString(DPL::ToUTF8String(*data.tizenMinVersionRequired),
-                            majorWidget,
-                            minorWidget,
-                            microWidget))
-    {
-        ThrowMsg(Exceptions::NotAllowed, "Wrong version string");
-    }
-
-    // Parse since version (CSP & allow-navigation start to support since 2.2)
-    long majorSupported = 0, minorSupported = 0, microSupported = 0;
-    if (!parseVersionString(securityModelV2supportedVersion,
-                            majorSupported,
-                            minorSupported,
-                            microSupported))
-    {
-        ThrowMsg(Exceptions::NotAllowed, "Wrong version string");
-    }
-
-    if (majorWidget < majorSupported ||
-        (majorWidget == majorSupported && minorWidget < minorSupported) ||
-        (majorWidget == majorSupported && minorWidget == minorSupported
-         && microWidget < microSupported))
+    if (!data.cspPolicy.IsNull() ||
+        !data.cspPolicyReportOnly.IsNull() ||
+        !data.allowNavigationInfoList.empty())
     {
-        // Under 2.2, clear v2 data
-        data.cspPolicy = DPL::OptionalString::Null;
-        data.cspPolicyReportOnly = DPL::OptionalString::Null;
-        data.allowNavigationInfoList.clear();
-    } else {
-        // More than 2.2, if v2 is defined, clear v1 data
-        if (!data.cspPolicy.IsNull() ||
-            !data.cspPolicyReportOnly.IsNull() ||
-            !data.allowNavigationInfoList.empty())
-        {
-            data.accessInfoSet.clear();
-        }
+        data.accessInfoSet.clear();
     }
 
     // WARP is V1