[Release] wrt-installer_0.1.74
authorJihoon Chung <jihoon.chung@samsung.com>
Thu, 6 Jun 2013 11:19:59 +0000 (20:19 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Thu, 6 Jun 2013 11:19:59 +0000 (20:19 +0900)
Change-Id: I13d4ac931177c9368d45f60d55bb696d6bcf97c7

54 files changed:
CMakeLists.txt
configuration/CMakeLists.txt [new file with mode: 0644]
configuration/access.xsd [new file with mode: 0644]
configuration/common.xsd [new file with mode: 0644]
configuration/config.xsd [deleted file]
configuration/its.xsd [deleted file]
configuration/local.xsd [deleted file]
configuration/packaging-configuration.xsd [new file with mode: 0644]
configuration/updates.xsd [new file with mode: 0644]
configuration/widgets.tizen.xsd [moved from configuration/config.tizen.xsd with 96% similarity, mode: 0755]
configuration/widgets.xsd [new file with mode: 0644]
configuration/xml.xsd
etc/CMakeLists.txt
packaging/wrt-installer.spec
packaging/wrt-preinstall-widgets.service
src/CMakeLists.txt
src/commons/wrt_install_mode.h
src/configuration_parser/parser_runner.cpp
src/configuration_parser/parser_runner.h
src/configuration_parser/widget_parser.cpp [changed mode: 0644->0755]
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/job_widget_install.h
src/jobs/widget_install/manifest.cpp [changed mode: 0644->0755]
src/jobs/widget_install/manifest.h [changed mode: 0644->0755]
src/jobs/widget_install/task_certify.cpp
src/jobs/widget_install/task_database.cpp
src/jobs/widget_install/task_database.h
src/jobs/widget_install/task_encrypt_resource.cpp
src/jobs/widget_install/task_file_manipulation.cpp
src/jobs/widget_install/task_manifest_file.cpp [changed mode: 0644->0755]
src/jobs/widget_install/task_manifest_file.h
src/jobs/widget_install/task_smack.cpp
src/jobs/widget_install/task_update_files.cpp
src/jobs/widget_install/task_widget_config.cpp [changed mode: 0644->0755]
src/jobs/widget_install/task_widget_config.h [changed mode: 0644->0755]
src/jobs/widget_install/widget_install_errors.h
src/jobs/widget_install/widget_unzip.cpp [moved from src/jobs/widget_install/task_unzip.cpp with 73% similarity]
src/jobs/widget_install/widget_unzip.h [moved from src/jobs/widget_install/task_unzip.h with 57% similarity]
src/jobs/widget_uninstall/task_check.cpp
src/jobs/widget_uninstall/task_remove_files.cpp
src/jobs/widget_uninstall/task_remove_files.h
src/logic/installer_controller.cpp
src/logic/installer_controller.h
src/logic/installer_logic.cpp
src/logic/installer_logic.h
src/misc/widget_location.cpp
src/misc/widget_location.h
src/pkg-manager/backendlib.cpp
src/wrt-installer/CMakeLists.txt
src/wrt-installer/wrt-installer.cpp
src/wrt-installer/wrt-installer.h
src/wrt-installer/wrt_installer_api.cpp
tests/general/widgets/manifest.wgt
tests/general/widgets/nonroot.wgt

index b3933c5..666256f 100644 (file)
@@ -40,6 +40,7 @@ OPTION(MULTIPROCESS_SERVICE_SUPPORT "Process per service" OFF)
 OPTION(MULTIPROCESS_SERVICE_SUPPORT_INLINE "Process per service - inline mode support" OFF)
 OPTION(CSP_SUPPORT "Support for csp policy" ON)
 OPTION(ALLOW_NAVIGATION_SUPPORT "Support for allow-navigation" ON)
+OPTION(SCHEMA_VALIDATION_SUPPORT "Support for XML schema validation" OFF)
 
 ############################# compiler flags ##################################
 
@@ -70,6 +71,10 @@ ENDIF(CSP_SUPPORT)
 IF(ALLOW_NAVIGATION_SUPPORT)
     ADD_DEFINITIONS("-DALLOW_NAVIGATION_ENABLED")
 ENDIF(ALLOW_NAVIGATION_SUPPORT)
+IF(SCHEMA_VALIDATION_SUPPORT)
+    MESSAGE(STATUS "XML Schema validation of installed app enabled")
+    ADD_DEFINITIONS("-DSCHEMA_VALIDATION_ENABLED")
+ENDIF(SCHEMA_VALIDATION_SUPPORT)
 
 # If supported for the target machine, emit position-independent code,suitable
 # for dynamic linking and avoiding any limit on the size of the global offset
@@ -99,6 +104,7 @@ SET(TARGET_BACKEND_LIB "wgt")
 ############################# subdirectories ##################################
 ADD_SUBDIRECTORY(src)
 ADD_SUBDIRECTORY(etc)
+ADD_SUBDIRECTORY(configuration)
 
 IF(WITH_TESTS)
     ADD_SUBDIRECTORY(tests)
diff --git a/configuration/CMakeLists.txt b/configuration/CMakeLists.txt
new file mode 100644 (file)
index 0000000..380f512
--- /dev/null
@@ -0,0 +1,2 @@
+FILE(GLOB XSD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.xsd")
+INSTALL(FILES ${XSD_FILES} DESTINATION /usr/etc/wrt-installer/)
diff --git a/configuration/access.xsd b/configuration/access.xsd
new file mode 100644 (file)
index 0000000..36d2937
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
+  <xs:import schemaLocation="common.xsd"/>
+  <!--
+    Widget Access Request Policy <http://www.w3.org/TR/widgets-access/>
+    requires common.rnc
+  -->
+  <xs:element name="access">
+    <xs:complexType mixed="true">
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="foreignAttribute"/>
+      <xs:attribute name="origin" type="xs:string"/>
+      <!-- w3c policy testcases
+      <xs:attribute name="origin" use="required">
+        <xs:simpleType>
+          <xs:union memberTypes="xs:anyURI">
+            <xs:simpleType>
+              <xs:restriction base="xs:string">
+                <xs:enumeration value="*"/>
+              </xs:restriction>
+            </xs:simpleType>
+          </xs:union>
+        </xs:simpleType>
+      </xs:attribute>
+      -->
+      <xs:attribute name="subdomains" type="data.boolean"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/configuration/common.xsd b/configuration/common.xsd
new file mode 100644 (file)
index 0000000..2ce2f7c
--- /dev/null
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:widgets="http://www.w3.org/ns/widgets">
+  <xs:import namespace="http://www.w3.org/ns/widgets" schemaLocation="widgets.xsd"/>
+
+  <xs:group name="extension">
+    <xs:sequence>
+      <xs:group ref="anyElement"/>
+    </xs:sequence>
+  </xs:group>
+
+  <xs:attributeGroup name="extension">
+    <xs:attributeGroup ref="anyAttribute"/>
+  </xs:attributeGroup>
+
+  <xs:group name="foreignElement">
+    <xs:sequence>
+      <xs:choice minOccurs="0">
+        <xs:group ref="widgets:local"/>
+      </xs:choice>
+    </xs:sequence>
+  </xs:group>
+
+  <xs:attributeGroup name="foreignAttribute">
+    <xs:anyAttribute namespace="##other" processContents="skip"/>
+  </xs:attributeGroup>
+
+  <xs:group name="anyElement">
+    <xs:sequence>
+      <xs:any processContents="skip"/>
+    </xs:sequence>
+  </xs:group>
+
+  <xs:attributeGroup name="anyAttribute">
+    <xs:anyAttribute processContents="skip"/>
+  </xs:attributeGroup>
+
+  <xs:simpleType name="data.positiveNumber">
+    <xs:restriction base="xs:string">
+      <!-- W3C testcase <xs:pattern value="[1-9]\d*"/> -->
+      <xs:pattern value="\s*([1-9]\d*)?.*"/> <!-- accept everything anyway -->
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="data.boolean">
+    <xs:restriction base="xs:string">
+      <!-- w3c testcases - ignore invalid
+      <xs:enumeration value="true"/>
+      <xs:enumeration value="false"/>
+      -->
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:attributeGroup name="global.attrs">
+    <xs:attribute name="dir">
+      <xs:simpleType>
+        <xs:list>
+          <xs:simpleType>
+            <xs:restriction base="xs:token">
+              <xs:enumeration value="ltr"/>
+              <xs:enumeration value="rtl"/>
+              <xs:enumeration value="lro"/>
+              <xs:enumeration value="rlo"/>
+            </xs:restriction>
+          </xs:simpleType>
+        </xs:list>
+      </xs:simpleType>
+    </xs:attribute>
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="global.xml">
+    <xs:anyAttribute namespace="##other" processContents="skip"/>
+  </xs:attributeGroup>
+
+  <xs:simpleType name="data.versionNumber">
+    <xs:restriction base="xs:string">
+      <xs:pattern value="[0-9]{1,2}.[0-9]{1,2}(.[0-9]{1,4})?"/>
+    </xs:restriction>
+  </xs:simpleType>
+</xs:schema>
diff --git a/configuration/config.xsd b/configuration/config.xsd
deleted file mode 100644 (file)
index 0c83a1e..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!-- Widgets 1.0 (Working Draft) RELAX NG schema -->\r
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/ns/widgets" xmlns:its="http://www.w3.org/2005/11/its" xmlns:widgets="http://www.w3.org/ns/widgets" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/ns/widgets config.xsd">\r
-    <xs:import schemaLocation="local.xsd"/>\r
-    <xs:import namespace="http://www.w3.org/2005/11/its" schemaLocation="its.xsd"/>\r
-    <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>\r
-    <xs:import namespace="http://tizen.org/ns/widgets" schemaLocation="config.tizen.xsd"/>\r
-    <xs:group name="extension">\r
-        <xs:sequence>\r
-            <xs:group minOccurs="0" maxOccurs="unbounded" ref="widgets:anyElement"/>\r
-        </xs:sequence>\r
-    </xs:group>\r
-    <xs:attributeGroup name="extension">\r
-        <xs:attributeGroup ref="widgets:attr.allowed"/>\r
-    </xs:attributeGroup>\r
-    <xs:group name="anyElement">\r
-        <xs:sequence>\r
-            <xs:choice minOccurs="0" maxOccurs="unbounded">\r
-                <xs:any namespace="##other" processContents="skip"/>\r
-                <xs:any namespace="##local" processContents="skip"/>\r
-            </xs:choice>\r
-        </xs:sequence>\r
-    </xs:group>\r
-    <xs:group name="any">\r
-        <xs:sequence>\r
-            <xs:group minOccurs="0" maxOccurs="unbounded" ref="widgets:anyElement"/>\r
-        </xs:sequence>\r
-    </xs:group>\r
-    <xs:attributeGroup name="any">\r
-        <xs:anyAttribute processContents="skip"/>\r
-    </xs:attributeGroup>\r
-    <xs:attributeGroup name="attr.allowed">\r
-        <xs:attributeGroup ref="local"/>\r
-    </xs:attributeGroup>\r
-    <xs:attributeGroup name="attr.xmllang">\r
-        <xs:attribute ref="xml:lang" use="required"/>\r
-    </xs:attributeGroup>\r
-    <xs:attributeGroup name="attr.itsdir">\r
-        <xs:attribute ref="its:dir" use="required"/>\r
-    </xs:attributeGroup>\r
-    <xs:simpleType name="data.positiveNumber">\r
-        <xs:restriction base="xs:string">\r
-            <xs:pattern value="[1-9]\d*"/>\r
-        </xs:restriction>\r
-    </xs:simpleType>\r
-    <xs:simpleType name="data.boolean">\r
-        <xs:restriction base="xs:string">\r
-            <xs:enumeration value="true"/>\r
-            <xs:enumeration value="false"/>\r
-        </xs:restriction>\r
-    </xs:simpleType>\r
-    <xs:simpleType name="data.versionNumber">\r
-        <xs:restriction base="xs:string">\r
-            <xs:pattern value="[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,4}"/>\r
-        </xs:restriction>\r
-    </xs:simpleType>\r
-    <xs:element name="widget">\r
-        <xs:complexType mixed="true">\r
-            <xs:choice minOccurs="0" maxOccurs="unbounded">\r
-                <xs:element ref="widgets:name"/>\r
-                <xs:element ref="widgets:description"/>\r
-                <xs:element ref="widgets:icon"/>\r
-                <xs:element ref="widgets:author"/>\r
-                <xs:element ref="widgets:license"/>\r
-                <xs:element ref="widgets:content"/>\r
-                <xs:element ref="widgets:feature"/>\r
-                <xs:element ref="widgets:preference"/>\r
-                <xs:element ref="widgets:access"/>\r
-                <!-- "widgets:extension" group is commented. Otherwise, error: cos-nonambig: Content model violates the unique particle attribution rule. -->\r
-                <!-- Allowing Any Elements or Attributes from a Particular Namespace -->\r
-                <!-- The wildcards permitted within the list are ##local (a nonqualified element) and ##targetNamespace (the target namespace). Two wildcards can also be used instead of the list: ##any (any namespace) and ##other (any namespace other than the target namespace). -->\r
-                <!--xs:group ref="widgets:extension"/-->\r
-                <xs:element ref="tizen:app-control"  maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:setting"  maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:application" minOccurs="1" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:content"  minOccurs="1" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:privilege"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:content-security-policy" minOccurs="0" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:content-security-policy-report-only" minOccurs="0" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:allow-navigation" minOccurs="0" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:app-widget"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:account"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-                <xs:element ref="tizen:metadata"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
-            </xs:choice>\r
-            <xs:attribute ref="xml:lang"/>\r
-            <xs:attribute name="id" type="xs:anyURI"/>\r
-            <xs:attribute name="version" type="widgets:data.versionNumber"/>\r
-            <xs:attribute name="height" type="widgets:data.positiveNumber"/>\r
-            <xs:attribute name="width" type="widgets:data.positiveNumber"/>\r
-            <xs:attribute name="viewmodes">\r
-                <xs:simpleType>\r
-                    <xs:list>\r
-                        <xs:simpleType>\r
-                            <xs:restriction base="xs:token">\r
-                                <xs:enumeration value="maximized"/>\r
-                                <xs:enumeration value="fullscreen"/>\r
-                            </xs:restriction>\r
-                        </xs:simpleType>\r
-                    </xs:list>\r
-                </xs:simpleType>\r
-            </xs:attribute>\r
-            <xs:attributeGroup ref="widgets:extension"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="name">\r
-        <xs:complexType mixed="true">\r
-            <xs:attribute ref="xml:lang"/>\r
-            <xs:attribute ref="its:dir"/>\r
-            <xs:attribute name="short"/>\r
-            <xs:attributeGroup ref="widgets:extension"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="description">\r
-        <xs:complexType mixed="true">\r
-            <xs:attribute ref="xml:lang"/>\r
-            <xs:attribute ref="its:dir"/>\r
-            <xs:attributeGroup ref="widgets:extension"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="icon">\r
-        <xs:complexType>\r
-            <xs:attributeGroup ref="widgets:attr.allowed"/>\r
-            <xs:attribute name="src" use="required" type="xs:anyURI"/>\r
-            <xs:attribute name="height" type="widgets:data.positiveNumber"/>\r
-            <xs:attribute name="width" type="widgets:data.positiveNumber"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="access">\r
-        <xs:complexType>\r
-            <xs:attributeGroup ref="widgets:attr.allowed"/>\r
-            <xs:attribute name="origin" use="required" type="xs:anyURI"/>\r
-            <xs:attribute name="subdomains" use="optional" type="widgets:data.boolean"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="author">\r
-        <xs:complexType mixed="true">\r
-            <xs:attribute ref="xml:lang"/>\r
-            <xs:attribute ref="its:dir"/>\r
-            <xs:attribute name="href" type="xs:anyURI"/>\r
-            <xs:attribute name="email">\r
-                <xs:simpleType>\r
-                    <xs:restriction base="xs:string">\r
-                    </xs:restriction>\r
-                </xs:simpleType>\r
-            </xs:attribute>\r
-            <xs:attributeGroup ref="widgets:extension"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="license">\r
-        <xs:complexType mixed="true">\r
-            <xs:attribute ref="xml:lang"/>\r
-            <xs:attribute ref="its:dir"/>\r
-            <xs:attribute name="href" type="xs:anyURI"/>\r
-            <xs:attributeGroup ref="widgets:extension"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="content">\r
-        <xs:complexType>\r
-            <xs:attributeGroup ref="widgets:attr.allowed"/>\r
-            <xs:attribute name="src" use="required" type="xs:anyURI"/>\r
-            <xs:attribute name="type"/>\r
-            <xs:attribute name="charset"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="feature">\r
-        <xs:complexType mixed="true">\r
-            <xs:choice minOccurs="0" maxOccurs="unbounded">\r
-                <xs:element ref="widgets:param"/>\r
-            </xs:choice>\r
-            <xs:attribute name="name" use="required" type="xs:anyURI"/>\r
-            <xs:attributeGroup ref="widgets:extension"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="param">\r
-        <xs:complexType mixed="true">\r
-            <xs:attribute name="name" use="required"/>\r
-            <xs:attribute name="value" use="required"/>\r
-            <xs:attributeGroup ref="widgets:extension"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    <xs:element name="preference">\r
-        <xs:complexType mixed="true">\r
-            <xs:attribute ref="xml:lang"/>\r
-            <xs:attribute name="name" use="required"/>\r
-            <xs:attribute name="value"/>\r
-            <xs:attribute name="readonly" type="widgets:data.boolean"/>\r
-            <xs:attributeGroup ref="widgets:extension"/>\r
-        </xs:complexType>\r
-    </xs:element>\r
-</xs:schema>\r
diff --git a/configuration/its.xsd b/configuration/its.xsd
deleted file mode 100644 (file)
index 49a2acd..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/2005/11/its" xmlns:widgets="http://www.w3.org/ns/widgets" xmlns:its="http://www.w3.org/2005/11/its">
-  <xs:import schemaLocation="local.xsd"/>
-  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
-  <xs:attribute name="dir">
-    <xs:simpleType>
-      <xs:restriction base="xs:token">
-        <xs:enumeration value="ltr"/>
-        <xs:enumeration value="rtl"/>
-        <xs:enumeration value="lro"/>
-        <xs:enumeration value="rlo"/>
-      </xs:restriction>
-    </xs:simpleType>
-  </xs:attribute>
-</xs:schema>
diff --git a/configuration/local.xsd b/configuration/local.xsd
deleted file mode 100644 (file)
index 59a9833..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:widgets="http://www.w3.org/ns/widgets" xmlns:its="http://www.w3.org/2005/11/its">
-  <xs:import namespace="http://www.w3.org/2005/11/its" schemaLocation="its.xsd"/>
-  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
-  <xs:attributeGroup name="local">
-    <xs:anyAttribute namespace="##other" processContents="skip"/>
-  </xs:attributeGroup>
-</xs:schema>
diff --git a/configuration/packaging-configuration.xsd b/configuration/packaging-configuration.xsd
new file mode 100644 (file)
index 0000000..bb130eb
--- /dev/null
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
+  <xs:import schemaLocation="common.xsd"/>
+  <xs:import namespace="http://tizen.org/ns/widgets" schemaLocation="widgets.tizen.xsd"/>
+  <!--
+    Widget Packaging and Configuration <http://www.w3.org/TR/widgets/>
+    requires common.rnc
+  -->
+  <xs:element name="widget">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="widgets:group.widgetContent">
+          <xs:attributeGroup ref="global.attrs"/>
+          <xs:attributeGroup ref="global.xml"/>
+          <xs:attributeGroup ref="extension"/>
+          <xs:attribute name="id" type="xs:anyURI"/>
+          <xs:attribute name="defaultlocale"/>
+          <xs:attribute name="version"/>
+          <xs:attribute name="min-version" type="data.versionNumber"/>
+          <xs:attribute name="height" type="data.positiveNumber"/>
+          <xs:attribute name="width" type="data.positiveNumber"/>
+          <xs:attribute name="viewmodes">
+            <xs:simpleType>
+              <xs:list>
+                <xs:simpleType>
+                  <xs:restriction base="xs:token">
+                    <xs:enumeration value="windowed"/>
+                    <xs:enumeration value="floating"/>
+                    <xs:enumeration value="fullscreen"/>
+                    <xs:enumeration value="maximized"/>
+                    <xs:enumeration value="minimized"/>
+                  </xs:restriction>
+                </xs:simpleType>
+              </xs:list>
+            </xs:simpleType>
+          </xs:attribute>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:complexType name="group.widgetContent" mixed="true">
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:choice>
+        <xs:element ref="widgets:name"/>
+        <xs:element ref="widgets:description"/>
+        <xs:element ref="widgets:icon"/>
+        <xs:element ref="widgets:author"/>
+        <xs:element ref="widgets:license"/>
+        <xs:element ref="widgets:content"/>
+        <xs:element ref="widgets:feature"/>
+        <xs:element ref="widgets:preference"/>
+
+        <xs:element ref="tizen:app-control"  maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:setting"  maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:application" minOccurs="1" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:content"  minOccurs="1" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:privilege"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:content-security-policy" minOccurs="0" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:content-security-policy-report-only" minOccurs="0" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:allow-navigation" minOccurs="0" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:app-widget"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:account"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:element ref="tizen:metadata"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>
+        <xs:group ref="foreignElement"/>
+        <!-- W3C testcases fail - should accept any element -->
+      </xs:choice>
+      <xs:element ref="widgets:access"/>
+      <xs:element ref="widgets:update-description"/>
+    </xs:choice>
+  </xs:complexType>
+  <xs:element name="name">
+    <xs:complexType mixed="true">
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element ref="widgets:span"/>
+        <xs:group ref="foreignElement"/>
+      </xs:choice>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="global.xml"/>
+      <xs:attributeGroup ref="extension"/>
+      <xs:attribute name="short"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="description">
+    <xs:complexType mixed="true">
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element ref="widgets:span"/>
+        <xs:group ref="foreignElement"/>
+      </xs:choice>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="global.xml"/>
+      <xs:attributeGroup ref="extension"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="icon">
+    <xs:complexType>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="foreignAttribute"/>
+      <!-- w3c testcase - must ignore
+      <xs:attribute name="src" use="required" type="xs:anyURI"/>
+      -->
+      <xs:attribute name="src" type="xs:anyURI"/>
+      <xs:attribute name="height" type="data.positiveNumber"/>
+      <xs:attribute name="width" type="data.positiveNumber"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="author">
+    <xs:complexType mixed="true">
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element ref="widgets:span"/>
+        <xs:group ref="foreignElement"/>
+        <!-- W3C testcases fail - should accept any element -->
+      </xs:choice>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="global.xml"/>
+      <xs:attributeGroup ref="extension"/>
+      <xs:attribute name="href" type="xs:anyURI"/>
+      <xs:attribute name="email" type="xs:string"/>
+      <!-- fails W3C testcases
+      <xs:attribute name="email">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:pattern value=".+@.+"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+       -->
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="license">
+    <xs:complexType mixed="true">
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element ref="widgets:span"/>
+        <xs:group ref="foreignElement"/>
+      </xs:choice>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="global.xml"/>
+      <xs:attributeGroup ref="extension"/>
+      <xs:attribute name="href" type="xs:anyURI"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="content">
+    <xs:complexType>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="foreignAttribute"/>
+      <!-- w3c testcase - ignore not valid
+      <xs:attribute name="src" use="required" type="xs:anyURI"/>
+      -->
+      <xs:attribute name="src" type="xs:string"/>
+      <xs:attribute name="type"/>
+      <xs:attribute name="encoding"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="feature">
+    <xs:complexType mixed="true">
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element ref="widgets:param"/>
+        <xs:group ref="foreignElement"/>
+      </xs:choice>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="global.xml"/>
+      <xs:attributeGroup ref="extension"/>
+      <!-- w3c tescase - must ignore
+      <xs:attribute name="name" use="required" type="xs:anyURI"/>
+      -->
+      <xs:attribute name="name" type="xs:anyURI"/>
+      <xs:attribute name="required" type="data.boolean"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="param">
+    <xs:complexType mixed="true">
+      <xs:group minOccurs="0" maxOccurs="unbounded" ref="foreignElement"/>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="global.xml"/>
+      <xs:attributeGroup ref="extension"/>
+      <xs:attribute name="name"/>
+      <xs:attribute name="value"/>
+      <!-- w3c testcase - must ignore
+      <xs:attribute name="name" use="required"/>
+      <xs:attribute name="value" use="required"/>
+      -->
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="span">
+    <xs:complexType mixed="true">
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element ref="widgets:span"/>
+        <xs:group ref="foreignElement"/>
+      </xs:choice>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="global.xml"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="preference">
+    <xs:complexType mixed="true">
+      <xs:group minOccurs="0" maxOccurs="unbounded" ref="foreignElement"/>
+      <xs:attributeGroup ref="global.attrs"/>
+      <xs:attributeGroup ref="global.xml"/>
+      <xs:attributeGroup ref="extension"/>
+      <!-- w3c testcase -required but missing
+      <xs:attribute name="name" use="required"/>
+      -->
+      <xs:attribute name="name"/>
+      <xs:attribute name="value"/>
+      <xs:attribute name="readonly" type="data.boolean"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/configuration/updates.xsd b/configuration/updates.xsd
new file mode 100644 (file)
index 0000000..6be386b
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
+    <xs:import schemaLocation="common.xsd"/>
+    <!--
+    Widget Updates <http://www.w3.org/TR/widgets-updates/>
+    requires common.rnc
+    -->
+    <xs:element name="update-description">
+    <xs:complexType mixed="true">
+        <xs:group minOccurs="0" maxOccurs="unbounded" ref="foreignElement"/>
+        <xs:attributeGroup ref="foreignAttribute"/>
+        <xs:attribute name="href" use="required" type="xs:anyURI"/>
+    </xs:complexType>
+    </xs:element>
+</xs:schema>
old mode 100644 (file)
new mode 100755 (executable)
similarity index 96%
rename from configuration/config.tizen.xsd
rename to configuration/widgets.tizen.xsd
index 3d0c175..238d216
@@ -74,6 +74,9 @@
             <xs:attribute name="encryption" type="tizen:activationType" use="optional"/> <!-- default: disable -->
             <xs:attribute name="install-location" type="tizen:InstallLocationType" use="optional"/>
             <xs:attribute name="nodisplay" type="tizen:data.boolean" use="optional"/> <!-- default: false -->
+            <xs:attribute name="indicator-persence" type="tizen:data.boolean" use="optional"/>
+            <xs:attribute name="backbutton-persence" type="tizen:data.boolean" use="optional"/>
+            <xs:attribute name="user-agent" use="optional"/>
         </xs:complexType>
     </xs:element>
 
 
     <xs:element name="box-label">
         <xs:complexType mixed="true">
+            <xs:attribute ref="xml:lang" minOccurs="1"/>
         </xs:complexType>
     </xs:element>
 
diff --git a/configuration/widgets.xsd b/configuration/widgets.xsd
new file mode 100644 (file)
index 0000000..839fa03
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  RELAX NG Schema for the Widgets Family of Specifications
+  
+  This document is non-normative.
+  
+  The following is a RELAX NG schema representation of the elements,
+  and attributes, that can be used in a widget's configuration document.
+  
+  A conformance checker may use the RELAX NG for the configuration document to validate
+  elements and attributes of a configuration document within the limits of the RELAX NG
+  specification.
+  
+  Authors: David H�s�ther, Marcos C�ceres, Robin Berjon
+  Contact: public-webapps@w3.org if you find any errors or have any questions
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
+    <xs:include schemaLocation="packaging-configuration.xsd"/>
+    <xs:include schemaLocation="access.xsd"/>
+    <xs:include schemaLocation="updates.xsd"/>
+    <xs:import schemaLocation="common.xsd"/>
+    <xs:group name="local">
+        <xs:sequence>
+            <xs:any namespace="##other" processContents="skip"/>
+        </xs:sequence>
+    </xs:group>
+</xs:schema>
index d9ed2aa..715330a 100644 (file)
@@ -1,6 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:widgets="http://www.w3.org/ns/widgets" xmlns:its="http://www.w3.org/2005/11/its"  targetNamespace="http://www.w3.org/XML/1998/namespace" elementFormDefault="qualified">
-    <xs:import schemaLocation="local.xsd"/>
-    <xs:import namespace="http://www.w3.org/2005/11/its" schemaLocation="its.xsd"/>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:widgets="http://www.w3.org/ns/widgets" xmlns:its="http://www.w3.org/2005/11/its"  targetNamespace="http://www.w3.org/XML/1998/namespace" elementFormDefault="qualified">
     <xs:attribute name="lang" type="xs:language"/>
 </xs:schema>
index 370d4af..c48caa4 100644 (file)
@@ -1,3 +1,3 @@
 SET(ETC_DIR ${PROJECT_SOURCE_DIR}/etc)
 
-INSTALL(PROGRAMS ${ETC_DIR}/wrt_preinstall_widgets.sh DESTINATION /etc/rc.d/init.d)
+INSTALL(PROGRAMS ${ETC_DIR}/wrt_preinstall_widgets.sh DESTINATION /usr/bin/)
index 1c5229a..7a28830 100644 (file)
@@ -1,13 +1,13 @@
-#git:framework/web/wrt-installer wrt-installer_0.1.58.3
+#git:framework/web/wrt-installer
 Name:       wrt-installer
 Summary:    Installer for tizen Webruntime
-Version:    0.1.58.3
+Version:    0.1.74
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
 URL:        N/A
 Source0:    %{name}-%{version}.tar.gz
-Source100:  wrt-preinstall-widgets.service
+Source1:    wrt-preinstall-widgets.service
 BuildRequires:  cmake
 BuildRequires:  edje-tools
 BuildRequires:  pkgconfig(appsvc)
@@ -41,10 +41,9 @@ BuildRequires:  pkgconfig(capi-appfw-app-manager)
 BuildRequires:  pkgconfig(app2sd)
 BuildRequires:  pkgconfig(web-provider)
 BuildRequires:  pkgconfig(libprivilege-control)
-BuildRequires:  pkgconfig(osp-appfw)
-BuildRequires:  osp-appfw-internal-devel
 BuildRequires:  pkgconfig(libsmack)
-Requires: osp-appfw
+BuildRequires:  libss-client-devel
+Requires: libss-client
 Requires: osp-installer
 Requires: xmlsec1
 
@@ -76,15 +75,9 @@ mkdir -p %{buildroot}/usr/share/license
 cp LICENSE %{buildroot}/usr/share/license/%{name}
 %make_install
 
-mkdir -p %{buildroot}%{_libdir}/systemd/user
-install -m 644 %{SOURCE100} %{buildroot}%{_libdir}/systemd/user
-mkdir -p %{buildroot}%{_libdir}/systemd/user/tizen-mobile-session.target.wants
-ln -s ../wrt-preinstall-widgets.service %{buildroot}%{_libdir}/systemd/user/tizen-mobile-session.target.wants
-
-mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d/
-mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d/
-ln -s ../init.d/wrt_preinstall_widgets.sh %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S48lwrt_preinstall_widgets.sh
-ln -s ../init.d/wrt_preinstall_widgets.sh %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S48lwrt_preinstall_widgets.sh
+mkdir -p %{buildroot}%{_libdir}/systemd/system/tizen-runtime.target.wants
+install -m 644 %{SOURCE1} %{buildroot}%{_libdir}/systemd/system/wrt-preinstall-widgets.service
+ln -s ../wrt-preinstall-widgets.service %{buildroot}%{_libdir}/systemd/system/tizen-runtime.target.wants/wrt-preinstall-widgets.service
 
 %clean
 rm -rf %{buildroot}
@@ -98,10 +91,6 @@ ln -sf /usr/bin/wrt-installer /usr/etc/package-manager/backend/wgt
 
 #for booting recovery
 mkdir -p /opt/share/widget/temp_info
-[ -h /etc/rc.d/rc3.d/S48lwrt_preinstall_widgets.sh ] && rm /etc/rc.d/rc3.d/S48lwrt_preinstall_widgets.sh
-[ -h /etc/rc.d/rc5.d/S48lwrt_preinstall_widgets.sh ] && rm /etc/rc.d/rc5.d/S48lwrt_preinstall_widgets.sh
-ln -s /etc/rc.d/init.d/wrt_preinstall_widgets.sh /etc/rc.d/rc3.d/S48lwrt_preinstall_widgets.sh
-ln -s /etc/rc.d/init.d/wrt_preinstall_widgets.sh /etc/rc.d/rc5.d/S48lwrt_preinstall_widgets.sh
 
 # for downloadable Application icons path
 mkdir -p /opt/share/icons/default/small
@@ -111,13 +100,12 @@ mkdir -p /opt/share/icons/default/small
 %files
 %manifest wrt-installer.manifest
 %attr(755,root,root) %{_bindir}/wrt-installer
-%attr(775,root,root) %{_initddir}/wrt_preinstall_widgets.sh
-%{_sysconfdir}/rc.d/rc3.d/S48lwrt_preinstall_widgets.sh
-%{_sysconfdir}/rc.d/rc5.d/S48lwrt_preinstall_widgets.sh
+%attr(775,root,root) %{_bindir}/wrt_preinstall_widgets.sh
 /usr/etc/package-manager/backendlib/libwgt.so
+%attr(644,root,root) /usr/etc/wrt-installer/*.xsd
+%{_libdir}/systemd/system/tizen-runtime.target.wants/wrt-preinstall-widgets.service
+%{_libdir}/systemd/system/wrt-preinstall-widgets.service
 %{_datadir}/license/%{name}
-%{_libdir}/systemd/user/tizen-mobile-session.target.wants/wrt-preinstall-widgets.service
-%{_libdir}/systemd/user/wrt-preinstall-widgets.service
 %if %{with_tests}
     %attr(755,root,root) %{_bindir}/wrt-installer-tests-*
     /opt/share/widget/tests/installer/widgets/*
index 2bf8181..2a66867 100644 (file)
@@ -1,8 +1,11 @@
 [Unit]
-Description=Installation of pre-installed widgets
-ConditionPathExists=/opt/media/Downloads/.preinstallWidgets
-After=xorg.target e17.service
+Description=WRT Preinstall Widgets
+After=tizen-system.target
+Requires=tizen-system.target
 
 [Service]
-Type=oneshot
-ExecStart=/etc/init.d/wrt_preinstall_widgets.sh
+Type=forking
+ExecStart=/usr/bin/wrt_preinstall_widgets.sh
+
+[Install]
+WantedBy=tizen-runtime.target
index 8832baf..724787d 100644 (file)
@@ -62,7 +62,6 @@ SET(INSTALLER_SOURCES
     ${INSTALLER_JOBS}/widget_install/job_widget_install.cpp
     ${INSTALLER_JOBS}/widget_install/manifest.cpp
     ${INSTALLER_JOBS}/widget_install/task_commons.cpp
-    ${INSTALLER_JOBS}/widget_install/task_unzip.cpp
     ${INSTALLER_JOBS}/widget_install/task_widget_config.cpp
     ${INSTALLER_JOBS}/widget_install/task_database.cpp
     ${INSTALLER_JOBS}/widget_install/ace_registration.cpp
@@ -82,6 +81,7 @@ SET(INSTALLER_SOURCES
     ${INSTALLER_JOBS}/widget_install/wac_security.cpp
     ${INSTALLER_JOBS}/widget_install/widget_update_info.cpp
     ${INSTALLER_JOBS}/widget_install/directory_api.cpp
+    ${INSTALLER_JOBS}/widget_install/widget_unzip.cpp
     ${INSTALLER_JOBS}/widget_uninstall/job_widget_uninstall.cpp
     ${INSTALLER_JOBS}/widget_uninstall/task_check.cpp
     ${INSTALLER_JOBS}/widget_uninstall/task_remove_files.cpp
@@ -125,7 +125,6 @@ PKG_CHECK_MODULES(INSTALLER_STATIC_DEP
     pkgmgr-parser
     pkgmgr-info
     web-provider
-    osp-appfw
     libsmack
     REQUIRED
 )
@@ -147,7 +146,6 @@ PKG_CHECK_MODULES(SYS_INSTALLER_STATIC_DEP
     shortcut
     capi-appfw-app-manager
     app2sd
-    vconf
     libprivilege-control
     REQUIRED
 )
@@ -176,7 +174,7 @@ TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC}
     )
 
 #for encryption
-TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC} -L/usr/lib/osp -losp-appfw )
+TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC} "-lss-client" )
 
 ADD_SUBDIRECTORY(pkg-manager)
 ADD_SUBDIRECTORY(wrt-installer)
index a545f9c..19a387e 100644 (file)
@@ -61,7 +61,8 @@ class InstallMode
         location(lo),
         rootPath(root),
         extension(extensionType),
-        installTime(time)
+        installTime(time),
+        removable(true)
     {};
 
     Command command;
@@ -69,6 +70,7 @@ class InstallMode
     RootPath rootPath;
     ExtensionType extension;
     InstallTime installTime;
+    bool removable;
 };
 
 #endif // WRT_INSTALL_MODE_H
index cff02f7..cdc7caa 100644 (file)
@@ -22,6 +22,8 @@
 #include "parser_runner.h"
 #include "root_parser.h"
 
+#include "stdio.h"
+
 #include <stack>
 #include <libxml/xmlreader.h>
 #include <dpl/binary_queue.h>
 
 class ParserRunner::Impl
 {
+    static void logErrorLibxml2(void *, const char *msg, ...)
+    {
+        char buffer[300];
+        va_list args;
+        va_start(args, msg);
+        vsnprintf(buffer, 300, msg, args);
+        va_end(args);
+        LogError(buffer);
+    }
+
+    static void logWarningLibxml2(void *, const char *msg, ...)
+    {
+        char buffer[300];
+        va_list args;
+        va_start(args, msg);
+        vsnprintf(buffer, 300, msg, args);
+        va_end(args);
+        LogWarning(buffer);
+    }
+
   public:
+    bool Validate(const std::string& filename, const std::string& schema)
+    {
+        int ret = -1;
+        xmlSchemaParserCtxtPtr ctx;
+        xmlSchemaValidCtxtPtr vctx;
+        xmlSchemaPtr xschema;
+        ctx = xmlSchemaNewParserCtxt(schema.c_str());
+        if (ctx == NULL) {
+            LogError("xmlSchemaNewParserCtxt() Failed");
+            return false;
+        }
+        xschema = xmlSchemaParse(ctx);
+        if (xschema == NULL) {
+            LogError("xmlSchemaParse() Failed");
+            return false;
+        }
+        vctx = xmlSchemaNewValidCtxt(xschema);
+        if (vctx == NULL) {
+            LogError("xmlSchemaNewValidCtxt() Failed");
+            return false;
+        }
+        xmlSchemaSetValidErrors(vctx, (xmlSchemaValidityErrorFunc)&logErrorLibxml2, (xmlSchemaValidityWarningFunc) &logWarningLibxml2, NULL);
+        ret = xmlSchemaValidateFile(vctx, filename.c_str(), 0);
+        if (ret == -1) {
+            LogError("xmlSchemaValidateFile() failed");
+            return false;
+        } else if (ret == 0) {
+            LogError("Config is Valid");
+            return true;
+        } else {
+            LogError("Config Validation Failed with error code " << ret);
+            return false;
+        }
+        return true;
+    }
+
     void Parse(const std::string& filename,
                const ElementParserPtr& root)
     {
@@ -385,6 +443,11 @@ ParserRunner::ParserRunner() :
     m_impl(new ParserRunner::Impl())
 {}
 
+bool ParserRunner::Validate(const std::string& filename, const std::string& schema)
+{
+    return m_impl->Validate(filename, schema);
+}
+
 void ParserRunner::Parse(const std::string& filename,
                          ElementParserPtr root)
 {
index 80a3208..c5c0714 100644 (file)
@@ -30,6 +30,8 @@
 class ParserRunner : private DPL::Noncopyable
 {
   public:
+    bool Validate(const std::string& filename, const std::string& schema);
+
     void Parse(const std::string& filename,
                ElementParserPtr root);
     void Parse(DPL::AbstractInput *input,
old mode 100644 (file)
new mode 100755 (executable)
index 56127be..5a56c0f
 #include <string>
 #include <cstdio>
 #include <cerrno>
+#include <climits>
+#include <cmath>
+#include <cstdlib>
+#include <locale>
 
 using namespace WrtDB;
 
@@ -566,7 +570,7 @@ class IconParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     IconParser(ConfigParserData& data) : ElementParser(),
@@ -680,7 +684,7 @@ class ContentParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     ContentParser(ConfigParserData& data) :
@@ -688,8 +692,10 @@ class ContentParser : public ElementParser
         m_data(data)
     {}
 
-    virtual void Accept(const Element& /*element*/)
-    {}
+    virtual void Accept(const Element& element)
+    {
+        m_namespace = element.ns;
+    }
 
     virtual void Accept(const Text& /*text*/)
     {}
@@ -718,13 +724,17 @@ class ContentParser : public ElementParser
 
     virtual void Verify()
     {
-        if (m_data.startFileEncountered) {
-            LogWarning("This is not the first encountered "
-                       "'content' element - ignoring.");
-            return;
+        if(!!m_data.startFile)
+        {
+            if(m_data.startFileNamespace == m_namespace
+                || m_namespace != ConfigurationNamespace::TizenWebAppNamespaceName)
+            {
+                return;
+            }
+            //else continue -> if previous item was not in tizen namespace
         }
 
-        m_data.startFileEncountered = true;
+        m_data.startFileNamespace = m_namespace;
 
         //we're consciously setting startFile even if m_src is null or invalid.
         //WidgetConfigurationManager will deal with this.
@@ -745,6 +755,7 @@ class ContentParser : public ElementParser
     DPL::OptionalString m_type;
     DPL::OptionalString m_encoding;
     ConfigParserData& m_data;
+    DPL::String m_namespace;
 };
 
 class PreferenceParser : public ElementParser
@@ -753,7 +764,7 @@ class PreferenceParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     virtual void Accept(const XmlAttribute& attribute)
@@ -892,7 +903,7 @@ class SettingParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     virtual void Accept(const Text& /*text*/)
@@ -931,7 +942,7 @@ class AppControlParser : public ElementParser
         virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                             const DPL::String& /*name*/)
         {
-            return &IgnoringParser::Create;
+            return &IgnoringParser::Create; //ignore unknown according to w3c
         }
 
         virtual void Accept(const Text& /*text*/)
@@ -977,7 +988,7 @@ class AppControlParser : public ElementParser
         virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                             const DPL::String& /*name*/)
         {
-            return &IgnoringParser::Create;
+            return &IgnoringParser::Create; //ignore unknown according to w3c
         }
 
         virtual void Accept(const Text& /*text*/)
@@ -1023,7 +1034,7 @@ class AppControlParser : public ElementParser
         virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                             const DPL::String& /*name*/)
         {
-            return &IgnoringParser::Create;
+            return &IgnoringParser::Create; //ignore unknown according to w3c
         }
 
         virtual void Accept(const Text& /*text*/)
@@ -1086,7 +1097,7 @@ class AppControlParser : public ElementParser
         virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                             const DPL::String& /*name*/)
         {
-            return &IgnoringParser::Create;
+            return &IgnoringParser::Create; //ignore unknown according to w3c
         }
 
         virtual void Accept(const Text& /*text*/)
@@ -1149,7 +1160,7 @@ class AppControlParser : public ElementParser
         } else if (name == L"mime") {
             return DPL::MakeDelegate(this, &AppControlParser::OnMimeElement);
         } else {
-            return &IgnoringParser::Create;
+            return &IgnoringParser::Create; //ignore unknown according to w3c
         }
     }
 
@@ -1173,13 +1184,11 @@ class AppControlParser : public ElementParser
     virtual void Verify()
     {
         if (m_appControl.m_src == L"") {
-            LogWarning("service element must have src element");
-            return;
+            ThrowMsg(Exception::ParseError, "service element must have src element");
         }
 
         if (m_appControl.m_operation == L"") {
-            LogWarning("service element must have operation element");
-            return;
+            ThrowMsg(Exception::ParseError, "service element must have operation element");
         }
 
         m_data.appControlList.push_back(m_appControl);
@@ -1222,13 +1231,12 @@ class ApplicationParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     virtual void Accept(const Text& /*text*/)
     {
         if (m_properNamespace) {
-            LogDebug("text");
             ThrowMsg(Exception::ParseError, "application element must be empty");
         }
     }
@@ -1240,13 +1248,11 @@ class ApplicationParser : public ElementParser
         {
             m_properNamespace = true;
         }
-        LogDebug("element");
     }
 
     virtual void Accept(const XmlAttribute& attribute)
     {
         if (m_properNamespace) {
-            LogDebug("attribute");
             if (attribute.name == L"id") {
                 m_id = attribute.value;
                 NormalizeAndTrimSpaceString(m_id);
@@ -1278,6 +1284,8 @@ class ApplicationParser : public ElementParser
         m_properNamespace(false)
     {}
 
+    static const char* const REGEXP_ID;
+
   private:
     void VerifyIdAndPackage()
     {
@@ -1341,7 +1349,6 @@ class ApplicationParser : public ElementParser
     }
 
     static const char* const REGEXP_PACKAGE;
-    static const char* const REGEXP_ID;
     static const char* const REGEXP_VERSION;
 
     ConfigParserData& m_data;
@@ -1361,7 +1368,7 @@ class SplashParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     virtual void Accept(const XmlAttribute& attribute)
@@ -1406,7 +1413,7 @@ class BackgroundParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     virtual void Accept(const XmlAttribute& attribute)
@@ -1450,7 +1457,7 @@ class PrivilegeParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     virtual void Accept(const Text& /*text*/)
@@ -1531,7 +1538,7 @@ class CategoryParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     virtual void Accept(const XmlAttribute& attribute)
@@ -1582,12 +1589,15 @@ class AppWidgetParser : public ElementParser
         virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                             const DPL::String& /*name*/)
         {
-            return &IgnoringParser::Create;
+            return &IgnoringParser::Create; //ignore unknown according to w3c
         }
 
-        virtual void Accept(const XmlAttribute& /*attribute*/)
-        {}
-
+        virtual void Accept(const XmlAttribute& attribute)
+        {
+            if (m_properNamespace) {
+                 m_lang = attribute.lang;
+            }
+        }
         virtual void Accept(const Element& element)
         {
             if (element.ns ==
@@ -1606,7 +1616,14 @@ class AppWidgetParser : public ElementParser
 
         virtual void Verify()
         {
-            m_data.m_label = m_label;
+            if (m_label.empty()) {
+                ThrowMsg(Exception::ParseError,
+                        "box-label element cannot be empty - ignoring");
+            }
+            std::pair<DPL::String, DPL::String> boxLabel;
+            boxLabel.first = m_lang;
+            boxLabel.second = m_label;
+            m_data.m_label.push_back(boxLabel);
         }
 
         BoxLabelParser(ConfigParserData::LiveboxInfo& data) :
@@ -1616,6 +1633,7 @@ class AppWidgetParser : public ElementParser
         {}
 
       private:
+        DPL::String m_lang;
         DPL::String m_label;
         bool m_properNamespace;
         ConfigParserData::LiveboxInfo& m_data;
@@ -1626,7 +1644,7 @@ class AppWidgetParser : public ElementParser
         virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                             const DPL::String& /*name*/)
         {
-            return &IgnoringParser::Create;
+            return &IgnoringParser::Create; //ignore unknown according to w3c
         }
 
         virtual void Accept(const XmlAttribute& attribute)
@@ -1652,6 +1670,10 @@ class AppWidgetParser : public ElementParser
 
         virtual void Verify()
         {
+            if (m_icon.empty()) {
+                ThrowMsg(Exception::ParseError,
+                    "src attribute of box-icon element is mandatory - ignoring");
+            }
             m_data.m_icon = m_icon;
         }
 
@@ -1674,7 +1696,7 @@ class AppWidgetParser : public ElementParser
             virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                                 const DPL::String& /*name*/)
             {
-                return &IgnoringParser::Create;
+                return &IgnoringParser::Create; //ignore unknown according to w3c
             }
 
             virtual void Accept(const XmlAttribute& attribute)
@@ -1704,6 +1726,11 @@ class AppWidgetParser : public ElementParser
 
             virtual void Verify()
             {
+                if(m_size.empty()) {
+                    ThrowMsg(Exception::ParseError,
+                        "size is mandatory - ignoring");
+                }
+
                 std::pair<DPL::String, DPL::String> boxSize;
                 boxSize.first = m_size;
                 boxSize.second = m_preview;
@@ -1729,7 +1756,7 @@ class AppWidgetParser : public ElementParser
             virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                                 const DPL::String& /*name*/)
             {
-                return &IgnoringParser::Create;
+                return &IgnoringParser::Create; //ignore unknown according to w3c
             }
 
             virtual void Accept(const XmlAttribute& attribute)
@@ -1761,6 +1788,42 @@ class AppWidgetParser : public ElementParser
 
             virtual void Verify()
             {
+                if (m_src.empty()) {
+                    ThrowMsg(Exception::ParseError,
+                        "src attribute of pd element is mandatory - ignoring");
+                }
+
+                if (m_width.empty()) {
+                    ThrowMsg(Exception::ParseError,
+                        "width attribute of pd element is mandatory - ignoring");
+                }
+
+                if (m_height.empty()) {
+                    ThrowMsg(Exception::ParseError,
+                        "height attribute of pd element is mandatory - ignoring");
+                }
+
+                if (ConvertToInt(m_width).IsNull()) {
+                    ThrowMsg(Exception::ParseError,
+                        "width attribute of pd element cannot be converted to int - ignoring. value: " << m_width);
+                }
+
+
+                DPL::OptionalInt height = ConvertToInt(m_height);
+
+                if (height.IsNull()) {
+                    ThrowMsg(Exception::ParseError,
+                        "height attribute of pd element cannot be converted to int - ignoring. value: " << m_height);
+                }
+
+                if (*height < 1) {
+                    m_height = L"1";
+                    LogDebug("height attribute of pd element shouldn't be less than 1. Changed to 1 from " << *height);
+                } else if (*height > 380){
+                    m_height = L"380";
+                    LogDebug("height attribute of pd element shouldn't be greater than 380. Changed to 380 from " << *height);
+                }
+
                 m_data.m_pdSrc = m_src;
                 m_data.m_pdWidth = m_width;
                 m_data.m_pdHeight = m_height;
@@ -1775,6 +1838,23 @@ class AppWidgetParser : public ElementParser
             {}
 
           private:
+            DPL::OptionalInt ConvertToInt(const DPL::String& intAsString)
+            {
+                char * endptr;
+                std::string tempStr = DPL::ToUTF8String(intAsString);
+                const char * intAsString_c = tempStr.c_str();
+                errno = 0;
+                long int intAsString_i = strtol(intAsString_c, &endptr, 10);
+
+                if ((errno == ERANGE && (intAsString_i == LONG_MAX || intAsString_i == LONG_MIN))
+                        || intAsString_i > INT_MAX || intAsString_i < INT_MIN
+                        || *endptr != '\0') {
+                    return DPL::OptionalInt::Null;
+                }
+
+                return static_cast<int>(intAsString_i);
+            }
+
             DPL::String m_src;
             DPL::String m_width;
             DPL::String m_height;
@@ -1832,6 +1912,38 @@ class AppWidgetParser : public ElementParser
 
         virtual void Verify()
         {
+            if (m_box.m_boxSrc.empty()) {
+                ThrowMsg(Exception::ParseError,
+                    "src attribute of box-content element is mandatory - ignoring");
+            }
+
+            if (!m_box.m_boxMouseEvent.empty() &&
+                    CheckIfNotTrueNorFalse(m_box.m_boxMouseEvent))
+            {
+                ThrowMsg(Exception::ParseError,
+                    "mouse-event attribute of box-content element should be true or false - ignoring");
+            }
+
+            if (!m_box.m_boxTouchEffect.empty() &&
+                    CheckIfNotTrueNorFalse(m_box.m_boxTouchEffect))
+            {
+                ThrowMsg(Exception::ParseError,
+                    "touch-effect attribute of box-content element should be true or false - ignoring");
+            }
+
+            if (m_box.m_boxMouseEvent.empty()) {
+                m_box.m_boxMouseEvent = L"false";
+            }
+
+            if (m_box.m_boxTouchEffect.empty()) {
+                m_box.m_boxTouchEffect = L"true";
+            }
+
+            if (m_box.m_boxSize.empty()) {
+                ThrowMsg(Exception::ParseError,
+                    "box-size element of box-content element not found - ignoring");
+            }
+
             m_data.m_boxInfo = m_box;
         }
 
@@ -1852,7 +1964,6 @@ class AppWidgetParser : public ElementParser
         }
 
       private:
-        DPL::String m_src;
         bool m_properNamespace;
         ConfigParserData::LiveboxInfo& m_data;
         ConfigParserData::LiveboxInfo::BoxContentInfo m_box;
@@ -1868,7 +1979,7 @@ class AppWidgetParser : public ElementParser
         } else if (name == L"box-content") {
             return DPL::MakeDelegate(this, &AppWidgetParser::OnBoxContentElement);
         } else {
-            return &IgnoringParser::Create;
+            return &IgnoringParser::Create; //ignore unknown according to w3c
         }
     }
 
@@ -1903,6 +2014,77 @@ class AppWidgetParser : public ElementParser
 
     virtual void Verify()
     {
+        if (m_liveboxId.empty()) {
+            ThrowMsg(Exception::ParseError,
+                 "app-widget element must have id attribute");
+        }
+        else
+        {
+            pcrecpp::RE re(REGEXP_ID_STRING.c_str());
+            if (!re.FullMatch(DPL::ToUTF8String(m_liveboxId)))
+            {
+                ThrowMsg(Exception::ParseError,
+                     "invalid format of app-widget id attribute");
+            }
+        }
+
+        if (m_primary.empty())
+        {
+            ThrowMsg(Exception::ParseError,
+                 "app-widget element must have primary attribute");
+        } else if (CheckIfNotTrueNorFalse(m_primary))
+        {
+            ThrowMsg(Exception::ParseError,
+                "auto-launch attribute of app-widget element should be true or false - ignoring");
+        }
+
+        if (!m_autoLaunch.empty() &&
+                CheckIfNotTrueNorFalse(m_autoLaunch))
+        {
+            ThrowMsg(Exception::ParseError,
+                "auto-launch attribute of app-widget element should be true or false - ignoring");
+        }
+
+        if (!m_updatePeriod.empty())
+        {
+            char * endptr;
+            errno = 0;
+            std::string tempStr = DPL::ToUTF8String(m_updatePeriod);
+
+            //set standard locale to fix decimal point mark - '.'
+            std::string currentLocale = setlocale(LC_NUMERIC, NULL);
+            if (NULL == setlocale(LC_NUMERIC, "C"))
+                LogWarning("Failed to change locale to \"C\"");
+            double updatePeriod = strtod(tempStr.c_str(), &endptr);
+
+            //go back to previous locale
+            if (NULL == setlocale(LC_NUMERIC, currentLocale.c_str()))
+                LogWarning("Failed to set previous locale");
+
+            if ((errno == ERANGE && (updatePeriod == -HUGE_VAL || updatePeriod == HUGE_VAL))
+                    || *endptr != '\0') {
+                ThrowMsg(Exception::ParseError,
+                    "update-period attribute of app-widget element should be a number - ignoring. current value: " << m_updatePeriod);
+            } else if (updatePeriod < 1800.0) {
+                LogDebug("update-period attribute of app-widget element shouldn't be less than 1800.0 - changed to 1800 from value: " << m_updatePeriod);
+                m_updatePeriod = L"1800.0";
+            }
+        }
+
+        if (m_autoLaunch.empty()) {
+            m_autoLaunch = L"false";
+        }
+
+        if(m_livebox.m_label.empty()) {
+            ThrowMsg(Exception::ParseError,
+                "box-label element of app-widget element not found - ignoring");
+        }
+
+        if(!m_boxContentFound) {
+            ThrowMsg(Exception::ParseError,
+                "box-content element of app-widget element not found - ignoring");
+        }
+
         m_livebox.m_liveboxId = m_liveboxId;
         m_livebox.m_primary = m_primary;
         m_livebox.m_autoLaunch = m_autoLaunch;
@@ -1915,13 +2097,15 @@ class AppWidgetParser : public ElementParser
     explicit AppWidgetParser(ConfigParserData& data) :
         ElementParser(),
         m_data(data),
-        m_properNamespace(false)
+        m_properNamespace(false),
+        m_boxContentFound(false)
     {
         m_livebox = ConfigParserData::LiveboxInfo();
     }
 
     ElementParserPtr OnBoxLabelElement()
     {
+
         return ElementParserPtr(new BoxLabelParser(m_livebox));
     }
 
@@ -1932,10 +2116,12 @@ class AppWidgetParser : public ElementParser
 
     ElementParserPtr OnBoxContentElement()
     {
+        m_boxContentFound = true;
         return ElementParserPtr(new BoxContentParser(m_livebox));
     }
 
   private:
+    static std::string REGEXP_ID_STRING;
     ConfigParserData& m_data;
     ConfigParserData::LiveboxInfo m_livebox;
     DPL::String m_liveboxId;
@@ -1944,8 +2130,16 @@ class AppWidgetParser : public ElementParser
     DPL::String m_updatePeriod;
     DPL::String m_type;
     bool m_properNamespace;
+    bool m_boxContentFound;
+
+    static bool CheckIfNotTrueNorFalse(const DPL::String &stringToCheck)
+    {
+        return stringToCheck.compare(L"true") != 0 && stringToCheck.compare(L"false") != 0;
+    }
 };
 
+std::string AppWidgetParser::REGEXP_ID_STRING = std::string(ApplicationParser::REGEXP_ID) + "\\.[0-9A-Za-z]+";
+
 class AllowNavigationParser : public ElementParser
 {
   public:
@@ -1958,7 +2152,7 @@ class AllowNavigationParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     virtual void Accept(const Element& element)
@@ -2029,7 +2223,7 @@ class CspParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     CspParser(ConfigParserData& data) :
@@ -2074,7 +2268,7 @@ class CspReportOnlyParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     CspReportOnlyParser(ConfigParserData& data) :
@@ -2126,7 +2320,7 @@ class AccountParser : public ElementParser
                 virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                         const DPL::String& /*name*/)
                 {
-                    return &IgnoringParser::Create;
+                    return &IgnoringParser::Create; //ignore unknown according to w3c
                 }
 
                 virtual void Accept(const Text& text)
@@ -2184,7 +2378,7 @@ class AccountParser : public ElementParser
                 virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                         const DPL::String& /*name*/)
                 {
-                    return &IgnoringParser::Create;
+                    return &IgnoringParser::Create; //ignore unknown according to w3c
                 }
 
                 virtual void Accept(const Text& text)
@@ -2236,7 +2430,7 @@ class AccountParser : public ElementParser
                 virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                         const DPL::String& /*name*/)
                 {
-                    return &IgnoringParser::Create;
+                    return &IgnoringParser::Create; //ignore unknown according to w3c
                 }
 
                 virtual void Accept(const Text& text)
@@ -2283,7 +2477,7 @@ class AccountParser : public ElementParser
               } else if (name == L"capability") {
                   return DPL::MakeDelegate(this, &AccountProviderParser::OnCapabilityElement);
               } else {
-                  return &IgnoringParser::Create;
+                  return &IgnoringParser::Create; //ignore unknown according to w3c
               }
           }
 
@@ -2296,11 +2490,7 @@ class AccountParser : public ElementParser
           virtual void Accept(const XmlAttribute& attribute)
           {
               if (attribute.name == L"multiple-accounts-support") {
-                  if (attribute.value == L"") {
-                      return;
-                  }
-
-                  if (attribute.value == L"ture") {
+                  if (attribute.value == L"true") {
                       m_multiSupport = true;
                   }
               }
@@ -2345,7 +2535,7 @@ class AccountParser : public ElementParser
         if (name == L"account-provider") {
             return DPL::MakeDelegate(this, &AccountParser::OnProviderElement);
         } else {
-            return &IgnoringParser::Create;
+            return &IgnoringParser::Create; //ignore unknown according to w3c
         }
     }
 
@@ -2391,7 +2581,7 @@ class MetadataParser : public ElementParser
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& /*name*/)
     {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 
     virtual void Accept(const XmlAttribute& attribute)
@@ -2450,14 +2640,13 @@ class MetadataParser : public ElementParser
 
 ElementParser::ActionFunc WidgetParser::GetElementParser(
     const DPL::String& /*ns*/,
-    const DPL::String&
-    name)
+    const DPL::String& name)
 {
     FuncMap::const_iterator it = m_map.find(name);
     if (it != m_map.end()) {
         return it->second;
     } else {
-        return &IgnoringParser::Create;
+        return &IgnoringParser::Create; //ignore unknown according to w3c
     }
 }
 
@@ -2666,11 +2855,11 @@ void WidgetParser::Accept(const XmlAttribute& attribute)
 
         if (!v.empty()) {
             unsigned char c = v.c_str()[0];
-            if (c >= '0' && c <= '9') {
+            if (isdigit(c)) {
                 int val = 0;
                 for (size_t i = 0; i < v.size(); ++i) {
                     c = v.c_str()[i];
-                    if (c >= '0' && c <= '9') {
+                    if (isdigit(c)) {
                         val *= 10;
                         val += (c - '0');
                     } else {
index 6245ed0..c10e6e8 100644 (file)
 #include <widget_install/task_remove_backup.h>
 #include <widget_install/task_encrypt_resource.h>
 #include <widget_install/task_certificates.h>
-#include <widget_install/task_unzip.h>
 #include <widget_install/task_commons.h>
 #include <widget_install/task_prepare_reinstall.h>
 
 #include <widget_install/widget_install_errors.h>
 #include <widget_install/widget_install_context.h>
 #include <widget_install_to_external.h>
+#include <widget_install/widget_unzip.h>
 
 using namespace WrtDB;
 using namespace Jobs::Exceptions;
@@ -122,12 +122,15 @@ class InstallerTaskFail :
 
     void StepFail()
     {
-        if (m_result == ConfigureResult::Deferred) {
-            ThrowMsg(Jobs::WidgetInstall::Exceptions::Deferred,
-                    "widget installation or update deferred!");
-        } else if (m_result == ConfigureResult::Failed_InvalidConfig) {
+        if (m_result == ConfigureResult::Failed_InvalidConfig) {
             ThrowMsg(Jobs::WidgetInstall::Exceptions::WidgetConfigFileInvalid,
                     "invalid config");
+        } else if (m_result == ConfigureResult::Failed_OpenZipError) {
+            ThrowMsg(Jobs::WidgetInstall::Exceptions::OpenZipFailed,
+                    "can't open wgt file");
+        } else if (m_result == ConfigureResult::Failed_UnzipError) {
+            ThrowMsg(Jobs::WidgetInstall::Exceptions::ExtractFileFailed,
+                    "can't extract wgt file");
         } else if (m_result == ConfigureResult::Failed_LowerVersion) {
             ThrowMsg(Jobs::WidgetInstall::Exceptions::PackageLowerVersion,
                     "package version is lower than installed version");
@@ -138,7 +141,7 @@ class InstallerTaskFail :
             ThrowMsg(Jobs::WidgetInstall::Exceptions::WidgetRunningError,
                     "widget is running");
         } else if (m_result == ConfigureResult::Failed_DrmError) {
-            ThrowMsg(Jobs::WidgetInstall::Exceptions::DRMFailed,
+            ThrowMsg(Jobs::WidgetInstall::Exceptions::DrmDecryptFailed,
                     "drm failed");
         } else if (m_result == ConfigureResult::Failed_NotSupportRDSUpdate) {
             ThrowMsg(Jobs::WidgetInstall::Exceptions::NotSupportRDSUpdate,
@@ -167,7 +170,7 @@ JobWidgetInstall::JobWidgetInstall(
     m_exceptionCaught(Jobs::Exceptions::Success)
 {
     m_installerContext.mode = m_jobStruct.m_installMode;
-    ConfigureResult result = PrePareInstallation(widgetPath);
+    ConfigureResult result = prepareInstallation(widgetPath);
 
     if (result == ConfigureResult::Ok) {
         LogInfo("Configure installation succeeded");
@@ -175,16 +178,6 @@ JobWidgetInstall::JobWidgetInstall(
 
         AddTask(new TaskRecovery(m_installerContext));
 
-        // Create installation tasks
-        if (m_installerContext.widgetConfig.packagingType !=
-            WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
-            m_installerContext.widgetConfig.packagingType !=
-            WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
-            !m_isDRM)
-        {
-            AddTask(new TaskUnzip(m_installerContext));
-        }
-
         AddTask(new TaskWidgetConfig(m_installerContext));
         if (m_installerContext.widgetConfig.packagingType ==
             WrtDB::PKG_TYPE_HOSTED_WEB_APP)
@@ -218,15 +211,6 @@ JobWidgetInstall::JobWidgetInstall(
             AddTask(new TaskPrepareReinstall(m_installerContext));
         }
 
-        if (m_installerContext.widgetConfig.packagingType !=
-            WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
-            m_installerContext.widgetConfig.packagingType !=
-            WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
-            !m_isDRM)
-        {
-            AddTask(new TaskUnzip(m_installerContext));
-        }
-
         AddTask(new TaskWidgetConfig(m_installerContext));
 
         if (m_installerContext.widgetConfig.packagingType ==
@@ -261,23 +245,15 @@ JobWidgetInstall::JobWidgetInstall(
         // Any error in acecheck while update will break widget
         AddTask(new TaskSmack(m_installerContext));
         AddTask(new TaskRemoveBackupFiles(m_installerContext));
-    } else if (result == ConfigureResult::Deferred) {
-        // Installation is deferred
-        LogInfo("Configure installation deferred");
-
-        AddTask(new InstallerTaskFail(result));
-    } else if (result >= ConfigureResult::Failed &&
-            result <= ConfigureResult::Failed_NotSupportRDSUpdate) {
+    } else {
         // Installation is not allowed to proceed due to widget update policy
         LogWarning("Configure installation failed!");
 
         AddTask(new InstallerTaskFail(result));
-    } else {
-        Assert(false && "Invalid configure result!");
     }
 }
 
-ConfigureResult JobWidgetInstall::PrePareInstallation(
+ConfigureResult JobWidgetInstall::prepareInstallation(
     const std::string &widgetPath)
 {
     ConfigureResult result;
@@ -287,29 +263,28 @@ ConfigureResult JobWidgetInstall::PrePareInstallation(
     {
         std::string tempDir;
         if (m_installerContext.mode.extension == InstallMode::ExtensionType::DIR) {
-            std::ostringstream tempPathBuilder;
-            tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
-            tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
-            tempPathBuilder << "/";
-            tempPathBuilder << widgetPath;
-            tempDir = tempPathBuilder.str();;
+            if (m_installerContext.mode.command ==
+                    InstallMode::Command::REINSTALL) {
+                std::ostringstream tempPathBuilder;
+                tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+                tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
+                tempPathBuilder << "/";
+                tempPathBuilder << widgetPath;
+                tempDir = tempPathBuilder.str();;
+            } else {
+                tempDir = widgetPath;
+            }
         } else {
             tempDir =
                 Jobs::WidgetInstall::createTempPath(
                         m_installerContext.mode.rootPath ==
                             InstallMode::RootPath::RO);
-        }
-
-        m_isDRM = isDRMWidget(widgetPath);
-        if (true == m_isDRM) {
-            LogDebug("decrypt DRM widget");
-            if (DecryptDRMWidget(widgetPath, tempDir)) {
-                LogDebug("Failed decrypt DRM widget");
-                return ConfigureResult::Failed_DrmError;
-            }
+            WidgetUnzip wgtUnzip;
+            wgtUnzip.unzipWgtFile(widgetPath, tempDir);
         }
 
         LogDebug("widgetPath:" << widgetPath);
+        LogDebug("tempPath:" << tempDir);
 
         m_installerContext.widgetConfig.packagingType =
             checkPackageType(widgetPath, tempDir);
@@ -317,7 +292,6 @@ ConfigureResult JobWidgetInstall::PrePareInstallation(
                 widgetPath,
                 tempDir,
                 m_installerContext.widgetConfig.packagingType,
-                m_isDRM,
                 m_installerContext.mode.command == InstallMode::Command::REINSTALL);
         LogDebug("widget packaging type : " <<
                  m_installerContext.widgetConfig.packagingType.pkgType);
@@ -330,10 +304,20 @@ ConfigureResult JobWidgetInstall::PrePareInstallation(
         // Configure installation
         result = ConfigureInstallation(widgetPath, configData, tempDir);
     }
+    Catch(Exceptions::OpenZipFailed)
+    {
+        LogError("Failed to unzip for widget");
+        result = ConfigureResult::Failed_OpenZipError;
+    }
     Catch(Exceptions::ExtractFileFailed)
     {
-        LogError("Failed to create temporary path for widget");
-        result = ConfigureResult::Failed_InvalidConfig;
+        LogError("Failed to unzip for widget");
+        result = ConfigureResult::Failed_UnzipError;
+    }
+    Catch(Exceptions::DrmDecryptFailed)
+    {
+        LogError("Failed to unzip for widget");
+        result = ConfigureResult::Failed_DrmError;
     }
 
     return result;
@@ -638,7 +622,6 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
     const std::string &widgetSource,
     const std::string &tempPath,
     WrtDB::PackagingType pkgType,
-    bool isDRM,
     bool isReinstall)
 {
     // Parse config
@@ -676,78 +659,32 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
                                  configInfo,
                                  DPL::FromUTF32String(L"widget"))));
         } else {
-            if (!isDRM) {
-                std::unique_ptr<DPL::ZipInput> zipFile(
-                    new DPL::ZipInput(widgetSource));
-
-                std::unique_ptr<DPL::ZipInput::File> configFile;
-
-                // Open config.xml file
-                if (pkgType == PKG_TYPE_HYBRID_WEB_APP) {
-                    configFile.reset(zipFile->OpenFile(WITH_OSP_XML));
-                } else {
-                    configFile.reset(zipFile->OpenFile(CONFIG_XML));
-                }
-
-                // Extract config
-                DPL::BinaryQueue buffer;
-                DPL::AbstractWaitableInputAdapter inputAdapter(configFile.get());
-                DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
-                DPL::Copy(&inputAdapter, &outputAdapter);
-                parser.Parse(&buffer,
-                             ElementParserPtr(
-                                 new RootParser<WidgetParser>(configInfo,
-                                                              DPL::
-                                                                  FromUTF32String(
-                                                                  L"widget"))));
+            std::string configFile;
+            if (pkgType == PKG_TYPE_HYBRID_WEB_APP) {
+                configFile = tempPath + "/" + WITH_OSP_XML;
             } else {
-                // DRM widget
-                std::string configFile;
-                if (pkgType == PKG_TYPE_HYBRID_WEB_APP) {
-                    configFile = tempPath + "/" + WITH_OSP_XML;
-                } else {
-                    configFile = tempPath + "/" + CONFIG_XML;
-                }
-
-                parser.Parse(configFile,
-                             ElementParserPtr(
-                                 new RootParser<WidgetParser>(configInfo,
-                                                              DPL::
-                                                                  FromUTF32String(
-                                                                  L"widget"))));
+                configFile = tempPath + "/" + CONFIG_XML;
             }
+
+            parser.Parse(configFile,
+                    ElementParserPtr(
+                        new RootParser<WidgetParser>(configInfo,
+                            DPL::
+                            FromUTF32String(
+                                L"widget"))));
         }
     }
-    Catch(DPL::ZipInput::Exception::OpenFailed)
-    {
-        LogError("Failed to open widget package");
-        return ConfigParserData();
-    }
-    Catch(DPL::ZipInput::Exception::OpenFileFailed)
-    {
-        LogError("Failed to open config.xml file");
-        return ConfigParserData();
-    }
-    Catch(DPL::CopyFailed)
-    {
-        LogError("Failed to extract config.xml file");
-        return ConfigParserData();
-    }
-    Catch(DPL::FileInput::Exception::OpenFailed)
-    {
-        LogError("Failed to open config.xml file");
-        return ConfigParserData();
-    }
     Catch(ElementParser::Exception::ParseError)
     {
         LogError("Failed to parse config.xml file");
         return ConfigParserData();
     }
-    Catch(DPL::ZipInput::Exception::SeekFileFailed)
+    Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
     {
-        LogError("Failed to seek widget archive - corrupted package?");
+        LogError("Failed to find installed widget - give proper tizenId");
         return ConfigParserData();
     }
+
     return configInfo;
 }
 
@@ -956,60 +893,14 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType(
         return PKG_TYPE_HOSTED_WEB_APP;
     }
 
-    if (m_isDRM) {
-        std::string configFile = tempPath + "/" + CONFIG_XML;
-        if (WrtUtilFileExists(configFile)) {
-            return PKG_TYPE_NOMAL_WEB_APP;
-        }
-
-        configFile = tempPath + "/" + WITH_OSP_XML;
-        if (WrtUtilFileExists(configFile)) {
-            return PKG_TYPE_HYBRID_WEB_APP;
-        }
-    } else {
-        std::unique_ptr<DPL::ZipInput> zipFile;
-
-        Try
-        {
-            // Open zip file
-            zipFile.reset(new DPL::ZipInput(widgetSource));
-        }
-        Catch(DPL::ZipInput::Exception::OpenFailed)
-        {
-            LogDebug("Failed to open widget package");
-            return PKG_TYPE_UNKNOWN;
-        }
-        Catch(DPL::ZipInput::Exception::SeekFileFailed)
-        {
-            LogError("Failed to seek widget package file");
-            return PKG_TYPE_UNKNOWN;
-        }
-
-        Try
-        {
-            // Open config.xml file in package root
-            std::unique_ptr<DPL::ZipInput::File> configFile(
-                zipFile->OpenFile(CONFIG_XML));
-            return PKG_TYPE_NOMAL_WEB_APP;
-        }
-        Catch(DPL::ZipInput::Exception::OpenFileFailed)
-        {
-            LogDebug("Could not find config.xml");
-        }
-
-        Try
-        {
-            // Open config.xml file in package root
-            std::unique_ptr<DPL::ZipInput::File> configFile(
-                zipFile->OpenFile(WITH_OSP_XML));
+    std::string configFile = tempPath + "/" + CONFIG_XML;
+    if (WrtUtilFileExists(configFile)) {
+        return PKG_TYPE_NOMAL_WEB_APP;
+    }
 
-            return PKG_TYPE_HYBRID_WEB_APP;
-        }
-        Catch(DPL::ZipInput::Exception::OpenFileFailed)
-        {
-            LogDebug("Could not find wgt/config.xml");
-            return PKG_TYPE_UNKNOWN;
-        }
+    configFile = tempPath + "/" + WITH_OSP_XML;
+    if (WrtUtilFileExists(configFile)) {
+        return PKG_TYPE_HYBRID_WEB_APP;
     }
 
     return PKG_TYPE_UNKNOWN;
@@ -1094,19 +985,6 @@ void JobWidgetInstall::setInstallLocationType(
     }
 }
 
-bool JobWidgetInstall::isDRMWidget(std::string /*widgetPath*/)
-{
-    /* TODO */
-    return false;
-}
-
-bool JobWidgetInstall::DecryptDRMWidget(std::string /*widgetPath*/,
-                                        std::string /*destPath*/)
-{
-    /* TODO */
-    return false;
-}
-
 bool JobWidgetInstall::checkSupportRDSUpdate(const WrtDB::ConfigParserData
         &configInfo)
 {
index 7d5862d..1eebc7b 100644 (file)
@@ -40,7 +40,6 @@ namespace WidgetInstall {
 enum class ConfigureResult
 {
     Ok,
-    Deferred,
     Updated,
     Failed,
     Failed_InvalidConfig,
@@ -49,6 +48,8 @@ enum class ConfigureResult
     Failed_WidgetRunning,
     Failed_DrmError,
     Failed_NotSupportRDSUpdate,
+    Failed_OpenZipError,
+    Failed_UnzipError,
 };
 
 class JobWidgetInstall :
@@ -65,7 +66,6 @@ class JobWidgetInstall :
     std::string m_exceptionMessage;
     WidgetUpdateInfo m_widgetUpdateInfo;
     bool m_needEncryption;
-    bool m_isDRM;
 
     ConfigureResult ConfigureInstallation(const std::string &widgetSource,
                                           const WrtDB::ConfigParserData
@@ -75,7 +75,6 @@ class JobWidgetInstall :
         const std::string &widgetSource,
         const std::string &tempPath,
         WrtDB::PackagingType pkgType,
-        bool isDRM,
         bool isReinstall);
     static WidgetUpdateInfo detectWidgetUpdate(
         const WrtDB::ConfigParserData &configInfo,
@@ -91,9 +90,7 @@ class JobWidgetInstall :
     bool detectResourceEncryption(const WrtDB::ConfigParserData &configData);
     void setInstallLocationType(const WrtDB::ConfigParserData
                                 &configData);
-    bool isDRMWidget(std::string widgetPath);
-    bool DecryptDRMWidget(std::string widgetPath, std::string destPath);
-    ConfigureResult PrePareInstallation(const std::string &widgetPath);
+    ConfigureResult prepareInstallation(const std::string &widgetPath);
     bool validateTizenApplicationID(const WrtDB::TizenAppId &tizenAppId);
     bool validateTizenPackageID(const WrtDB::TizenPkgId &tizenPkgId);
     ConfigureResult checkWidgetUpdate(const WidgetUpdateInfo &update);
old mode 100644 (file)
new mode 100755 (executable)
index 15f381e..9688ee2
@@ -367,11 +367,25 @@ void LiveBox::serialize(xmlTextWriterPtr writer)
     writeAttribute(writer, "nodisplay", "false");
 
     if (!this->label.empty()) {
-        startElement(writer, "label");
-        writeText(writer, this->label);
-        endElement(writer);
+        int defaultLabelChk = 0;
+        FOREACH(m, this->label)
+        {
+            std::pair<DPL::String, DPL::String> boxLabel = *m;
+            startElement(writer, "label");
+            if (!boxLabel.first.empty()) {
+                writeAttribute(writer, "xml:lang", boxLabel.first);
+            } else {
+                defaultLabelChk++;
+            }
+            writeText(writer, boxLabel.second);
+            endElement(writer);
+        }
+        if(!defaultLabelChk) {
+            startElement(writer, "label");
+            writeText(writer, DPL::FromUTF8String("NO NAME"));
+            endElement(writer);
+        }
     }
-
     if (!this->icon.empty()) {
         startElement(writer, "icon");
         writeText(writer, this->icon);
old mode 100644 (file)
new mode 100755 (executable)
index cb7e6d6..30a849d
@@ -406,6 +406,7 @@ typedef UiApplication UiApplicationType;
  * @brief LiveBox element
  */
 typedef std::list<std::pair<DPL::String, DPL::String> > boxSizeType;
+typedef std::list<std::pair<DPL::String, DPL::String> > boxLabelType;
 
 struct BoxInfo
 {
@@ -435,7 +436,7 @@ class LiveBox
     {
         this->updatePeriod = x;
     }
-    void setLabel(const NcnameType &x)
+    void setLabel(const boxLabelType &x)
     {
         this->label = x;
     }
@@ -456,8 +457,9 @@ class LiveBox
     NcnameType autoLaunch;
     NcnameType updatePeriod;
     NcnameType timeout;
-    NcnameType label;
+    boxLabelType label;
     NcnameType icon;
+    NcnameType lang;
     BoxInfoType box;
 };
 
index edf9f1d..68189ac 100644 (file)
@@ -265,7 +265,8 @@ void TaskCertify::stepSignature()
                          "Certificate is REVOKED");
             }
 
-            if (result == WrtSignatureValidator::SIGNATURE_INVALID) {
+            if (result == WrtSignatureValidator::SIGNATURE_INVALID &&
+                    iter->getFileNumber() <= 1) {
                 LogWarning("Signature is INVALID");
                 // TODO change exception name
                 ThrowMsg(Exceptions::SignatureInvalid,
@@ -273,18 +274,13 @@ void TaskCertify::stepSignature()
             }
 
             if (data.isAuthorSignature()) {
-                if (result == WrtSignatureValidator::SIGNATURE_VERIFIED ||
-                    m_contextData.wacSecurity.isDistributorSigned())
-                {
+                if (result == WrtSignatureValidator::SIGNATURE_VERIFIED ) {
                     processAuthorSignature(data);
-                } else if (result ==
-                           WrtSignatureValidator::SIGNATURE_DISREGARD)
-                {
-                    continue;
                 }
             } else {
-                // now signature _must_ be verified
-                processDistributorSignature(data);
+                if (result != WrtSignatureValidator::SIGNATURE_INVALID) {
+                    processDistributorSignature(data);
+                }
             }
         } Catch(ParserSchemaException::Base) {
             LogError("Error occured in ParserSchema.");
index e9d1b6c..29fda9a 100644 (file)
@@ -30,7 +30,6 @@
 #include <widget_install/widget_install_context.h>
 #include <web_provider_livebox_info.h>
 #include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/foreach.h>
 #include <dpl/utils/wrt_utility.h>
 #include <dpl/log/log.h>
@@ -43,7 +42,6 @@
 #include <ace_registration.h>
 #include <errno.h>
 #include <string.h>
-#include <vconf.h>
 #include <map>
 
 using namespace WrtDB;
@@ -61,7 +59,6 @@ TaskDatabase::TaskDatabase(InstallerContext& context) :
     AddStep(&TaskDatabase::StepAceDBInsert);
     AddStep(&TaskDatabase::StepSecurityOriginDBInsert);
     AddStep(&TaskDatabase::StepRemoveExternalFiles);
-    AddStep(&TaskDatabase::StepCreateVconf);
     AddStep(&TaskDatabase::StepLiveboxDBInsert);
 
     AddAbortStep(&TaskDatabase::StepAbortDBInsert);
@@ -249,43 +246,6 @@ void TaskDatabase::StepRemoveExternalFiles()
     }
 }
 
-void TaskDatabase::StepCreateVconf()
-{
-    LogDebug("StepCreateVconf");
-    std::map<std::string, WrtDB::SettingsType> vconfData;
-    vconfData[
-        WrtDB::VconfConfig::GetVconfKeyPopupUsage(
-            m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
-    vconfData[
-        WrtDB::VconfConfig::GetVconfKeyGeolocationUsage(
-            m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
-    vconfData[
-        WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage(
-            m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
-    vconfData[
-        WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage(
-            m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
-    vconfData[
-        WrtDB::VconfConfig::GetVconfKeyMemorySavingMode(
-            m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_OFF;
-
-    // vconftool -g 5000 set -t int <path> 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<int>((*it).second) << "\"";
-        int ret = system(command.str().c_str());
-        if (-1 == ret) {
-            ThrowMsg(Exceptions::CreateVconfFailure,
-                     "Failed to create vconf files");
-        }
-    }
-}
-
 void TaskDatabase::StepAbortDBInsert()
 {
     LogWarning("[DB Update Task] Aborting... (DB Clean)");
index 88d99e9..e3e4951 100644 (file)
@@ -50,7 +50,6 @@ class TaskDatabase :
     void StepAceDBInsert();
     void StepSecurityOriginDBInsert();
     void StepRemoveExternalFiles();
-    void StepCreateVconf();
     void StepLiveboxDBInsert();
 
     void StepAbortDBInsert();
index 0b47580..e6838e5 100644 (file)
@@ -40,8 +40,7 @@
 #include <dpl/scoped_fclose.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <dpl/string.h>
-#include <FBaseByteBuffer.h>
-#include <security/FSecCrypto_TrustZoneService.h>
+#include <ss_manager.h>
 
 #include <widget_install/job_widget_install.h>
 #include <widget_install/widget_install_context.h>
 
 using namespace WrtDB;
 
-extern "C"
-{
-    void InitWebAppInfo(const char* appId, const char* rootPath);
-}
-
 namespace {
-const std::size_t ENCRYPTION_CHUNK_MAX_SIZE = 4096; // bytes
+const std::size_t ENCRYPTION_CHUNK_MAX_SIZE = 8192; // bytes
 const std::size_t ENCRYPTION_DEC_CHUNK_SIZE = 4; // bytes
-static bool initWebApp = false;
 
 std::set<std::string>& getSupportedForEncryption()
 {
@@ -168,60 +161,17 @@ void writeBytes(unsigned char* buffer, std::size_t count, FILE* stream)
     } while ((bytesWritten != bytesToWrite) && (EINTR == errno));
 }
 
-/*
- * get encrypted string from trustzone
-*/
-Tizen::Base::ByteBuffer* EncryptChunkByTrustZone(
-        Tizen::Base::ByteBuffer* appInfo,
-        const unsigned char *plainBuffer,
-        int pBufSize)
+int ssmEncrypt(InstallMode::RootPath rootPath, std::string pkgId, const char*
+        inChunk, int inBytes, char** outChunk, int *outBytes)
 {
-    using namespace Tizen::Base;
-    if(!initWebApp)
-    {
-        char* pAppId = null;
-        pAppId = (char*)calloc(appInfo->GetRemaining()+1, 1);
-        memcpy(pAppId, appInfo->GetPointer(), appInfo->GetRemaining());
-        InitWebAppInfo(pAppId, "");
-        free (pAppId);
-        initWebApp = true;
+    if (rootPath == InstallMode::RootPath::RO) {
+        return ssm_encrypt_preloaded_application(inChunk, inBytes,
+                outChunk, outBytes);
+    } else {
+        return ssm_encrypt(pkgId.c_str(), pkgId.length(),
+                inChunk, inBytes,
+                outChunk, outBytes);
     }
-
-    Tizen::Security::Crypto::_TrustZoneService* pInstance;
-    pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance();
-
-    ByteBuffer pBuf;
-    pBuf.Construct(pBufSize);
-    const byte *pByte = reinterpret_cast<const byte*>(plainBuffer);
-    if (pBuf.SetArray(pByte, 0, pBufSize) != E_SUCCESS) {
-        LogDebug("Couldnot set pBuf");
-        return NULL;
-    }
-    pBuf.Flip();
-
-    return pInstance->_TrustZoneService::EncryptN(*appInfo, pBuf);
-}
-
-Tizen::Base::ByteBuffer* TEST_dec(
-        Tizen::Base::ByteBuffer* appInfo,
-        const unsigned char *plainBuffer,
-        int pBufSize)
-{
-    using namespace Tizen::Base;
-
-    Tizen::Security::Crypto::_TrustZoneService* pInstance;
-    pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance();
-
-    ByteBuffer pBuf;
-    pBuf.Construct(pBufSize);
-    const byte *pByte = reinterpret_cast<const byte*>(plainBuffer);
-    if (pBuf.SetArray(pByte, 0, pBufSize) != E_SUCCESS) {
-        LogDebug("Couldnot set pBuf");
-        return NULL;
-    }
-    pBuf.Flip();
-
-    return pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf);
 }
 }
 
@@ -318,76 +268,62 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
         return;
     }
 
-    DPL::ScopedFClose inFile(openFile(fileName, "r"));
-    DPL::ScopedFClose outFile(openFile(encFile, "w"));
-
-    const std::size_t chunkSize = (fileSize > ENCRYPTION_CHUNK_MAX_SIZE
-            ? ENCRYPTION_CHUNK_MAX_SIZE : fileSize);
+    // If update installed preload web, should skip encryption.
+    if (!(m_context.mode.rootPath == InstallMode::RootPath::RO &&
+                m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
+                && m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
 
-    std::unique_ptr<unsigned char[]> inChunk(new unsigned char[chunkSize]);
-    std::unique_ptr<unsigned char[]> outChunk;
+        DPL::ScopedFClose inFile(openFile(fileName, "r"));
+        DPL::ScopedFClose outFile(openFile(encFile, "w"));
 
-    std::size_t bytesRead = 0;
-    using namespace Tizen::Base;
+        const std::size_t chunkSize = (fileSize > ENCRYPTION_CHUNK_MAX_SIZE
+                ? ENCRYPTION_CHUNK_MAX_SIZE : fileSize);
 
-    std::string pkgid =
-        DPL::ToUTF8String(m_context.widgetConfig.tzAppid).c_str();
-    const byte *b_pkgid = reinterpret_cast<const byte*>(
-            pkgid.c_str());
-    ByteBuffer appInfo;
-    appInfo.Construct(pkgid.length());
+        std::unique_ptr<unsigned char[]> inChunk(new unsigned char[chunkSize]);
+        std::size_t bytesRead = 0;
+        /* TODO : pkgId should change to appId after wrt-client label changed. */
+        std::string pkgId = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid);
 
-    if (appInfo.SetArray(b_pkgid, 0, pkgid.length()) != E_SUCCESS) {
-        LogDebug("Couldnot set appInfo");
-        return;
-    }
-
-    appInfo.Flip();
-
-    do
-    {
-        bytesRead = readBytes(inChunk.get(), chunkSize, inFile.Get());
-        if (0 != bytesRead) {
-            ByteBuffer *getBuffer = EncryptChunkByTrustZone(
-                    &appInfo,
-                    inChunk.get(), bytesRead);
-            if (getBuffer == NULL) {
-                ThrowMsg(Exceptions::EncryptionFailed,
-                        "Encryption Failed using TrustZone");
+        do
+        {
+            bytesRead = readBytes(inChunk.get(), chunkSize, inFile.Get());
+            if (0 != bytesRead) {
+                int outDecSize = 0;
+                char *outChunk = NULL;
+                if (0 != ssmEncrypt(m_context.mode.rootPath, pkgId,
+                            (char*)inChunk.get(), (int)bytesRead,
+                            &outChunk, &outDecSize)) {
+                    ThrowMsg(Exceptions::EncryptionFailed,
+                            "Encryption Failed using TrustZone");
+                }
+
+                std::stringstream toString;
+                toString << outDecSize;
+
+                writeBytes((unsigned char*)toString.str().c_str(),
+                        sizeof(int), outFile.Get());
+                writeBytes((unsigned char*)outChunk, outDecSize, outFile.Get());
+                delete outChunk;
             }
-            int decBufSize = getBuffer->GetRemaining();
+            inChunk.reset(new unsigned char[chunkSize]);
 
-            outChunk.reset(new unsigned char[decBufSize]);
-            memcpy(outChunk.get(), getBuffer->GetPointer(), getBuffer->GetRemaining());
-            getBuffer->Reset();
+        } while (0 == std::feof(inFile.Get()));
 
-            char writeSize[ENCRYPTION_DEC_CHUNK_SIZE];
-            memset(writeSize, 0x00, ENCRYPTION_DEC_CHUNK_SIZE);
-            std::stringstream toString;
-            toString << decBufSize;
-            strncpy(writeSize, toString.str().c_str(), toString.str().length());
+        outFile.Reset();
+        inFile.Reset();
 
-            writeBytes((unsigned char*)writeSize,
-                    ENCRYPTION_DEC_CHUNK_SIZE, outFile.Get());
-            writeBytes(outChunk.get(), decBufSize, outFile.Get());
+        LogDebug("File encrypted successfully");
+        LogDebug("Remove plain-text file: " << fileName);
+        if (0 != unlink(fileName.c_str()))
+        {
+            Throw(Exceptions::EncryptionFailed);
         }
 
-    } while (0 == std::feof(inFile.Get()));
-
-    outFile.Reset();
-    inFile.Reset();
-
-    LogDebug("File encrypted successfully");
-    LogDebug("Remove plain-text file: " << fileName);
-    if (0 != unlink(fileName.c_str()))
-    {
-        Throw(Exceptions::EncryptionFailed);
-    }
-
-    LogDebug("Rename encrypted file");
-    if (0 != std::rename(encFile.c_str(), fileName.c_str()))
-    {
-        Throw(Exceptions::EncryptionFailed);
+        LogDebug("Rename encrypted file");
+        if (0 != std::rename(encFile.c_str(), fileName.c_str()))
+        {
+            Throw(Exceptions::EncryptionFailed);
+        }
     }
 
     std::string realPath = fileName;
index b365d9a..fa229cd 100644 (file)
@@ -43,7 +43,7 @@
 
 namespace {
 const mode_t PRIVATE_STORAGE_MODE = 0700;
-const mode_t SHARE_MODE = 0705;
+const mode_t SHARED_STORAGE_MODE = 0755;
 }
 
 using namespace WrtDB;
@@ -99,12 +99,12 @@ bool _FolderCopy(std::string source, std::string dest)
     return true;
 }
 
-void changeOwnerForDirectory(std::string storagePath) {
+void changeOwnerForDirectory(std::string storagePath, mode_t mode) {
     if (euidaccess(storagePath.c_str(), F_OK) != 0) {
-        if (!WrtUtilMakeDir(storagePath, PRIVATE_STORAGE_MODE)) {
-            LogError("Failed to create directory for private storage");
+        if (!WrtUtilMakeDir(storagePath, mode)) {
+            LogError("Failed to create directory : " << storagePath);
             ThrowMsg(Jobs::WidgetInstall::Exceptions::FileOperationFailed,
-                     "Failed to create directory for private storage");
+                     "Failed to create directory : " << storagePath);
         }
         // '5000' is default uid, gid for applications.
         // So installed applications should be launched as process of uid
@@ -118,7 +118,7 @@ void changeOwnerForDirectory(std::string storagePath) {
                      "Chown to invaild user");
         }
     } else if (euidaccess(storagePath.c_str(), W_OK | R_OK | X_OK) == 0) {
-        LogInfo("Private storage already exists.");
+        LogInfo(storagePath << " already exists.");
         // Even if private directory already is created, private dircetory
         // should change owner.
         if (chown(storagePath.c_str(),
@@ -128,7 +128,7 @@ void changeOwnerForDirectory(std::string storagePath) {
             ThrowMsg(Jobs::WidgetInstall::Exceptions::FileOperationFailed,
                      "Chown to invaild user");
         }
-        if (chmod(storagePath.c_str(), PRIVATE_STORAGE_MODE) != 0) {
+        if (chmod(storagePath.c_str(), mode) != 0) {
             ThrowMsg(Jobs::WidgetInstall::Exceptions::FileOperationFailed,
                      "chmod to 0700");
         }
@@ -216,7 +216,11 @@ void TaskFileManipulation::StepCreatePrivateStorageDir()
                     "Error occurs copy private strage files");
         }
     }
-    changeOwnerForDirectory(storagePath);
+    changeOwnerForDirectory(storagePath, PRIVATE_STORAGE_MODE);
+
+    std::string tempStoragePath = m_context.locations->getPrivateTempStorageDir();
+    LogDebug("Create temp private storage directory : " << tempStoragePath);
+    changeOwnerForDirectory(tempStoragePath, PRIVATE_STORAGE_MODE);
 }
 
 void TaskFileManipulation::StepRenamePath()
@@ -287,7 +291,7 @@ void TaskFileManipulation::StepLinkForPreload()
                 ThrowMsg(Exceptions::FileOperationFailed,
                         "Symbolic link creating is not done.");
             }
-            changeOwnerForDirectory(dataDir);
+            changeOwnerForDirectory(dataDir, PRIVATE_STORAGE_MODE);
         }
 
         if (m_context.widgetConfig.packagingType != PKG_TYPE_HYBRID_WEB_APP) {
@@ -431,8 +435,10 @@ void TaskFileManipulation::StepCreateSharedFolder()
         }
     } else {
         WrtUtilMakeDir(m_context.locations->getSharedResourceDir());
-        WrtUtilMakeDir(m_context.locations->getSharedDataDir());
-        WrtUtilMakeDir(m_context.locations->getSharedTrustedDir());
+        changeOwnerForDirectory(m_context.locations->getSharedDataDir(),
+                SHARED_STORAGE_MODE);
+        changeOwnerForDirectory(m_context.locations->getSharedTrustedDir(),
+                SHARED_STORAGE_MODE);
     }
 }
 } //namespace WidgetInstall
old mode 100644 (file)
new mode 100755 (executable)
index 19d2ee4..d9cfeaa
@@ -59,8 +59,9 @@ using namespace WrtDB;
 namespace {
 typedef std::map<DPL::String, DPL::String> LanguageTagMap;
 
-const char* const ST_TRUE = "true";
-const char* const ST_NODISPLAY = "nodisplay";
+const char* const STR_TRUE = "true";
+const char* const STR_FALSE = "false";
+const char* const STR_NODISPLAY = "nodisplay";
 
 LanguageTagMap getLanguageTagMap()
 {
@@ -114,8 +115,7 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
         AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
         AddStep(&TaskManifestFile::stepCreateExecFile);
         AddStep(&TaskManifestFile::stepGenerateManifest);
-        AddStep(&TaskManifestFile::stepParseUpgradedManifest);
-        AddStep(&TaskManifestFile::stepUpdateFinalize);
+        AddStep(&TaskManifestFile::stepParseManifest);
 
         AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
     } else {
@@ -124,7 +124,6 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
         AddStep(&TaskManifestFile::stepCreateExecFile);
         AddStep(&TaskManifestFile::stepGenerateManifest);
         AddStep(&TaskManifestFile::stepParseManifest);
-        AddStep(&TaskManifestFile::stepFinalize);
 
         AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
     }
@@ -152,8 +151,6 @@ void TaskManifestFile::stepCreateExecFile()
         if (error)
             LogPedantic("Failed to make a symbolic name for a file "
                     << "[" <<  DPL::GetErrnoString(error) << "]");
-        ThrowMsg(Exceptions::FileOperationFailed,
-                "Symbolic link creating is not done.");
     }
 
     // app-control widgets
@@ -176,8 +173,6 @@ void TaskManifestFile::stepCreateExecFile()
                 LogPedantic("Failed to make a symbolic name for a file "
                     << "[" <<  DPL::GetErrnoString(error) << "]");
             }
-            ThrowMsg(Exceptions::FileOperationFailed,
-                     "Symbolic link creating is not done.");
         }
     }
 #else
@@ -190,8 +185,6 @@ void TaskManifestFile::stepCreateExecFile()
         if (error)
             LogPedantic("Failed to make a symbolic name for a file "
                     << "[" <<  DPL::GetErrnoString(error) << "]");
-        ThrowMsg(Exceptions::FileOperationFailed,
-                "Symbolic link creating is not done.");
     }
 #endif
     m_context.job->UpdateProgress(
@@ -430,12 +423,6 @@ void TaskManifestFile::stepAbortIconFiles()
     }
 }
 
-void TaskManifestFile::stepUpdateFinalize()
-{
-    commitManifest();
-    LogDebug("Finished Update Desktopfile");
-}
-
 DPL::String TaskManifestFile::getIconTargetFilename(
     const DPL::String& languageTag) const
 {
@@ -464,12 +451,6 @@ DPL::String TaskManifestFile::getIconTargetFilename(
     return filename.str();
 }
 
-void TaskManifestFile::stepFinalize()
-{
-    commitManifest();
-    LogInfo("Finished ManifestFile step");
-}
-
 void TaskManifestFile::saveLocalizedKey(std::ofstream &file,
                                         const DPL::String& key,
                                         const DPL::String& languageTag)
@@ -585,6 +566,17 @@ void TaskManifestFile::stepGenerateManifest()
 
     writeManifest(manifest_file);
 
+    std::ostringstream destFile;
+    if (m_context.mode.rootPath == InstallMode::RootPath::RO) {
+        destFile << "/usr/share/packages" << "/"; //TODO constant with path
+    } else {
+        destFile << "/opt/share/packages" << "/"; //TODO constant with path
+    }
+
+    destFile << DPL::ToUTF8String(manifest_name);
+    commit_manifest = destFile.str();
+    LogDebug("Commiting manifest file : " << commit_manifest);
+
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_CREATE_MANIFEST,
         "Widget Manifest Creation Finished");
@@ -592,61 +584,65 @@ void TaskManifestFile::stepGenerateManifest()
 
 void TaskManifestFile::stepParseManifest()
 {
-    int code = pkgmgr_parser_parse_manifest_for_installation(
-            DPL::ToUTF8String(manifest_file).c_str(), NULL);
+    int code = 0;
 
-    if (code != 0) {
-        LogError("Manifest parser error: " << code);
-        ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
-    }
+    char* updateTags[3] = {NULL, };
 
-    m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_CREATE_MANIFEST,
-        "Widget Manifest Parsing Finished");
-    LogDebug("Manifest parsed");
-}
+    if (!m_context.mode.removable) {
+        updateTags[0] = "preload=false";
+        updateTags[1] = "removable=false";
+        updateTags[2] = NULL;
 
-void TaskManifestFile::stepParseUpgradedManifest()
-{
-    if (m_context.widgetConfig.packagingType !=
-            PKG_TYPE_HYBRID_WEB_APP)
-    {
-        int code = pkgmgr_parser_parse_manifest_for_upgrade(
-                DPL::ToUTF8String(manifest_file).c_str(), NULL);
+    }
+
+    if (!access(commit_manifest.c_str(), F_OK) == 0) {
+        commitManifest();
+        code = pkgmgr_parser_parse_manifest_for_installation(
+                commit_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
 
         if (code != 0) {
             LogError("Manifest parser error: " << code);
             ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
         }
+    } else {
+        if (m_context.widgetConfig.packagingType !=
+                PKG_TYPE_HYBRID_WEB_APP)
+        {
+            commitManifest();
+            code = pkgmgr_parser_parse_manifest_for_upgrade(
+                    commit_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
 
-        m_context.job->UpdateProgress(
-                InstallerContext::INSTALL_CREATE_MANIFEST,
-                "Widget Manifest Parsing Finished");
-        LogDebug("Manifest parsed");
+            if (code != 0) {
+                LogError("Manifest parser error: " << code);
+                ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
+            }
+
+        }
     }
+
+    m_context.job->UpdateProgress(
+            InstallerContext::INSTALL_CREATE_MANIFEST,
+            "Widget Manifest Parsing Finished");
+    LogDebug("Manifest parsed");
 }
 
 void TaskManifestFile::commitManifest()
 {
-    LogDebug("Commiting manifest file : " << manifest_file);
 
-    std::ostringstream destFile;
-    if (m_context.mode.rootPath == InstallMode::RootPath::RO) {
-        destFile << "/usr/share/packages" << "/"; //TODO constant with path
-    } else {
-        destFile << "/opt/share/packages" << "/"; //TODO constant with path
-    }
-    destFile << DPL::ToUTF8String(manifest_name);
-    LogInfo("cp " << manifest_file << " " << destFile.str());
+    if (!(m_context.mode.rootPath == InstallMode::RootPath::RO &&
+                m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
+                && m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
+        LogInfo("cp " << manifest_file << " " << commit_manifest);
 
-    DPL::FileInput input(DPL::ToUTF8String(manifest_file));
-    DPL::FileOutput output(destFile.str());
-    DPL::Copy(&input, &output);
-    LogDebug("Manifest writen to: " << destFile.str());
+        DPL::FileInput input(DPL::ToUTF8String(manifest_file));
+        DPL::FileOutput output(commit_manifest);
+        DPL::Copy(&input, &output);
+        LogDebug("Manifest writen to: " << commit_manifest);
 
-    //removing temp file
-    unlink((DPL::ToUTF8String(manifest_file)).c_str());
-    manifest_file = DPL::FromUTF8String(destFile.str().c_str());
+        //removing temp file
+        unlink((DPL::ToUTF8String(manifest_file)).c_str());
+        manifest_file = DPL::FromUTF8String(commit_manifest);
+    }
 }
 
 void TaskManifestFile::writeManifest(const DPL::String & path)
@@ -943,8 +939,8 @@ void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp)
 {
     FOREACH(it, m_context.widgetConfig.configInfo.settingsList)
     {
-        if (!strcmp(DPL::ToUTF8String(it->m_name).c_str(), ST_NODISPLAY)) {
-            if (!strcmp(DPL::ToUTF8String(it->m_value).c_str(), ST_TRUE)) {
+        if (!strcmp(DPL::ToUTF8String(it->m_name).c_str(), STR_NODISPLAY)) {
+            if (!strcmp(DPL::ToUTF8String(it->m_value).c_str(), STR_TRUE)) {
                 uiApp.setNodisplay(true);
                 uiApp.setTaskmanage(false);
             } else {
@@ -1079,8 +1075,21 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
             liveBox.setUpdatePeriod(ConfigInfo->m_updatePeriod);
         }
 
-        if (ConfigInfo->m_label != L"") {
-            liveBox.setLabel(ConfigInfo->m_label);
+        std::list<std::pair<DPL::String, DPL::String> > boxLabelList;
+        if (!ConfigInfo->m_label.empty()) {
+            FOREACH(im, ConfigInfo->m_label) {
+                std::pair<DPL::String, DPL::String> boxSize;
+                Locale i = (*im).first;
+                // translate en -> en_US etc
+                DPL::OptionalString tag = getLangTag(i);
+                if (tag.IsNull()) {
+                    tag = i;
+                }
+                boxSize.first = (*tag);
+                boxSize.second = (*im).second;
+                boxLabelList.push_back(boxSize);
+            }
+            liveBox.setLabel(boxLabelList);
         }
 
         DPL::String defaultLocale =
index d4f1c90..efb1881 100644 (file)
@@ -61,7 +61,6 @@ class TaskManifestFile :
     //TODO stepAbort
     //steps
     void stepCreateExecFile();
-    void stepFinalize();
     void stepCopyIconFiles();
     void stepCopyLiveboxFiles();
     void stepGenerateManifest();
@@ -72,7 +71,6 @@ class TaskManifestFile :
 
     //For widget update
     void stepBackupIconFiles();
-    void stepUpdateFinalize();
 
     void stepAbortIconFiles();
 
@@ -83,6 +81,7 @@ class TaskManifestFile :
     xmlTextWriterPtr writer;
     DPL::String manifest_name;
     DPL::String manifest_file;
+    std::string commit_manifest;
 
     //private methods
 
index a007bf7..31ab408 100644 (file)
@@ -93,9 +93,8 @@ void TaskSmack::StepSmackFolderLabeling()
     /* /opt/usr/apps/[pkgid] directory's label is "_" */
     if (PC_OPERATION_SUCCESS != app_label_dir("_",
                 m_context.locations->getPackageInstallationDir().c_str())) {
-        free(m_pkgId);
-        ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                "Add Label failure");
+        LogWarning("Add label to " <<
+                m_context.locations->getPackageInstallationDir());
     }
 
     /* res directory */
@@ -103,83 +102,48 @@ void TaskSmack::StepSmackFolderLabeling()
         "/res";
     if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId,
                 resDir.c_str())) {
-        free(m_pkgId);
-        ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                "Add Label failure");
+        LogWarning("Add label to " << resDir);
     }
 
     /* for prealod */
-    if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD)
+    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())) {
-            free(m_pkgId);
-            ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                    "Add Label failure");
+            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())) {
-        free(m_pkgId);
-        ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                "Add Label failure");
+    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()))
+    {
+        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())) {
-        free(m_pkgId);
-        ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                "Add Label failure");
+        LogWarning("Add label to " << m_context.locations->getBinaryDir());
     }
 
     if(!setLabelForSharedDir(m_pkgId)) {
-        ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                "Add Label failure");
+        LogWarning("Add label to shared directory");
     }
 
     free(m_pkgId);
 
-    /* TODO : set label at wrt-client 
-
-    std::string app = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
-    char* appId = NULL;
-    appId = (char*)calloc(1, app.length() + 1);
-    snprintf(appId, app.length() + 1, "%s", app.c_str());
-
-    if (0 != smack_lsetlabel(m_context.locations->getExecFile().c_str(),
-                appId, SMACK_LABEL_ACCESS)) {
-        free(m_pkgId);
-        free(appId);
-        ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                "Add ACESS Label for binary failure");
-    }
-
-    if (0 != smack_lsetlabel(m_context.locations->getExecFile().c_str(),
-                appId, SMACK_LABEL_EXEC)) {
-        free(m_pkgId);
-        free(appId);
-        ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                "Add EXEC Label for binary failure");
-    }
-
-   if (PC_OPERATION_SUCCESS != app_add_friend(m_pkgId, appId)) {
-        free(m_pkgId);
-        free(appId);
-        ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                "Add friend failure");
-   }
-
-    if (PC_OPERATION_SUCCESS != app_label_shared_dir(appId, m_pkgId,
-                m_context.locations->getBinaryDir().c_str())) {
-        free(m_pkgId);
-        free(appId);
-        ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
-                "Add Label failure");
-    }
-    */
+    /* TODO : set label at wrt-client */
 #endif
 }
 
@@ -188,7 +152,7 @@ void TaskSmack::StepSmackPrivilege()
     LogInfo("----------------> SMACK:\
             Jobs::WidgetInstall::TaskSmack::SmackPrivilegeStep()");
 #ifdef WRT_SMACK_ENABLED
-    /* TODO : 
+    /* TODO :
     std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
     */
     std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid);
@@ -199,24 +163,29 @@ void TaskSmack::StepSmackPrivilege()
     WrtDB::ConfigParserData::PrivilegeList privileges =
         m_context.widgetConfig.configInfo.privilegeList;
 
-    const char** perm_list = new const char*[privileges.size() + 1];
+    char** perm_list = new char*[privileges.size() + 1];
     int index = 0;
     FOREACH(it, privileges) {
         LogInfo("Permission : " << it->name);
         int length = DPL::ToUTF8String(it->name).length();
-        char *priv = (char*) calloc(1, (sizeof(char) * length) + 1);
+        char *priv = new char[length + 1];
         snprintf(priv, length + 1, "%s",
-                DPL::ToUTF8String(it->name).c_str());
+                 DPL::ToUTF8String(it->name).c_str());
         perm_list[index++] = priv;
     }
     perm_list[index] = NULL;
 
     if (PC_OPERATION_SUCCESS != app_enable_permissions(appId, APP_TYPE_WGT,
-                perm_list, true)) {
-        LogError("failure in contructing smack rules based on perm_list");
+                const_cast<const char **>(perm_list), true)) {
+        LogWarning("failure in contructing smack rules based on perm_list");
     }
 
     free(appId);
+    index = 0;
+    while (NULL != perm_list[index]) {
+        delete [] perm_list[index++];
+    }
+    delete [] perm_list;
 
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_SMACK_ENABLE,
@@ -230,7 +199,7 @@ void TaskSmack::StepRevokeForUpdate()
             Jobs::WidgetInstall::TaskSmack::StepRevokePrivilegeForUpdate()");
 #ifdef WRT_SMACK_ENABLED
     if (PC_OPERATION_SUCCESS != app_revoke_permissions(m_pkgId)) {
-        LogError("failure in revoking smack permissions");
+        LogWarning("failure in revoking smack permissions");
     }
 #endif
 }
@@ -249,11 +218,11 @@ void TaskSmack::StepAbortSmack()
     */
 
     if (PC_OPERATION_SUCCESS != app_revoke_permissions(m_pkgId)) {
-        LogError("failure in revoking smack permissions");
+        LogWarning("failure in revoking smack permissions");
     }
 
     if (PC_OPERATION_SUCCESS != app_uninstall(m_pkgId)) {
-        LogError("failure in removing smack rules file");
+        LogWarning("failure in removing smack rules file");
     }
     free(m_pkgId);
 #endif
index 12af068..1c41e5d 100644 (file)
@@ -68,11 +68,14 @@ void TaskUpdateFiles::StepBackupDirectory()
     LogDebug("StepCreateBackupFolder");
 
     std::string backPath = m_context.locations->getBackupDir();
-    LogDebug("backup resource directory path : " << backPath);
+    LogDebug("Backup resource directory path : " << backPath);
     std::string pkgPath = m_context.locations->getPackageInstallationDir();
 
     if (0 == access(backPath.c_str(), F_OK)) {
-        WrtUtilRemove(backPath);
+        if (!WrtUtilRemove(backPath)) {
+            ThrowMsg(Exceptions::RemovingFolderFailure,
+                    "Error occurs during removing backup resource directory");
+        }
     }
     LogDebug("copy : " << pkgPath << " to " << backPath);
     if ((rename(pkgPath.c_str(), backPath.c_str())) != 0) {
old mode 100644 (file)
new mode 100755 (executable)
index c5bbc5b..f77a8b7
@@ -45,6 +45,9 @@
 #include <widget_install/widget_install_context.h>
 #include <widget_install/widget_install_errors.h>
 #include <widget_parser.h>
+#include <web_provider_plugin_info.h>
+#include <web_provider_livebox_info.h>
+#include <manifest.h>
 
 namespace { // anonymous
 const DPL::String BR = DPL::FromUTF8String("<br>");
@@ -57,6 +60,8 @@ const char *const DEFAULT_LANGUAGE = "default";
 const char *const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml";
 
 const std::string WINDGET_INSTALL_NETWORK_ACCESS = "network access";
+
+const char WRT_WIDGETS_XML_SCHEMA[] = "/usr/etc/wrt-installer/widgets.xsd";
 }
 
 namespace Jobs {
@@ -511,6 +516,50 @@ void TaskWidgetConfig::StepVerifyFeatures()
         "Widget Config step2 Finished");
 }
 
+void TaskWidgetConfig::StepVerifyLivebox()
+{
+    using namespace WrtDB;
+    ConfigParserData &data = m_installContext.widgetConfig.configInfo;
+    ConfigParserData::LiveboxList liveBoxList = data.m_livebox;
+
+    if (liveBoxList.size() <= 0) {
+        return;
+    }
+
+    FOREACH (it, liveBoxList) {
+        std::string boxType;
+
+        if ((**it).m_type.empty()) {
+            boxType = web_provider_livebox_get_default_type();
+        } else {
+            boxType = DPL::ToUTF8String((**it).m_type);
+        }
+
+        LogInfo("livebox type: " << boxType);
+
+        boxSizeType boxSizeList = (**it).m_boxInfo.m_boxSize;
+        char** boxSize = static_cast<char**>(
+            malloc(sizeof(char*)* boxSizeList.size()));
+
+        int boxSizeCnt = 0;
+        FOREACH (m, boxSizeList) {
+            boxSize[boxSizeCnt++] = strdup(DPL::ToUTF8String((*m).first).c_str());
+        }
+
+        bool chkSize = web_provider_plugin_check_supported_size(
+            boxType.c_str(), boxSize, boxSizeCnt);
+
+        for(int i = 0; i < boxSizeCnt; i++) {
+            delete[] boxSize[i];
+        }
+
+        if(!chkSize) {
+            LogError("Invalid boxSize");
+            ThrowMsg(Exceptions::WidgetConfigFileInvalid, "Invalid boxSize");
+        }
+    }
+}
+
 bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType,
                                         DPL::String featureName)
 {
@@ -676,6 +725,13 @@ bool TaskWidgetConfig::parseConfigurationFileWidget(
     Try
     {
         ParserRunner parser;
+#ifdef SCHEMA_VALIDATION_ENABLED
+        if(!parser.Validate(configFilePath, WRT_WIDGETS_XML_SCHEMA))
+        {
+            LogError("Invalid configuration file - schema validation failed");
+            return false;
+        }
+#endif
         parser.Parse(configFilePath,
                      ElementParserPtr(new RootParser<WidgetParser>(
                                           configInfo,
old mode 100644 (file)
new mode 100755 (executable)
index 6b500d3..785d7fc
@@ -81,6 +81,7 @@ class TaskWidgetConfig :
     void ProcessAppControlInfo();
     void ProcessSecurityModel();
     void StepVerifyFeatures();
+    void StepVerifyLivebox();
     void StepCheckMinVersionInfo();
 
     template <typename Ex, const char* Msg>
index eb1a25e..a76637f 100644 (file)
@@ -67,9 +67,8 @@ DECLARE_JOB_EXCEPTION(Base, CertificateChainVerificationFailed, ErrorCertificate
 DECLARE_JOB_EXCEPTION(Base, CertificateExpired, ErrorCertificateExpired)
 
 DECLARE_JOB_EXCEPTION(Base, NotAllowed, ErrorFatalError)
-DECLARE_JOB_EXCEPTION(Base, Deferred, ErrorFatalError)
 DECLARE_JOB_EXCEPTION(Base, WidgetRunningError, ErrorFatalError)
-DECLARE_JOB_EXCEPTION(Base, DRMFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, DrmDecryptFailed, ErrorFatalError)
 DECLARE_JOB_EXCEPTION(Base, DatabaseFailure, ErrorFatalError)
 DECLARE_JOB_EXCEPTION(Base, RemovingFolderFailure, ErrorFatalError)
 DECLARE_JOB_EXCEPTION(Base, RemovingFileFailure, ErrorFatalError)
similarity index 73%
rename from src/jobs/widget_install/task_unzip.cpp
rename to src/jobs/widget_install/widget_unzip.cpp
index 0ce18cf..bcf29e8 100644 (file)
  *    limitations under the License.
  */
 /*
- * @file    task_unzip.cpp
+ * @file    widget_unzip.cpp
  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
  * @version 1.0
- * @brief   Implementation file for installer task unzip
+ * @brief   Implementation file for installer widget unzip
  */
-#include <widget_install/task_unzip.h>
+#include <widget_install/widget_unzip.h>
 #include <widget_install/widget_install_errors.h>
 #include <widget_install/widget_install_context.h>
 #include <widget_install/job_widget_install.h>
@@ -64,17 +64,7 @@ PathAndFilePair SplitFileAndPath(const std::string &filePath)
 
 namespace Jobs {
 namespace WidgetInstall {
-TaskUnzip::TaskUnzip(InstallerContext &installerContext) :
-    DPL::TaskDecl<TaskUnzip>(this),
-    m_installerContext(installerContext)
-{
-    // Install steps
-    AddStep(&TaskUnzip::StepUnzipPrepare);
-    AddStep(&TaskUnzip::StepUnzipProgress);
-    AddStep(&TaskUnzip::StepUnzipFinished);
-}
-
-void TaskUnzip::ExtractFile(DPL::ZipInput::File *input,
+void WidgetUnzip::ExtractFile(DPL::ZipInput::File *input,
                             const std::string &destFileName)
 {
     Try
@@ -94,38 +84,7 @@ void TaskUnzip::ExtractFile(DPL::ZipInput::File *input,
     }
 }
 
-void TaskUnzip::StepUnzipPrepare()
-{
-    LogInfo("Prepare to unzip...");
-
-    Try
-    {
-        m_zip.reset(new DPL::ZipInput(m_installerContext.locations->
-                                          getWidgetSource()));
-        LogInfo("Widget package comment: " << m_zip->GetGlobalComment());
-
-        // Widget package must not be empty
-        if (m_zip->empty()) {
-            ThrowMsg(Exceptions::ZipEmpty,
-                     m_installerContext.locations->getWidgetSource());
-        }
-
-        // Set iterator to first file
-        m_zipIterator = m_zip->begin();
-    }
-    Catch(DPL::ZipInput::Exception::OpenFailed)
-    {
-        ReThrowMsg(Exceptions::OpenZipFailed,
-                   m_installerContext.locations->getWidgetSource());
-    }
-    Catch(DPL::ZipInput::Exception::SeekFileFailed)
-    {
-        ThrowMsg(Exceptions::ExtractFileFailed,
-                 "m_installerContext.locations->getWidgetSource()");
-    }
-}
-
-void TaskUnzip::StepUnzipProgress()
+void WidgetUnzip::unzipProgress(const std::string &destination)
 {
     // Show file info
     LogInfo("Unzipping: '" << m_zipIterator->name <<
@@ -141,8 +100,7 @@ void TaskUnzip::StepUnzipProgress()
 
     if (fileName[fileName.size() - 1] == '/') {
         // This is path
-        std::string newPath =
-            m_installerContext.locations->getTemporaryPackageDir() + "/" +
+        std::string newPath = destination + "/" +
             fileName.substr(0, fileName.size() - 1);
         LogPedantic("Path to extract: " << newPath);
 
@@ -150,9 +108,7 @@ void TaskUnzip::StepUnzipProgress()
         createTempPath(newPath);
     } else {
         // This is regular file
-        std::string fileExtractPath =
-            m_installerContext.locations->getTemporaryPackageDir() + "/" +
-            fileName;
+        std::string fileExtractPath = destination + "/" + fileName;
 
         LogPedantic("File to extract: " << fileExtractPath);
 
@@ -185,21 +141,44 @@ void TaskUnzip::StepUnzipProgress()
     if (++m_zipIterator == m_zip->end()) {
         LogInfo("Unzip progress finished successfuly");
     } else {
-        SwitchToStep(&TaskUnzip::StepUnzipProgress);
+        unzipProgress(destination);
     }
-
-    m_installerContext.job->UpdateProgress(
-        InstallerContext::INSTALL_UNZIP_FILES,
-        "Unzip widget files to temporary directory");
 }
 
-void TaskUnzip::StepUnzipFinished()
+void WidgetUnzip::unzipWgtFile(const std::string &source, const std::string &destination)
 {
-    // Unzip finished, close internal structures
-    m_zip.reset();
+    LogInfo("Prepare to unzip...");
+
+    Try
+    {
+        m_zip.reset(new DPL::ZipInput(source));
+        LogInfo("Widget package comment: " << m_zip->GetGlobalComment());
+
+        // Widget package must not be empty
+        if (m_zip->empty()) {
+            ThrowMsg(Exceptions::ZipEmpty, source);
+        }
+
+        // Set iterator to first file
+        m_zipIterator = m_zip->begin();
+
+        unzipProgress(destination);
 
-    // Done
-    LogInfo("Unzip finished");
+        // Unzip finished, close internal structures
+        m_zip.reset();
+
+        // Done
+        LogInfo("Unzip finished");
+    }
+    Catch(DPL::ZipInput::Exception::OpenFailed)
+    {
+        ReThrowMsg(Exceptions::OpenZipFailed, source);
+    }
+    Catch(DPL::ZipInput::Exception::SeekFileFailed)
+    {
+        ThrowMsg(Exceptions::ExtractFileFailed, source);
+    }
 }
+
 } //namespace WidgetInstall
 } //namespace Jobs
similarity index 57%
rename from src/jobs/widget_install/task_unzip.h
rename to src/jobs/widget_install/widget_unzip.h
index 69ce606..4db5af7 100644 (file)
  *    limitations under the License.
  */
 /*
- * @file    task_unzip.cpp
+ * @file    widget_unzip.cpp
  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
  * @version 1.0
  * @brief   Implementation file for installer task unzip
  */
-#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_UNZIP_H
-#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_UNZIP_H
+#ifndef WIDGET_UNZIP_H
+#define WIDGET_UNZIP_H
 
 #include <string>
-#include <memory>
 
 #include <dpl/zip_input.h>
-#include <dpl/task.h>
-#include <dpl/encryption/resource_encryption.h>
-
-class InstallerContext;
 
 namespace Jobs {
 namespace WidgetInstall {
-class TaskUnzip :
-    public DPL::TaskDecl<TaskUnzip>
+class WidgetUnzip 
 {
-  private:
-    // Installation context
-    InstallerContext &m_installerContext;
+  public:
+      void unzipWgtFile(const std::string &source, const std::string &destination);
 
+  private:
     // Unzip state
     std::unique_ptr<DPL::ZipInput> m_zip;
     DPL::ZipInput::const_iterator m_zipIterator;
 
-    WRTEncryptor::ResourceEncryptor *m_resEnc;
-
-    void ExtractFile(DPL::ZipInput::File *input,
-                     const std::string &destFileName);
+    void unzipProgress(const std::string &destination);
+    void ExtractFile(DPL::ZipInput::File *input, const std::string
+            &destFileName);
 
-    void EncryptionFile(const std::string &fileName);
-
-    // Steps
-    void StepUnzipPrepare();
-    void StepUnzipProgress();
-    void StepUnzipFinished();
-
-  public:
-    TaskUnzip(InstallerContext &installerContext);
 };
+
 } //namespace WidgetInstall
 } //namespace Jobs
 
-#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_UNZIP_H
+#endif // WIDGET_UNZIP_H
index bb6a73b..abe6fd2 100644 (file)
@@ -43,10 +43,6 @@ TaskCheck::~TaskCheck()
 
 void TaskCheck::StepUninstallPreCheck()
 {
-    LogInfo("Uninstall check for appid: " << m_context.tzAppid);
-    //check if deferred
-    //TODO if widget to be updated, then remove it from Deferred list?
-
     bool isRunning = false;
     int ret = app_manager_is_running(m_context.tzAppid.c_str(), &isRunning);
     if (APP_MANAGER_ERROR_NONE != ret) {
index 709b4a5..7404a74 100755 (executable)
@@ -27,7 +27,6 @@
 #include <widget_uninstall/widget_uninstall_errors.h>
 #include <dpl/wrt-dao-rw/widget_dao.h>
 #include <dpl/wrt-dao-ro/widget_config.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/assert.h>
 #include <dpl/exception.h>
 #include <dpl/utils/wrt_utility.h>
 #include <errno.h>
 #include <string.h>
 #include <widget_install_to_external.h>
-#include <vconf.h>
 
 namespace Jobs {
 namespace WidgetUninstall {
 using namespace WrtDB;
 
-namespace {
-const char * const VCONF_KEY_PREFIX = "file/private/";
-}
-
 TaskRemoveFiles::TaskRemoveFiles(UninstallerContext& context) :
     DPL::TaskDecl<TaskRemoveFiles>(this),
     m_context(context)
@@ -53,7 +47,6 @@ TaskRemoveFiles::TaskRemoveFiles(UninstallerContext& context) :
     AddStep(&TaskRemoveFiles::StepRemoveInstallationDirectory);
     AddStep(&TaskRemoveFiles::StepRemoveManifest);
     AddStep(&TaskRemoveFiles::StepRemoveExternalLocations);
-    AddStep(&TaskRemoveFiles::StepRemoveVconf);
     AddStep(&TaskRemoveFiles::StepRemoveFinished);
 }
 
@@ -122,12 +115,18 @@ void TaskRemoveFiles::StepRemoveManifest()
         destFile << "/opt/share/packages" << "/"; //TODO constant with path
     }
     destFile << manifest_name.str();
-    int ret1 = pkgmgr_parser_parse_manifest_for_uninstallation(
-            destFile.str().c_str(), NULL);
-    int ret2 = unlink(destFile.str().c_str());
-    if (ret1 != 0) {
-        LogWarning("Manifest file failed to parse for uninstallation");
+    std::string pre_manifest = "/usr/share/packages/" + manifest_name.str();
+
+    if (!(access(destFile.str().c_str(), F_OK) == 0 &&
+            access(pre_manifest.c_str(), F_OK) == 0)) {
+        int ret1 = pkgmgr_parser_parse_manifest_for_uninstallation(
+                destFile.str().c_str(), NULL);
+        if (ret1 != 0) {
+            LogWarning("Manifest file failed to parse for uninstallation");
+        }
     }
+
+    int ret2 = unlink(destFile.str().c_str());
     if (ret2 != 0) {
         LogWarning("No manifest file found: " << destFile.str());
     } else {
@@ -165,19 +164,5 @@ void TaskRemoveFiles::StepRemoveExternalLocations()
         dao.unregisterAllExternalLocations();
     }
 }
-
-void TaskRemoveFiles::StepRemoveVconf()
-{
-    if (!m_context.removeAbnormal) {
-        std::string key =
-            WrtDB::VconfConfig::GetVconfKeyRootPath(DPL::FromUTF8String(m_context.
-                        tzAppid));
-        if (vconf_unset_recursive(key.c_str())) {
-            LogError("Fail to unset vconf file");
-        } else {
-            LogDebug("vconf file is removed");
-        }
-    }
-}
 } //namespace WidgetUninstall
 } //namespace Jobs
index 2ea7375..6959242 100644 (file)
@@ -51,7 +51,6 @@ class TaskRemoveFiles :
     void StepRemoveDesktop();
     void StepRemoveManifest();
     void StepRemoveExternalLocations();
-    void StepRemoveVconf();
 
   public:
     explicit TaskRemoveFiles(UninstallerContext& context);
index 5e65517..552dfae 100644 (file)
@@ -68,14 +68,6 @@ void InstallerController::OnEventReceived(
 }
 
 void InstallerController::OnEventReceived(
-    const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent &
-    event)
-{
-    (void)event;
-    m_installerLogic.InstallDeferredWidgetPackages();
-}
-
-void InstallerController::OnEventReceived(
     const InstallerControllerEvents::InitializeEvent & /*event*/)
 {
     m_installerLogic.Initialize();
index ca4cc6b..3fa7964 100644 (file)
@@ -63,8 +63,6 @@ DECLARE_GENERIC_EVENT_2(UninstallWidgetEvent,
  */
 DECLARE_GENERIC_EVENT_1(NextStepEvent, Jobs::Job *)
 
-DECLARE_GENERIC_EVENT_0(InstallDeferredWidgetPackagesEvent)
-
 DECLARE_GENERIC_EVENT_0(InitializeEvent)
 DECLARE_GENERIC_EVENT_0(TerminateEvent)
 } // namespace InstallerEvents
@@ -88,7 +86,6 @@ typedef DPL::TypeListDecl<
     InstallerControllerEvents::InstallPluginEvent,
     InstallerControllerEvents::UninstallWidgetEvent,
     InstallerControllerEvents::NextStepEvent,
-    InstallerControllerEvents::InstallDeferredWidgetPackagesEvent,
     InstallerControllerEvents::InitializeEvent,
     InstallerControllerEvents::TerminateEvent>::Type
 InstallerControllerEventsSet;
@@ -121,10 +118,6 @@ class InstallerController : public DPL::Event::Controller<
         const InstallerControllerEvents::NextStepEvent &event);
 
     virtual void OnEventReceived(
-        const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent
-        &event);
-
-    virtual void OnEventReceived(
         const InstallerControllerEvents::InitializeEvent &event);
     virtual void OnEventReceived(
         const InstallerControllerEvents::TerminateEvent &event);
index aa9061c..10cda89 100644 (file)
@@ -172,31 +172,6 @@ bool InstallerLogic::NextStep(Jobs::Job *job)
     }
 }
 
-//TODO this should be moved somewhere...when it should take place? after widget
-//is closing?
-void InstallerLogic::InstallDeferredWidgetPackages()
-{
-    LogWarning("Not implemented");
-    //    LogInfo("Installing deferred widget packages...");
-    //
-    //    WidgetPackageList packages =
-    // GlobalDAO::GetDefferedWidgetPackageInstallationList();
-    //
-    //    LogInfo(packages.size() << " widget package(s) to install");
-    //
-    //    // Make a copy of widget packages to install, because some
-    //    // widget packages may still fail because they are running
-    //    m_packagesToInstall = packages;
-    //
-    //    // Start processing
-    //    InstallSingleDeferredPackage();
-}
-
-void InstallerLogic::InstallSingleDeferredPackage()
-{
-    LogWarning("Not implemented");
-}
-
 void InstallerLogic::InstallWaitingPlugins()
 {
     PluginHandleSetPtr waitingPlugins;
index 5072e39..496e967 100644 (file)
@@ -30,9 +30,6 @@ class InstallerLogic
     typedef std::map<Jobs::JobHandle, Jobs::Job*> JobsContainer;
     JobsContainer m_jobs;
 
-    void InstallDeferredWidgetPackages();
-    void InstallSingleDeferredPackage();
-
     void ResetProgressPlugins();
     void InstallWaitingPlugins();
     bool resolvePluginDependencies(PluginHandle handle);
index a2905aa..4c93057 100644 (file)
@@ -173,6 +173,13 @@ std::string WidgetLocation::getPrivateStorageDir() const
            WrtDB::GlobalConfig::GetWidgetPrivateStoragePath();
 }
 
+std::string WidgetLocation::getPrivateTempStorageDir() const
+{
+    return getUserDataRootDir() + "/" +
+           WrtDB::GlobalConfig::GetWidgetPrivateTempStoragePath();
+}
+
+
 std::string WidgetLocation::getTemporaryPackageDir() const
 {
     return m_temp->getTempPath();
index ad73d80..2b44d4d 100644 (file)
@@ -124,6 +124,7 @@ class WidgetLocation
     std::string getBackupPrivateDir() const;  // /opt/apps/[pkg].backup/data
     std::string getUserDataRootDir() const; // /opt/usr/apps/[package]
     std::string getPrivateStorageDir() const; // /opt/usr/apps/[package]/data
+    std::string getPrivateTempStorageDir() const; // /opt/usr/apps/[package]/tmp
     std::string getSharedRootDir() const; // /opt/usr/apps/[package]/shared
     std::string getSharedResourceDir() const; // /opt/usr/apps/[package]/shared/res
     std::string getSharedDataDir() const; // /opt/usr/apps/[package]/shared/data
index 3786026..48f98d4 100644 (file)
@@ -327,7 +327,15 @@ char* getIconInfo(const std::string widgetPath,
 
         std::unique_ptr<DPL::ZipInput::File> iconFile;
 
-        iconFile.reset(zipFile->OpenFile(icon_name));
+        Try {
+            iconFile.reset(zipFile->OpenFile(icon_name));
+        }
+        Catch(DPL::ZipInput::Exception::OpenFileFailed)
+        {
+            LogDebug("This web app is hybrid web app");
+            std::string hybrid_icon = "res/wgt/" + icon_name;
+            iconFile.reset(zipFile->OpenFile(hybrid_icon));
+        }
 
         DPL::BinaryQueue buffer;
         DPL::AbstractWaitableInputAdapter inputAdapter(iconFile.get());
index 7adda4d..3b94562 100644 (file)
@@ -40,6 +40,8 @@ SET(WRT_INSTALLER_SOURCES
 PKG_CHECK_MODULES(WRT_INSTALLER_DEPS
     pkgmgr-installer
     libpcrecpp
+    pkgmgr-info
+    pkgmgr
     security-install
     REQUIRED)
 
index 77457f5..4db1ad4 100644 (file)
@@ -46,6 +46,7 @@
 #include <parser_runner.h>
 #include <widget_parser.h>
 #include <root_parser.h>
+#include <package-manager.h>
 
 #include <Elementary.h>
 
@@ -77,6 +78,19 @@ struct PluginInstallerData
     void* wrtInstaller;
     std::string pluginPath;
 };
+
+bool checkInitializeToPreload(std::string pkgid)
+{
+    std::string RoManifest = "/usr/share/packages/" + pkgid + ".xml";
+    std::string RwManifest = "/opt/share/packages/" + pkgid + ".xml";
+
+    if (access(RwManifest.c_str(), F_OK) == 0 &&
+            access(RoManifest.c_str(), F_OK) == 0) {
+        LogDebug("This web app need to down update");
+        return true;
+    }
+    return false;
+}
 } // namespace anonymous
 
 WrtInstaller::WrtInstaller(int argc, char **argv) :
@@ -223,6 +237,17 @@ void WrtInstaller::OnCreate()
                     return showHelpAndQuit();
                 }
                 m_packagePath = it->second;
+
+                it = m_CSCconfigurationMap.find(
+                        CSCConfiguration::KEY_REMOVABLE);
+                if (it == m_CSCconfigurationMap.end()) {
+                    return showHelpAndQuit();
+                }
+
+                m_installMode.removable =
+                    (it->second.compare(CSCConfiguration::VALUE_FALSE) == 0)
+                    ? false : true;
+
                 AddStep(&WrtInstaller::installStep);
                 LogDebug("path      = " << m_packagePath);
             } else if (it->second == CSCConfiguration::VALUE_UNINSTALL) {
@@ -504,10 +529,20 @@ void WrtInstaller::uninstallPkgNameStep()
 {
     LogDebug("Uninstalling widget ...");
     LogDebug("Package name : " << m_name);
-    wrt_uninstall_widget(m_name.c_str(), this, &staticWrtStatusCallback,
-                         (m_installByPkgmgr)
-                         ? &staticWrtUninstallProgressCallback : NULL,
-                         pkgmgrSignalInterface);
+
+    if (!checkInitializeToPreload(m_name)) {
+        wrt_uninstall_widget(m_name.c_str(), this,
+                &staticWrtStatusCallback,
+                (m_installByPkgmgr)
+                ? &staticWrtUninstallProgressCallback : NULL,
+                pkgmgrSignalInterface);
+    } else {
+        wrt_uninstall_widget(m_name.c_str(), this,
+                &staticWrtInitializeToPreloadCallback,
+                (m_installByPkgmgr)
+                ? &staticWrtUninstallProgressCallback : NULL,
+                pkgmgrSignalInterface);
+    }
 }
 
 void WrtInstaller::unistallWgtFileStep()
@@ -624,6 +659,74 @@ void WrtInstaller::staticWrtInitCallback(WrtErrStatus status,
     }
 }
 
+void WrtInstaller::staticWrtInitializeToPreloadCallback(std::string tizenId, WrtErrStatus
+        status, void* userdata)
+{
+    WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
+    Assert(This);
+
+    std::string printMsg = "uninstallation";
+
+    if (WRT_SUCCESS != status) {
+        // Failure
+        LogError("Step failed");
+        This->m_returnStatus = 1;
+
+        This->showErrorMsg(status, tizenId, printMsg);
+
+        This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
+            ::PostEvent(WRTInstallerNS::QuitEvent());
+    } else {
+        InstallMode mode;
+        mode.extension = InstallMode::ExtensionType::DIR;
+        mode.installTime = InstallMode::InstallTime::PRELOAD;
+        mode.rootPath = InstallMode::RootPath::RO;
+        std::string packagePath =
+            std::string(WrtDB::GlobalConfig::GetUserPreloadedWidgetPath()) + "/" +
+            This->m_name;
+
+        wrt_install_widget(packagePath.c_str(),
+                This, &staticWrtInitPreloadStatusCallback,
+                NULL,
+                mode,
+                This->pkgmgrSignalInterface);
+    }
+}
+
+void WrtInstaller::staticWrtInitPreloadStatusCallback(std::string tizenId,
+                                           WrtErrStatus status,
+                                           void* userdata)
+{
+    WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
+    Assert(This);
+
+    DPL::String resultMsg;
+    std::string printMsg = "initialization";
+
+    if (WRT_SUCCESS != status) {
+        // Failure
+        LogError("Step failed");
+        This->m_returnStatus = 1;
+
+        This->showErrorMsg(status, tizenId, printMsg);
+
+        This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
+            ::PostEvent(WRTInstallerNS::QuitEvent());
+    } else {
+        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);
+
+        This->DPL::Event::ControllerEventHandler<WRTInstallerNS::
+                                                     NextStepEvent>
+            ::PostEvent(WRTInstallerNS::NextStepEvent());
+    }
+}
+
 void WrtInstaller::staticWrtStatusCallback(std::string tizenId,
                                            WrtErrStatus status,
                                            void* userdata)
@@ -653,203 +756,7 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId,
         This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
             ::PostEvent(WRTInstallerNS::QuitEvent());
 
-        switch (status) {
-            case WRT_INSTALLER_ERROR_PACKAGE_NOT_FOUND:
-                This->m_returnStatus = 1; //this status is specific
-                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_PACKAGE_INVALID:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - invalid widget package\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_PACKAGE_LOWER_VERSION:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - given"
-                        " version is lower than existing version\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_MANIFEST_NOT_FOUND:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - manifest"
-                        " file doesn't find in package.\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_MANIFEST_INVALID:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "invalid manifestx.xml\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_CONFIG_NOT_FOUND:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "config.xml does not exist\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_CONFIG_INVALID:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "invalid config.xml\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_SIGNATURE_NOT_FOUND:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "signature doesn't exist in package.\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_SIGNATURE_INVALID:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "invalid signature.\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "signature verification failed.\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "root certificate could not find.\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_CERTIFICATION_INVAID:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "invalid certification.\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "certificate chain verification failed.\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_CERTIFICATE_EXPIRED:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "certificate expired.\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_INVALID_PRIVILEGE:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "invalid privilege\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_PRIVILEGE_LEVEL_VIOLATION:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "privilege level violation\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_MENU_ICON_NOT_FOUND:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "menu icon could not find\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_FATAL_ERROR:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "fatal error\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_OUT_OF_STORAGE:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "out of storage\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_OUT_OF_MEMORY:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "out of memory\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_ARGUMENT_INVALID:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "invalid argument\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_PACKAGE_ALREADY_INSTALLED:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "package already installed\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_ACE_CHECK_FAILED:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "ace check failure\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_MANIFEST_CREATE_FAILED:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "to create manifest failed\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_ENCRYPTION_FAILED:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "encryption of resource failed\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_INSTALL_OSP_SERVCIE:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "installation of osp service failed\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            case WRT_INSTALLER_ERROR_UNINSTALLATION_FAILED:
-                This->m_returnStatus = 1; //this status is specific
-                fprintf(stderr, "## wrt-installer : %s %s has failed - "
-                        "widget uninstallation failed\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-
-            case WRT_INSTALLER_ERROR_UNKNOWN:
-                fprintf(stderr,"## wrt-installer : %s %s has failed - unknown error\n",
-                        tizenId.c_str(), printMsg.c_str());
-                break;
-
-            default:
-                break;
-        }
+        This->showErrorMsg(status, tizenId, printMsg);
     } else {
         fprintf(stderr,
                 "## wrt-installer : %s %s was successful.\n",
@@ -875,6 +782,182 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId,
     }
 }
 
+void WrtInstaller::showErrorMsg(WrtErrStatus status, std::string tizenId,
+        std::string printMsg)
+{
+    switch (status) {
+        case WRT_INSTALLER_ERROR_PACKAGE_NOT_FOUND:
+            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_PACKAGE_INVALID:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - invalid widget package\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_PACKAGE_LOWER_VERSION:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - given"
+                    " version is lower than existing version\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_MANIFEST_NOT_FOUND:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - manifest"
+                    " file doesn't find in package.\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_MANIFEST_INVALID:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "invalid manifestx.xml\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_CONFIG_NOT_FOUND:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "config.xml does not exist\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_CONFIG_INVALID:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "invalid config.xml\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_SIGNATURE_NOT_FOUND:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "signature doesn't exist in package.\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_SIGNATURE_INVALID:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "invalid signature.\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "signature verification failed.\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "root certificate could not find.\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_CERTIFICATION_INVAID:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "invalid certification.\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "certificate chain verification failed.\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_CERTIFICATE_EXPIRED:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "certificate expired.\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_INVALID_PRIVILEGE:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "invalid privilege\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_PRIVILEGE_LEVEL_VIOLATION:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "privilege level violation\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_MENU_ICON_NOT_FOUND:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "menu icon could not find\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_FATAL_ERROR:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "fatal error\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_OUT_OF_STORAGE:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "out of storage\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_OUT_OF_MEMORY:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "out of memory\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_ARGUMENT_INVALID:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "invalid argument\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_PACKAGE_ALREADY_INSTALLED:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "package already installed\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_ACE_CHECK_FAILED:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "ace check failure\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_MANIFEST_CREATE_FAILED:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "to create manifest failed\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_ENCRYPTION_FAILED:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "encryption of resource failed\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_INSTALL_OSP_SERVCIE:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "installation of osp service failed\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        case WRT_INSTALLER_ERROR_UNINSTALLATION_FAILED:
+            fprintf(stderr, "## wrt-installer : %s %s has failed - "
+                    "widget uninstallation failed\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+
+        case WRT_INSTALLER_ERROR_UNKNOWN:
+            fprintf(stderr,"## wrt-installer : %s %s has failed - unknown error\n",
+                    tizenId.c_str(), printMsg.c_str());
+            break;
+
+        default:
+            break;
+    }
+
+}
+
 void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
                                                        void* userdata)
 {
index 59bcc90..4405a07 100644 (file)
@@ -44,8 +44,11 @@ typedef std::map<std::string, std::string> dataMap;
 typedef std::pair<std::string, std::string> dataPair;
 const char* const KEY_OP = "op";
 const char* const KEY_PATH = "path";
+const char* const KEY_REMOVABLE = "removable";
 const char* const VALUE_INSTALL = "install";
 const char* const VALUE_UNINSTALL = "uninstall";
+const char* const VALUE_TRUE = "true";
+const char* const VALUE_FALSE = "false";
 }
 
 enum ReturnValue
@@ -117,9 +120,19 @@ class WrtInstaller :
     static void failResultCallback(void *data, Evas_Object *obj,
                                    void *event_info);
 
+    static void staticWrtInitializeToPreloadCallback(std::string tizenId,
+                                        WrtErrStatus status,
+                                        void* userdata);
+
+    static void staticWrtInitPreloadStatusCallback(std::string tizenId,
+                                        WrtErrStatus status,
+                                        void* userdata);
+
     void installNewPlugins();
     bool popupsEnabled() const;
     CSCConfiguration::dataMap parseCSCConfiguration(std::string str);
+    void showErrorMsg(WrtErrStatus status, std::string tizenId, std::string
+            printMsg);
 
     // Private data
     std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrSignalInterface;
index 83b5172..ff19de7 100644 (file)
@@ -32,7 +32,6 @@
 #include <dpl/sstream.h>
 #include <dpl/errno_string.h>
 #include <libxml/parser.h>
-#include <vconf.h>
 
 #include <wrt_installer_api.h>
 #include <installer_callbacks_translate.h>
@@ -122,12 +121,6 @@ void wrt_installer_init(void *userdata,
             InstallerControllerEvents::
                 InitializeEvent());
 
-        // Install deferred widget packages
-        CONTROLLER_POST_EVENT(
-            Logic::InstallerController,
-            InstallerControllerEvents::
-                InstallDeferredWidgetPackagesEvent());
-
         if (callback) {
             LogInfo("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK");
             callback(WRT_SUCCESS, userdata);
index 0977e5b..e70d2af 100644 (file)
Binary files a/tests/general/widgets/manifest.wgt and b/tests/general/widgets/manifest.wgt differ
index 6633b1a..064dc46 100644 (file)
Binary files a/tests/general/widgets/nonroot.wgt and b/tests/general/widgets/nonroot.wgt differ