[Release] wrt-installer_0.1.90
authorTomasz Iwanek <t.iwanek@samsung.com>
Mon, 24 Jun 2013 07:59:10 +0000 (09:59 +0200)
committersung-su.kim <sung-su.kim@samsung.com>
Fri, 28 Jun 2013 00:07:55 +0000 (09:07 +0900)
Change-Id: I2385f253150bf0eb45fac30eeb92e37387870884

configuration/config.xml
configuration/packaging-configuration.xsd
configuration/widgets.tizen.xsd
packaging/wrt-installer.spec
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/task_smack.cpp
src/jobs/widget_install/task_widget_config.cpp [changed mode: 0755->0644]
src/jobs/widget_install/widget_install_context.h
src/jobs/widget_install/widget_install_errors.h

index f33ce7e..d4a6df7 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" version="0.0.1" viewmodes="fullscreen">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" version="00.00.0001" viewmodes="fullscreen windowed floating">
   <name>hello</name>
+  <name xml:lang="en">hello</name>
   <icon src="icon.png" />
 
   <!-- tizen application element -->
index de55b49..f1a1520 100644 (file)
@@ -4,6 +4,7 @@
   <xs:include schemaLocation="access.xsd"/>
   <xs:include schemaLocation="updates.xsd"/>
   <xs:import namespace="http://tizen.org/ns/widgets" schemaLocation="widgets.tizen.xsd"/>
+  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
   <!--
     Widget Packaging and Configuration <http://www.w3.org/TR/widgets/>
     requires common.rnc
@@ -17,7 +18,7 @@
           <xs:attributeGroup ref="widgets:extension"/>
           <xs:attribute name="id" type="xs:anyURI"/>
           <xs:attribute name="defaultlocale"/>
-          <xs:attribute name="version"/>
+          <xs:attribute name="version" type="widgets:data.versionNumber"/>
           <xs:attribute name="min-version" type="widgets:data.versionNumber"/>
           <xs:attribute name="height" type="widgets:data.positiveNumber"/>
           <xs:attribute name="width" type="widgets:data.positiveNumber"/>
@@ -36,6 +37,8 @@
               </xs:list>
             </xs:simpleType>
           </xs:attribute>
+          <!-- Requirment from IDE UX -->
+          <xs:attribute ref="xml:lang"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -77,6 +80,8 @@
         <xs:element ref="widgets:span"/>
         <xs:group ref="widgets:foreignElement"/>
       </xs:choice>
+      <!-- Requirment from IDE UX -->
+      <xs:attribute ref="xml:lang"/>
       <xs:attributeGroup ref="widgets:global.attrs"/>
       <xs:attributeGroup ref="widgets:global.xml"/>
       <xs:attributeGroup ref="widgets:extension"/>
@@ -89,6 +94,8 @@
         <xs:element ref="widgets:span"/>
         <xs:group ref="widgets:foreignElement"/>
       </xs:choice>
+      <!-- Requirment from IDE UX -->
+      <xs:attribute ref="xml:lang"/>
       <xs:attributeGroup ref="widgets:global.attrs"/>
       <xs:attributeGroup ref="widgets:global.xml"/>
       <xs:attributeGroup ref="widgets:extension"/>
         <xs:element ref="widgets:span"/>
         <xs:group ref="widgets:foreignElement"/>
       </xs:choice>
+      <!-- Requirment from IDE UX -->
+      <xs:attribute ref="xml:lang"/>
       <xs:attributeGroup ref="widgets:global.attrs"/>
       <xs:attributeGroup ref="widgets:global.xml"/>
       <xs:attributeGroup ref="widgets:extension"/>
index f930778..0d8233a 100644 (file)
         </xs:complexType>
     </xs:element>
 
-    <xs:element name="content-security-policy" type="xs:string"/>
-    <xs:element name="content-security-policy-report-only" type="xs:string"/>
-    <xs:element name="allow-navigation" type="xs:string"/>
+    <xs:element name="content-security-policy">
+        <xs:complexType  mixed="true">
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="content-security-policy-report-only">
+        <xs:complexType  mixed="true">
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="allow-navigation">
+        <xs:complexType  mixed="true">
+        </xs:complexType>
+    </xs:element>
 
     <xs:element name="app-widget">
         <xs:complexType mixed="true">
index 79adeb4..a52926b 100644 (file)
@@ -1,7 +1,7 @@
 #git:framework/web/wrt-installer
 Name:       wrt-installer
 Summary:    Installer for tizen Webruntime
-Version:    0.1.88
+Version:    0.1.90
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 9757223..4bbfe02 100644 (file)
@@ -320,6 +320,11 @@ ConfigureResult JobWidgetInstall::prepareInstallation(
         LogError("Failed to unzip for widget");
         result = ConfigureResult::Failed_DrmError;
     }
+    Catch(Exceptions::MissingConfig)
+    {
+        LogError("Failed to localize config.xml");
+        result = ConfigureResult::Failed_InvalidConfig;
+    }
 
     return result;
 }
@@ -656,6 +661,11 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
                 }
             }
 
+            if(!DPL::Utils::Path(configFile).Exists())
+            {
+                ThrowMsg(Exceptions::MissingConfig, "Config file not exists");
+            }
+
             parser.Parse(configFile,
                     ElementParserPtr(
                         new RootParser<WidgetParser>(configInfo,
index 31ab408..86dfbfd 100644 (file)
@@ -91,8 +91,9 @@ void TaskSmack::StepSmackFolderLabeling()
             Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()");
 #ifdef WRT_SMACK_ENABLED
     /* /opt/usr/apps/[pkgid] directory's label is "_" */
-    if (PC_OPERATION_SUCCESS != app_label_dir("_",
-                m_context.locations->getPackageInstallationDir().c_str())) {
+    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+                m_context.locations->getPackageInstallationDir().c_str(),
+                APP_PATH_ANY_LABEL, "_")) {
         LogWarning("Add label to " <<
                 m_context.locations->getPackageInstallationDir());
     }
@@ -100,40 +101,41 @@ void TaskSmack::StepSmackFolderLabeling()
     /* res directory */
     std::string resDir = m_context.locations->getPackageInstallationDir() +
         "/res";
-    if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId,
-                resDir.c_str())) {
+
+    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, resDir.c_str(),
+                APP_PATH_PRIVATE)) {
         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_label_dir("_",
-                    m_context.locations->getUserDataRootDir().c_str())) {
-            LogWarning("Add label to " << m_context.locations->getUserDataRootDir());
+        if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+                    m_context.locations->getUserDataRootDir().c_str(),
+                    APP_PATH_GROUP_RW, "_")) {
         }
     }
 
-    /* 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_label_dir(m_pkgId,
-                      m_context.locations->getPrivateTempStorageDir().c_str()))
+    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+                m_context.locations->getPrivateTempStorageDir().c_str(),
+                APP_PATH_PRIVATE))
     {
         LogWarning("Add label to " << m_context.locations->getPrivateTempStorageDir());
     }
 
     /* bin directory */
-    if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId,
-                m_context.locations->getBinaryDir().c_str())) {
+    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+                m_context.locations->getBinaryDir().c_str(),
+                APP_PATH_PRIVATE)) {
         LogWarning("Add label to " << m_context.locations->getBinaryDir());
     }
 
@@ -211,7 +213,6 @@ 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());
@@ -237,16 +238,11 @@ 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_label_dir("_",
-                m_context.locations->getSharedResourceDir().c_str())) {
-        return false;
+    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());
     }
 
     /* shared/trusted directory */
@@ -264,40 +260,20 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId)
 
         LogDebug("sha1 label string : " << sha1String);
 
-        if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
-                    sha1String.c_str(),
-                    m_context.locations->getSharedTrustedDir().c_str())) {
-            return false;
+        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());
         }
     }
 
     /* shared/data directory */
-    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;
+    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());
     }
 
-    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
old mode 100755 (executable)
new mode 100644 (file)
index 00c5fa0..b8db386
@@ -415,22 +415,71 @@ void TaskWidgetConfig::ProcessAppControlInfo()
 
 void TaskWidgetConfig::ProcessSecurityModel()
 {
+    // 0104.  If the "required_version" specified in the Web Application's
+    // configuration is 2.2 or higher and if the Web Application's
+    // configuration is "CSP-compatible configuration", then the WRT MUST be
+    // set to "CSP-based security mode". Otherwise, the WRT MUST be set to
+    // "WARP-based security mode".
+    // 0105.  A Web Application configuration is "CSP-compatible configuration"
+    // if the configuration includes one or more of
+    // <tizen:content-security-policy> /
+    // <tizen:content-security-policy-report-only> /
+    // <tizen:allow-navigation> elements.
+
     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))
+    {
+        // 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();
+        }
+    }
+
     // WARP is V1
     if (!data.accessInfoSet.empty()) {
         isSecurityModelV1 = true;
     }
 
-    // CSP is V2
-    if (!data.cspPolicy.IsNull() || !data.cspPolicyReportOnly.IsNull()) {
-        isSecurityModelV2 = true;
-    }
-
-    // allow-navigation is V2
-    if (!data.allowNavigationInfoList.empty()) {
+    // CSP & allow-navigation is V2
+    if (!data.cspPolicy.IsNull() ||
+        !data.cspPolicyReportOnly.IsNull() ||
+        !data.allowNavigationInfoList.empty())
+    {
         isSecurityModelV2 = true;
     }
 
@@ -550,8 +599,9 @@ void TaskWidgetConfig::StepVerifyLivebox()
             boxType.c_str(), boxSize, boxSizeCnt);
 
         for(int i = 0; i < boxSizeCnt; i++) {
-            delete[] boxSize[i];
+            free(boxSize[i]);
         }
+        free(boxSize);
 
         if(!chkSize) {
             LogError("Invalid boxSize");
index 402005a..a19f3bb 100644 (file)
@@ -52,29 +52,21 @@ struct InstallerContext
         INSTALL_RDS_DELTA_CHECK,
         INSTALL_RDS_PREPARE,
 
-        INSTALL_UNZIP_FILES,
         INSTALL_WIDGET_CONFIG1,
         INSTALL_WIDGET_CONFIG2,
         INSTALL_DIGSIG_CHECK,
         INSTALL_CERT_CHECK,
         INSTALL_ECRYPTION_FILES,
+        INSTALL_CREATE_BACKUP_DIR,                     /* For Update */
         INSTALL_DIR_CREATE,
         INSTALL_RENAME_PATH,
-
-        INSTALL_CREATE_BACKUP_DIR,                     /* For Update */
-        INSTALL_BACKUP_RES_FILES,                      /* For Update */
-        INSTALL_BACKUP_EXEC,                           /* For Update */
-
         INSTALL_BACKUP_ICONFILE,                         /* For Update */
         INSTALL_COPY_ICONFILE,
         INSTALL_COPY_LIVEBOX_FILES,
         INSTALL_CREATE_EXECFILE,
         INSTALL_CREATE_MANIFEST,
-        INSTALL_CREATE_SHORTCUT,
-        INSTALL_SET_CERTINFO,
         INSTALL_INSTALL_OSPSVC,
-        INSTALL_REMOVE_BACKUP_FILE,
-        INSTALL_PLUGINS_COPY,
+        INSTALL_SET_CERTINFO,
         INSTALL_NEW_DB_INSERT,
         INSTALL_ACE_PREPARE,
         INSTALL_ACE_CHECK,
index a76637f..89be530 100644 (file)
@@ -43,6 +43,7 @@ DECLARE_JOB_EXCEPTION(Base, ExtractFileFailed, ErrorPackageInvalid)
 DECLARE_JOB_EXCEPTION(Base, EmptyPluginsDirectory, ErrorPackageInvalid)
 DECLARE_JOB_EXCEPTION(Base, PluginsSubdirectory, ErrorPackageInvalid)
 DECLARE_JOB_EXCEPTION(Base, RDSDeltaFailure, ErrorPackageInvalid)
+DECLARE_JOB_EXCEPTION(Base, MissingConfig, ErrorPackageInvalid)
 
 DECLARE_JOB_EXCEPTION(Base, PackageLowerVersion, ErrorPackageLowerVersion)