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 ##################################
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
############################# subdirectories ##################################
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(etc)
+ADD_SUBDIRECTORY(configuration)
IF(WITH_TESTS)
ADD_SUBDIRECTORY(tests)
--- /dev/null
+FILE(GLOB XSD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.xsd")
+INSTALL(FILES ${XSD_FILES} DESTINATION /usr/etc/wrt-installer/)
--- /dev/null
+<?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>
--- /dev/null
+<?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>
+++ /dev/null
-<?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
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
<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>
--- /dev/null
+<?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>
<?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>
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/)
-#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)
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
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}
#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
%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/*
[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
${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
${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
pkgmgr-parser
pkgmgr-info
web-provider
- osp-appfw
libsmack
REQUIRED
)
shortcut
capi-appfw-app-manager
app2sd
- vconf
libprivilege-control
REQUIRED
)
)
#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)
location(lo),
rootPath(root),
extension(extensionType),
- installTime(time)
+ installTime(time),
+ removable(true)
{};
Command command;
RootPath rootPath;
ExtensionType extension;
InstallTime installTime;
+ bool removable;
};
#endif // WRT_INSTALL_MODE_H
#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)
{
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)
{
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,
#include <string>
#include <cstdio>
#include <cerrno>
+#include <climits>
+#include <cmath>
+#include <cstdlib>
+#include <locale>
using namespace WrtDB;
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(),
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) :
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*/)
{}
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.
DPL::OptionalString m_type;
DPL::OptionalString m_encoding;
ConfigParserData& m_data;
+ DPL::String m_namespace;
};
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)
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*/)
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*/)
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*/)
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*/)
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*/)
} else if (name == L"mime") {
return DPL::MakeDelegate(this, &AppControlParser::OnMimeElement);
} else {
- return &IgnoringParser::Create;
+ return &IgnoringParser::Create; //ignore unknown according to w3c
}
}
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);
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");
}
}
{
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);
m_properNamespace(false)
{}
+ static const char* const REGEXP_ID;
+
private:
void VerifyIdAndPackage()
{
}
static const char* const REGEXP_PACKAGE;
- static const char* const REGEXP_ID;
static const char* const REGEXP_VERSION;
ConfigParserData& m_data;
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 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 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*/)
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 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 ==
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) :
{}
private:
+ DPL::String m_lang;
DPL::String m_label;
bool m_properNamespace;
ConfigParserData::LiveboxInfo& m_data;
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 Verify()
{
+ if (m_icon.empty()) {
+ ThrowMsg(Exception::ParseError,
+ "src attribute of box-icon element is mandatory - ignoring");
+ }
m_data.m_icon = m_icon;
}
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 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;
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 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;
{}
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;
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;
}
}
private:
- DPL::String m_src;
bool m_properNamespace;
ConfigParserData::LiveboxInfo& m_data;
ConfigParserData::LiveboxInfo::BoxContentInfo m_box;
} else if (name == L"box-content") {
return DPL::MakeDelegate(this, &AppWidgetParser::OnBoxContentElement);
} else {
- return &IgnoringParser::Create;
+ return &IgnoringParser::Create; //ignore unknown according to w3c
}
}
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;
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));
}
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;
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:
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)
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) :
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) :
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)
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)
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)
} else if (name == L"capability") {
return DPL::MakeDelegate(this, &AccountProviderParser::OnCapabilityElement);
} else {
- return &IgnoringParser::Create;
+ return &IgnoringParser::Create; //ignore unknown according to w3c
}
}
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;
}
}
if (name == L"account-provider") {
return DPL::MakeDelegate(this, &AccountParser::OnProviderElement);
} else {
- return &IgnoringParser::Create;
+ return &IgnoringParser::Create; //ignore unknown according to w3c
}
}
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)
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
}
}
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 {
#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;
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");
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,
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");
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)
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 ==
// 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;
{
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);
widgetPath,
tempDir,
m_installerContext.widgetConfig.packagingType,
- m_isDRM,
m_installerContext.mode.command == InstallMode::Command::REINSTALL);
LogDebug("widget packaging type : " <<
m_installerContext.widgetConfig.packagingType.pkgType);
// 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;
const std::string &widgetSource,
const std::string &tempPath,
WrtDB::PackagingType pkgType,
- bool isDRM,
bool isReinstall)
{
// Parse config
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;
}
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;
}
}
-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)
{
enum class ConfigureResult
{
Ok,
- Deferred,
Updated,
Failed,
Failed_InvalidConfig,
Failed_WidgetRunning,
Failed_DrmError,
Failed_NotSupportRDSUpdate,
+ Failed_OpenZipError,
+ Failed_UnzipError,
};
class JobWidgetInstall :
std::string m_exceptionMessage;
WidgetUpdateInfo m_widgetUpdateInfo;
bool m_needEncryption;
- bool m_isDRM;
ConfigureResult ConfigureInstallation(const std::string &widgetSource,
const WrtDB::ConfigParserData
const std::string &widgetSource,
const std::string &tempPath,
WrtDB::PackagingType pkgType,
- bool isDRM,
bool isReinstall);
static WidgetUpdateInfo detectWidgetUpdate(
const WrtDB::ConfigParserData &configInfo,
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);
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);
* @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
{
{
this->updatePeriod = x;
}
- void setLabel(const NcnameType &x)
+ void setLabel(const boxLabelType &x)
{
this->label = x;
}
NcnameType autoLaunch;
NcnameType updatePeriod;
NcnameType timeout;
- NcnameType label;
+ boxLabelType label;
NcnameType icon;
+ NcnameType lang;
BoxInfoType box;
};
"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,
}
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.");
#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>
#include <ace_registration.h>
#include <errno.h>
#include <string.h>
-#include <vconf.h>
#include <map>
using namespace WrtDB;
AddStep(&TaskDatabase::StepAceDBInsert);
AddStep(&TaskDatabase::StepSecurityOriginDBInsert);
AddStep(&TaskDatabase::StepRemoveExternalFiles);
- AddStep(&TaskDatabase::StepCreateVconf);
AddStep(&TaskDatabase::StepLiveboxDBInsert);
AddAbortStep(&TaskDatabase::StepAbortDBInsert);
}
}
-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)");
void StepAceDBInsert();
void StepSecurityOriginDBInsert();
void StepRemoveExternalFiles();
- void StepCreateVconf();
void StepLiveboxDBInsert();
void StepAbortDBInsert();
#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()
{
} 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);
}
}
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;
namespace {
const mode_t PRIVATE_STORAGE_MODE = 0700;
-const mode_t SHARE_MODE = 0705;
+const mode_t SHARED_STORAGE_MODE = 0755;
}
using namespace WrtDB;
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
"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(),
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");
}
"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()
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) {
}
} 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
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()
{
AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
- AddStep(&TaskManifestFile::stepParseUpgradedManifest);
- AddStep(&TaskManifestFile::stepUpdateFinalize);
+ AddStep(&TaskManifestFile::stepParseManifest);
AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
} else {
AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
AddStep(&TaskManifestFile::stepParseManifest);
- AddStep(&TaskManifestFile::stepFinalize);
AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
}
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
LogPedantic("Failed to make a symbolic name for a file "
<< "[" << DPL::GetErrnoString(error) << "]");
}
- ThrowMsg(Exceptions::FileOperationFailed,
- "Symbolic link creating is not done.");
}
}
#else
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(
}
}
-void TaskManifestFile::stepUpdateFinalize()
-{
- commitManifest();
- LogDebug("Finished Update Desktopfile");
-}
-
DPL::String TaskManifestFile::getIconTargetFilename(
const DPL::String& languageTag) const
{
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)
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");
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)
{
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 {
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 =
//TODO stepAbort
//steps
void stepCreateExecFile();
- void stepFinalize();
void stepCopyIconFiles();
void stepCopyLiveboxFiles();
void stepGenerateManifest();
//For widget update
void stepBackupIconFiles();
- void stepUpdateFinalize();
void stepAbortIconFiles();
xmlTextWriterPtr writer;
DPL::String manifest_name;
DPL::String manifest_file;
+ std::string commit_manifest;
//private methods
/* /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 */
"/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
}
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);
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,
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
}
*/
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
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) {
#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>");
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 {
"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)
{
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,
void ProcessAppControlInfo();
void ProcessSecurityModel();
void StepVerifyFeatures();
+ void StepVerifyLivebox();
void StepCheckMinVersionInfo();
template <typename Ex, const char* Msg>
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)
* 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>
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
}
}
-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 <<
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);
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);
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
* 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
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) {
#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)
AddStep(&TaskRemoveFiles::StepRemoveInstallationDirectory);
AddStep(&TaskRemoveFiles::StepRemoveManifest);
AddStep(&TaskRemoveFiles::StepRemoveExternalLocations);
- AddStep(&TaskRemoveFiles::StepRemoveVconf);
AddStep(&TaskRemoveFiles::StepRemoveFinished);
}
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 {
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
void StepRemoveDesktop();
void StepRemoveManifest();
void StepRemoveExternalLocations();
- void StepRemoveVconf();
public:
explicit TaskRemoveFiles(UninstallerContext& context);
}
void InstallerController::OnEventReceived(
- const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent &
- event)
-{
- (void)event;
- m_installerLogic.InstallDeferredWidgetPackages();
-}
-
-void InstallerController::OnEventReceived(
const InstallerControllerEvents::InitializeEvent & /*event*/)
{
m_installerLogic.Initialize();
*/
DECLARE_GENERIC_EVENT_1(NextStepEvent, Jobs::Job *)
-DECLARE_GENERIC_EVENT_0(InstallDeferredWidgetPackagesEvent)
-
DECLARE_GENERIC_EVENT_0(InitializeEvent)
DECLARE_GENERIC_EVENT_0(TerminateEvent)
} // namespace InstallerEvents
InstallerControllerEvents::InstallPluginEvent,
InstallerControllerEvents::UninstallWidgetEvent,
InstallerControllerEvents::NextStepEvent,
- InstallerControllerEvents::InstallDeferredWidgetPackagesEvent,
InstallerControllerEvents::InitializeEvent,
InstallerControllerEvents::TerminateEvent>::Type
InstallerControllerEventsSet;
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);
}
}
-//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;
typedef std::map<Jobs::JobHandle, Jobs::Job*> JobsContainer;
JobsContainer m_jobs;
- void InstallDeferredWidgetPackages();
- void InstallSingleDeferredPackage();
-
void ResetProgressPlugins();
void InstallWaitingPlugins();
bool resolvePluginDependencies(PluginHandle handle);
WrtDB::GlobalConfig::GetWidgetPrivateStoragePath();
}
+std::string WidgetLocation::getPrivateTempStorageDir() const
+{
+ return getUserDataRootDir() + "/" +
+ WrtDB::GlobalConfig::GetWidgetPrivateTempStoragePath();
+}
+
+
std::string WidgetLocation::getTemporaryPackageDir() const
{
return m_temp->getTempPath();
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
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());
PKG_CHECK_MODULES(WRT_INSTALLER_DEPS
pkgmgr-installer
libpcrecpp
+ pkgmgr-info
+ pkgmgr
security-install
REQUIRED)
#include <parser_runner.h>
#include <widget_parser.h>
#include <root_parser.h>
+#include <package-manager.h>
#include <Elementary.h>
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) :
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) {
{
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()
}
}
+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)
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",
}
}
+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)
{
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
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;
#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>
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);