############################# Check minimum CMake version #####################
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-SET(CMAKE_EDIT_COMMAND vim)
PROJECT("wrt-installer")
############################# cmake packages ##################################
SET(CMAKE_C_FLAGS_RELEASE "-O2 -g")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++0x -g")
+OPTION(DPL_LOG "DPL logs status" ON)
+IF(DPL_LOG)
+ MESSAGE(STATUS "Logging enabled for DPL")
+ ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
+ELSE(DPL_LOG)
+ MESSAGE(STATUS "Logging disabled for DPL")
+ENDIF(DPL_LOG)
+
# 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
# table. This option makes a difference on the m68k, PowerPC and SPARC.
# (BJ: our ARM too?)
ADD_DEFINITIONS("-fPIC")
-
ADD_DEFINITIONS("-DSEPARATED_SINGLETON_IMPLEMENTATION")
# Set the default ELF image symbol visibility to hidden - all symbols will be
#ADD_DEFINITIONS("-fvisibility=hidden")
# Set compiler warning flags
-#ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
-ADD_DEFINITIONS("-Wall") # Generate all warnings
-ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
-ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM)
-ADD_DEFINITIONS("-Wno-deprecated") # No warnings about deprecated features
-ADD_DEFINITIONS("-std=c++0x") # No warnings about deprecated features
-
-# Set Logs
-OPTION(DPL_LOG "DPL logs status" ON)
-IF(DPL_LOG)
- MESSAGE(STATUS "Logging enabled for DPL")
- ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
-ELSE(DPL_LOG)
- MESSAGE(STATUS "Logging disabled for DPL")
-ENDIF(DPL_LOG)
+#ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
+ADD_DEFINITIONS("-Wall") # Generate all warnings
+ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
+ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM)
+ADD_DEFINITIONS("-Wno-deprecated") # No warnings about deprecated features
+ADD_DEFINITIONS("-std=c++0x") # No warnings about deprecated features
+#ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")
############################# Targets names ###################################
############################# subdirectories ##################################
ADD_SUBDIRECTORY(src)
-ADD_SUBDIRECTORY(tests)
\ No newline at end of file
+ADD_SUBDIRECTORY(tests)
--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+wrt-installer (0.0.19) unstable; urgency=low
+
+ * Fixed N_SE-871 #2
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.19
+
+ -- Jihoon Chung <jihoon.chung@samsung.com> Mon, 23 Apr 2012 19:41:07 +0900
+
+wrt-installer (0.0.18) unstable; urgency=low
+
+ * Fixed N_SE-871
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.18
+
+ -- Jihoon Chung <jihoon.chung@samsung.com> Mon, 23 Apr 2012 17:35:20 +0900
+
+wrt-installer (0.0.17-1) unstable; urgency=low
+
+ * Apply changed EFL APIs
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.17-1
+
+ -- Yunchan Cho <yunchan.cho@samsung.com> Wed, 14 Mar 2012 10:14:34 +0900
+
+wrt-installer (0.0.17) unstable; urgency=low
+
+ * Support OBS, SMACK
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.17
+
+ -- Yunchan Cho <yunchan.cho@samsung.com> Tue, 13 Mar 2012 20:02:25 +0900
+
+wrt-installer (0.0.16) unstable; urgency=low
+
+ * Package adjusted to wrt-security
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.16
+
+ -- Grzegorz Krawczyk <g.krawczyk@samsung.com> Thu, 08 Feb 2012 11:53:20 +0100
+
+wrt-installer (0.0.15) unstable; urgency=low
+
+ * Implemented WebInstaller
+ * Support for plugins without libraries (geolocation case)
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.15
+
+ -- Grzegorz Krawczyk <g.krawczyk@samsung.com> Mon, 05 Feb 2012 15:53:10 +0100
+
+wrt-installer (0.0.14) unstable; urgency=low
+
+ * Adjusted to new wrt-commons
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.14
+
+ -- Grzegorz Krawczyk <g.krawczyk@samsung.com> Tue, 28 Feb 2012 17:43:10 +0100
+
+wrt-installer (0.0.13) unstable; urgency=low
+
+ * Adjusted to new wrt-security
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.13
+
+ -- Grzegorz Krawczyk <g.krawczyk@samsung.com> Fri, 24 Feb 2012 18:20:20 +0100
+
+wrt-installer (0.0.12) unstable; urgency=low
+
+ * Debianize 0.0.12
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.12
+
+ -- Hoseon LEE <hoseon46.lee@samsung.com> Fri, 24 Feb 2012 09:40:54 +0100
+
+wrt-installer (0.0.11) unstable; urgency=low
+
+ * WAC compliance test WL-3240 fix.
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.11
+
+ -- Zbigniew Kostrzewa <z.kostrzewa@samsung.com> Wed, 22 Feb 2012 09:40:54 +0100
+
wrt-installer (0.0.10) unstable; urgency=low
- * Boilerplate update
+ * Fixed static dev cap setting.
- * Git : tizen2/pkgs/w/wrt-installer
+ * Git : slp/pkgs/w/wrt-installer
* Tag : wrt-installer_0.0.10
- -- Tae-Jeong Lee <taejeong.lee@samsung.com> Thu, 23 Feb 2012 16:14:18 +0900
+ -- Zbigniew Kostrzewa <z.kostrzewa@samsung.com> Wed, 22 Feb 2012 08:18:15 +0100
wrt-installer (0.0.9) unstable; urgency=low
- * debianize
+ * WAC policy test suite bugfix
- * Git : tizen2/pkgs/w/wrt-installer
+ * Git : slp/pkgs/w/wrt-installer
* Tag : wrt-installer_0.0.9
- -- Yunchan Cho <yunchan.cho@samsung.com> Wed, 22 Feb 2012 16:55:58 +0900
+ -- Grzegorz Krawczyk <g.krawczyk@samsung.com> Mon, 20 Feb 2012 16:30:20 +0100
wrt-installer (0.0.8) unstable; urgency=low
- * Init changelog
+ * Add prefix for debian
+ * Remove -j option
- * Git : tizen2/pkgs/w/wrt-installer
+ * Git : slp/pkgs/w/wrt-installer
* Tag : wrt-installer_0.0.8
-- Jihoon Chung <jihoon.chung@samsung.com> Wed, 15 Feb 2012 13:40:40 +0900
+
+wrt-installer (0.0.7) unstable; urgency=low
+
+ * Fixed progress bar for plugins installation
+ * Fixed install fail with No ID widget
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.7
+
+ -- Jihoon Chung <jihoon.chung@samsung.com> Tue, 14 Feb 2012 16:35:31 +0900
+
+wrt-installer (0.0.6) unstable; urgency=low
+
+ * code regarding installation from browser
+ * add X-SLP-PackageID to desktop file
+ * remove sensitive string
+ * remove plugin service
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.6
+
+ -- Yunchan Cho <yunchan.cho@samsung.com> Tue, 14 Feb 2012 09:53:56 +0900
+
+wrt-installer (0.0.5) unstable; urgency=low
+
+ * Remove assert code in the callback
+ * ACE bugfix: handling undetermined attributes
+ * change owner of private directory.
+ * Removing unnecessary include
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.5
+
+ -- Pawel Sikorski <p.sikorski@samsung.com> Wed, 08 Feb 2012 18:14:02 +0100
+
+wrt-installer (0.0.4) unstable; urgency=low
+
+ * Fixed postinst
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.4
+
+ -- Soyoung Kim <sy037.kim@samsung.com> Thu, 02 Feb 2012 16:41:15 +0900
+
+wrt-installer (0.0.3) unstable; urgency=low
+
+ * Clean up and Add wrt-installer option
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.3
+
+ -- Soyoung Kim <sy037.kim@samsung.com> Thu, 02 Feb 2012 16:41:15 +0900
+
+wrt-installer (0.0.2) unstable; urgency=low
+
+ * Debianized wrt-installer_0.0.2
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.2
+
+ -- Soyoung Kim <sy037.kim@samsung.com> Wed, 01 Feb 2012 16:49:07 +0900
+
+wrt-installer (0.0.1) unstable; urgency=low
+
+ * Debianized wrt-installer_0.0.1
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.1
+
+ -- Soyoung Kim <sy037.kim@samsung.com> Wed, 01 Feb 2012 16:49:07 +0900
+
+wrt-installer (0.0.0) unstable; urgency=low
+
+ * create new repository
+
+ * Git : slp/pkgs/w/wrt-installer
+ * Tag : wrt-installer_0.0.0
+
+ -- Soyoung Kim <sy037.kim@samsung.com> Mon, 23 Jan 2012 13:54:11 +0900
Priority: extra
Maintainer: Krzysztof Jackiewicz<k.jackiewicz@samsung.com>, Bartlomiej Grzelewski<b.grzelewski@samsung.com>, jihoon Chung <jihoon.chung@samsung.com>, yunchan Cho <yunchan.cho@samsung.com>
Uploaders: Lukasz Wrzosek <l.wrzosek@samsung.com>, Grzegorz Krawczyk <g.krawczyk@samsung.com>, Soyoung Kim <sy037.kim@samsung.com>,Pawel Sikorski <p.sikorski@samsung.com>, Zbigniew Kostrzewa <z.kostrzewa@samsung.com>
-Build-Depends: debhelper (>= 5), libglib2.0-dev, libsqlite3-dev, libwebkit-engine-dev, libelm-webview-dev, libxml2-dev, libdbus-1-dev, libefreet-dev, libappcore-efl-dev, openssl (>= 0.9.7), libcert-svc-dev, wrt-commons-dev (>= 0.2.15), libpcre-dev, libelm-dev, libecore-dev, libeina-dev, libui-gadget-dev, libslp-utilx-dev, libsecurity-server-client-dev, libpkgmgr-installer-dev, libxmlsec1-dev, libidn11-dev, libpkgmgr-types-dev, libss-client-dev, libiri-dev
+Build-Depends: debhelper (>= 5), libglib2.0-dev, libsqlite3-dev, libwebkit-engine-dev, libelm-webview-dev, libxml2-dev, libdbus-1-dev, libefreet-dev, libappcore-efl-dev, openssl (>= 0.9.7), libcert-svc-dev, wrt-commons-dev (>= 0.2.21), libpcre-dev, libelm-dev, libecore-dev, libeina-dev, libui-gadget-dev, libslp-utilx-dev, libsecurity-server-client-dev, libpkgmgr-installer-dev, libxmlsec1-dev, libidn11-dev, libpkgmgr-types-dev, libss-client-dev, libiri-dev, wrt-security-dev(>= 0.0.13)
Standards-Version: 0.0.1
Package: wrt-installer
Architecture: any
Section: libs
-Depends: ${shlibs:Depends}, ${misc:Depends}, openssl, libug-picker-efl
+Depends: ${shlibs:Depends}, ${misc:Depends}, openssl, libug-picker-efl, wrt-commons (>=0.2.21), wrt-security(>= 0.0.13)
Replaces: wrt-installer
Provides: wrt-installer
Conflicts: wrt-installer
Provides: wrt-installer-dbg
Conflicts: wrt-installer-dbg
Section: debug
-Depends: ${shlibs:Depends}, ${misc:Depends}, wrt (= ${Source-Version})
+Depends: ${shlibs:Depends}, ${misc:Depends}
Description: online widget(W3C, BONDI, JIL, MSC) platform - debug
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-PACKAGE_VERSION ?= $(shell sed -n "1 p" debian/changelog | sed 's/.*(\(.*\)).*/\1/')
+PACKAGE_VERSION ?= $(shell dpkg-parsechangelog | sed -n 's/^Version: // p')
PREFIX ?= /usr
DATADIR ?= /opt
LDFLAGS = -Wl,--rpath=$(PREFIX)/lib
-# Please set CFLAGS only in CMakeLists.txt, as they are dependent on CMake build type.
-
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-ifeq (,$(findstring no,$(DPL_LOG)))
+ifeq (,$(findstring no,$(DPL_LOGS)))
DPL_LOGS_STATUS = "ON"
else
DPL_LOGS_STATUS = "OFF"
endif
-ifeq (1,$(WRT_SKIP_ACE_SUPPORT))
- WRT_SKIP_ACE = "ON"
-else
- WRT_SKIP_ACE = "OFF"
-endif
-
-ifeq (1,$(WRT_SMACK_ENABLE))
- SMACK_STATUS = "ON"
-else
- SMACK_STATUS = "OFF"
-endif
-
-#for building with:
-#efl library, use TARGET=X1
-export TARGET=X1
-
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-#config.status: configure
config.status:
dh_testdir
# Add here commands to configure the package.
mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \
- cmake ${SRCDIR} -DBUILD_TYPE="${TARGET}" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE="$(BUILD_TYPE)" -DDPL_LOG=$(DPL_LOGS_STATUS) -DSMACK_ENABLED=${SMACK_STATUS} -DCMAKE_PACKAGE_VERSION="$(PACKAGE_VERSION)" -DWRT_SKIP_ACE_SUPPORT="${WRT_SKIP_ACE}" ..
-
-
+ cmake ${SRCDIR} \
+ -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
+ -DDPL_LOG=$(DPL_LOGS_STATUS) \
+ -DCMAKE_PACKAGE_VERSION=${PACKAGE_VERSION} ..
build: build-stamp
build-stamp: config.status
# Add here commands to compile the package.
cd $(CMAKE_BUILD_DIR) && $(MAKE) -j 4
#docbook-to-man debian/ncurses.sgml > ncurses.1
-
for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
cat $$f > $${f%.in}; \
sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
--- /dev/null
+#sbs-git:public/pkgs/w/wrt-installer wrt-installer 0.0.19
+Name: wrt-installer
+Summary: Installer for tizen Webruntime
+Version: 0.0.19
+Release: 1
+Group: Development/Libraries
+License: Apache License, Version 2.0
+URL: N/A
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(libxml-2.0)
+BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(dpl-efl)
+BuildRequires: pkgconfig(vcore)
+BuildRequires: pkgconfig(dpl-event-efl)
+BuildRequires: pkgconfig(dpl-utils-efl)
+BuildRequires: pkgconfig(dpl-popup-efl)
+BuildRequires: pkgconfig(dpl-wrt-dao-ro)
+BuildRequires: pkgconfig(dpl-wrt-dao-rw)
+BuildRequires: pkgconfig(ecore-x)
+BuildRequires: pkgconfig(ace)
+BuildRequires: pkgconfig(ace-dao-ro)
+BuildRequires: pkgconfig(ace-dao-rw)
+BuildRequires: pkgconfig(elm-webview)
+BuildRequires: pkgconfig(xmlsec1)
+BuildRequires: pkgconfig(libidn)
+BuildRequires: pkgconfig(libiri)
+BuildRequires: pkgconfig(libpcrecpp)
+BuildRequires: pkgconfig(pkgmgr-installer)
+BuildRequires: pkgconfig(pkgmgr-types)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(cert-svc)
+BuildRequires: pkgconfig(utilX)
+
+%description
+Description: Wrt Installer for Tizen apps and Wac apps
+
+%prep
+%setup -q
+
+%build
+export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib"
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+ -DDPL_LOG="ON" \
+ -DCMAKE_PACKAGE_VERSION=%{version}
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%clean
+rm -rf %{buildroot}
+
+%post
+chmod +s /usr/bin/wrt-installer
+
+#symlink for package manager
+ln -sf /usr/bin/wrt-installer /usr/etc/package-manager/backend/wgt
+
+%files
+/opt/apps/config_gen/*.xml
+%attr(755,root,root) %{_bindir}/wrt-installer
+%attr(755,root,root) %{_bindir}/wrt-tests-config-gen
+%{_libdir}/*.so
+%{_libdir}/*.so.*
+%{_includedir}/config_generator/config_generator.h
+/usr/etc/package-manager/backendlib/libwgt.so
${INSTALLER_SRC_DIR}/configuration_parser
)
+SET(INSTALLER_CONFIG_GENERATOR
+ ${INSTALLER_SRC_DIR}/config_generator
+ )
+
SET(INSTALLER_JOBS
${INSTALLER_SRC_DIR}/jobs
)
${INSTALLER_CONFIG_PARSER}/parser_runner.cpp
${INSTALLER_CONFIG_PARSER}/ignoring_parser.cpp
${INSTALLER_CONFIG_PARSER}/deny_all_parser.cpp
- ${INSTALLER_CONFIG_PARSER}/powder_parser.cpp
${INSTALLER_CONFIG_PARSER}/libiriwrapper.cpp
${INSTALLER_CONFIG_PARSER}/WidgetConfigurationManager.cpp
${INSTALLER_JOBS}/job.cpp
${INSTALLER_JOBS}/plugin_install/plugin_objects.cpp
${INSTALLER_JOBS}/plugin_install/plugin_metafile_reader.cpp
${INSTALLER_JOBS}/widget_install/job_widget_install.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_db_update.cpp
${INSTALLER_JOBS}/widget_install/task_smack.cpp
${INSTALLER_JOBS}/widget_install/task_ace_check.cpp
${INSTALLER_JOBS}/widget_install/task_desktop_file.cpp
- ${INSTALLER_JOBS}/widget_install/task_parental_mode.cpp
${INSTALLER_JOBS}/widget_install/task_certify.cpp
${INSTALLER_JOBS}/widget_install/task_private_storage.cpp
+ ${INSTALLER_JOBS}/widget_install/task_prepare_files.cpp
${INSTALLER_JOBS}/widget_install/wac_security.cpp
${INSTALLER_JOBS}/widget_install/widget_update_info.cpp
${INSTALLER_JOBS}/widget_uninstall/job_widget_uninstall.cpp
${INSTALLER_JOBS}/widget_uninstall/task_smack.cpp
${INSTALLER_SRC_DIR}/logic/installer_logic.cpp
${INSTALLER_SRC_DIR}/logic/installer_controller.cpp
- ${INSTALLER_SRC_DIR}/misc/wrt_powder_info_util.cpp
${INSTALLER_SRC_DIR}/misc/wac_widget_id.cpp
${INSTALLER_SRC_DIR}/misc/feature_logic.cpp
+ ${INSTALLER_CONFIG_GENERATOR}/config_generator.cpp
)
MESSAGE(STATUS "add -DSEP_INSTALLER")
libxml-2.0
openssl
dpl-efl
- dpl-vcore
+ vcore
+ wrt-security
dpl-event-efl
dpl-utils-efl
dpl-popup-efl
dpl-wrt-dao-ro
dpl-wrt-dao-rw
- dpl-ace
- dpl-ace-dao-ro
- dpl-ace-dao-rw
+ ace
+ ace-dao-ro
+ ace-dao-rw
ecore-x
elm-webview
xmlsec1
const xmlChar* _FALSE_ = BAD_CAST "false";
const xmlChar* _NAME_ = BAD_CAST "name";
const xmlChar* _VALUE_ = BAD_CAST "value";
-const xmlChar* _XMLNS_ = BAD_CAST "xmlns";
-const xmlChar* _NAMESPACE_ = BAD_CAST "http://www.w3.org/ns/widgets";
+const xmlChar* _TIZEN_NS_ = BAD_CAST "http://tizen.org/ns/widgets";
+const xmlChar* _TIZEN_PREFIX_ = BAD_CAST "tizen";
+const xmlChar* _W3C_NS_ = BAD_CAST "http://www.w3.org/ns/widgets";
const xmlChar* _ID_ = BAD_CAST "id";
const xmlChar* _VERSION_ = BAD_CAST "version";
const xmlChar* _HEIGHT_ = BAD_CAST "height";
AddCharProp(node, _VALUE_, value);
}
+XmlNodeWrapperPtr CreateRootBase(xmlDocPtr doc, const char* id)
+{
+ Assert(NULL == xmlDocGetRootElement(doc) &&
+ "The document already has root node");
+
+ // root
+ xmlNodePtr root = xmlNewNode(NULL, _WIDGET_);
+ if (NULL == root) {
+ Throw(NodeCreationError);
+ }
+
+ // w3c namespace
+ xmlNsPtr ns = xmlNewNs(root, _W3C_NS_, NULL);
+ if (NULL == ns) {
+ Throw(NodeCreationError);
+ }
+
+ // tizen namespace
+ ns = xmlNewNs(root, _TIZEN_NS_, _TIZEN_PREFIX_);
+ if (NULL == ns) {
+ Throw(NodeCreationError);
+ }
+
+ xmlDocSetRootElement(doc, root);
+ AddCharProp(root, _ID_, id);
+ XmlNodeWrapperPtr ret(new XmlNodeWrapper(root));
+ return ret;
+}
+
} // namespace
// ELEMENT ///////////////////////////////////////////////////////////////
XmlNodeWrapperPtr Element::Handler<TIZEN_SETTING, const char*, const char*>::
CreateNode(const char* name, const char* value)
{
- xmlNodePtr node = NewNode(m_parent->get(), TIZEN_SETTING);
+ xmlNodePtr node = NewNode(m_parent->get(),TIZEN_SETTING);
AddCharProp(node, name, value);
+
+ xmlNsPtr* list = xmlGetNsList(NULL, m_parent->get());
+ if(list && *list) {
+ xmlSetNs(node, *list);
+ }
+
XmlNodeWrapperPtr ret(new XmlNodeWrapper(node));
return ret;
}
// DOCUMENT //////////////////////////////////////////////////////////////
+// <widget xmlns="value" id viewmodes="viewmodes"></widget>
+template <>
+XmlNodeWrapperPtr Document::Handler<WIDGET, const char*, const char*>::
+ CreateRoot(const char* id, const char* viewmodes)
+{
+ XmlNodeWrapperPtr ret = CreateRootBase(m_document->get(), id);
+ AddCharProp(ret->get(), _VIEWMODES_, viewmodes);
+ return ret;
+}
+
// <widget xmlns="value" id="id" viewmodes="viewmodes"></widget>
template <>
XmlNodeWrapperPtr Document::
Handler<WIDGET, const char*, const char*, const char*>::
CreateRoot(const char* id, const char* version, const char* viewmodes)
{
- Assert(NULL == xmlDocGetRootElement(m_document->get()) &&
- "The document already has root node");
-
- // root
- xmlNodePtr root = xmlNewNode(NULL, _WIDGET_);
- if (NULL == root) {
- Throw(NodeCreationError);
- }
- xmlDocSetRootElement(m_document->get(), root);
- AddProperty(root, _XMLNS_, _NAMESPACE_ );
- AddCharProp(root, _ID_, id);
- AddCharProp(root, _VERSION_, version);
- AddCharProp(root, _VIEWMODES_, viewmodes);
- XmlNodeWrapperPtr ret(new XmlNodeWrapper(root));
+ XmlNodeWrapperPtr ret = CreateRootBase(m_document->get(), id);
+ AddCharProp(ret->get(), _VIEWMODES_, viewmodes);
+ AddCharProp(ret->get(), _VERSION_, version);
return ret;
}
Handler<WIDGET, const char*, const char*, int, int>::
CreateRoot(const char* id, const char* version, int height, int width)
{
- // root
- xmlNodePtr root = xmlNewNode(NULL, _WIDGET_);
- if (NULL == root) {
- Throw(NodeCreationError);
- }
- xmlDocSetRootElement(m_document->get(), root);
- AddProperty(root, _XMLNS_, _NAMESPACE_ );
- AddCharProp(root, _ID_, id);
- AddCharProp(root, _VERSION_, version);
+ XmlNodeWrapperPtr ret = CreateRootBase(m_document->get(), id);
+ AddCharProp(ret->get(), _VERSION_, version);
std::ostringstream hstream;
hstream << height;
- AddProperty(root, _HEIGHT_, BAD_CAST hstream.str().c_str());
+ AddProperty(ret->get(), _HEIGHT_, BAD_CAST hstream.str().c_str());
std::ostringstream wstream;
wstream << width;
- AddProperty(root, _WIDTH_, BAD_CAST wstream.str().c_str());
- XmlNodeWrapperPtr ret(new XmlNodeWrapper(root));
+ AddProperty(ret->get(), _WIDTH_, BAD_CAST wstream.str().c_str());
return ret;
}
}
}
+ if (!!configInfo.minVersionRequired) {
+ pWidgetConfigInfo.minVersion = configInfo.minVersionRequired;
+ }
+
return true;
}
Assert(m_reader);
Element element;
- element.name = GetNameWithoutNamespace();
element.value = GetValue();
element.lang = GetLanguageTag();
element.ns = GetNamespace();
xmlTextReaderMoveToAttributeNo(m_reader, i);
XmlAttribute attribute;
- attribute.name = GetName();
+ attribute.ns = GetAttributeNamespace();
+ attribute.name = GetNameWithoutNamespace();
attribute.value = GetValue();
attribute.lang = GetLanguageTag();
LogDebug("Attribute name: " << attribute.name <<
", value: " << attribute.value <<
+ ", namespace: " << attribute.ns <<
", lang: " << attribute.lang);
parser->Accept(attribute);
}
return ret_value;
}
+ DPL::String GetAttributeNamespace() const
+ {
+ DPL::String ret_value;
+ const xmlChar* value = xmlTextReaderLookupNamespace(m_reader, NULL);
+ if (value) {
+ ret_value = DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+ }
+ xmlFree(const_cast<xmlChar*>(value));
+
+ return ret_value;
+ }
+
DPL::String GetName() const
{
DPL::String ret_value;
DPL::String GetNamespace() const
{
DPL::String ret_value;
+
const xmlChar* value = xmlTextReaderConstNamespaceUri(m_reader);
if (value) {
ret_value = DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file powder_parser.cpp
- * @author Piotr Marcinkiewicz (p.marcinkiew@samsung.com)
- * @version 0.1
- * @brief Parser for WAC defined POWDER
- */
-
-#include <algorithm>
-#include <cstdio>
-#include <cerrno>
-#include <ewk_main.h>
-#include <dpl/log/log.h>
-#include <dpl/sstream.h>
-#include <dpl/foreach.h>
-#include "powder_parser.h"
-#include "ignoring_parser.h"
-#include "deny_all_parser.h"
-
-namespace {
-void MergeDescriptions(WrtDB::Powder::Description* dest,
- const WrtDB::Powder::Description& src)
-{
- Assert(dest);
-// LogInfo("MergeDescriptions dest: " << *dest <<
-// " src: " << src);
- if (!dest->ageRating) {
- dest->ageRating = src.ageRating;
- } else {
- if (!!src.ageRating) {
- if (*dest->ageRating > *src.ageRating) {
- dest->ageRating = src.ageRating;
- }
- }
- }
- FOREACH(catIter, src.categories)
- {
- FOREACH(levelIter, catIter->second.levels)
- {
- dest->categories[catIter->first].levels.push_back(*levelIter);
- }
- }
-// LogInfo("MergeDescriptions result:" << *dest);
-}
-
-//TODO::Check if list of delimiters is valid
-const DPL::String constPowderDelimiters = DPL::FromUTF32String(L" ,;\n\r\t");
-} //anonymous namespace
-
-std::ostream & operator<<(std::ostream& aStream,
- const StringSet& aContainer)
-{
- if (!aContainer.empty()) {
- StringSet::const_iterator iter = aContainer.begin();
- aStream << "{[" << *iter;
- ++iter;
- for (/*empty*/; iter != aContainer.end(); ++iter) {
- aStream << "] [" << *iter;
- }
- aStream << "]}";
- }
- return aStream;
-}
-
-#define DEFINE_ELEMENT_FUNC(element, myClass) \
- m_map[DPL::FromUTF32String(L"" # element)] = \
- DPL::MakeDelegate(this, &myClass::OnElement_ ## element);
-
-class DenyUnknownTagsParser : public ElementParser
-{
- public:
- DenyUnknownTagsParser() : ElementParser()
- {
- }
-
- void Accept(const XmlAttribute& /*attribute*/)
- {
- }
-
- void Accept(const Element& /*element*/)
- {
- }
-
- void Accept(const Text& /*text*/)
- {
- }
-
- ElementParserPtr OnDenyElement()
- {
- return ElementParserPtr(new DenyAllParser());
- }
-
- ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return DPL::MakeDelegate(this, &DenyUnknownTagsParser::OnDenyElement);
- }
-
- protected:
- FuncMap m_map;
-};
-
-StringSet TokenizeTag(const DPL::String& buffer)
-{
- StringSet data;
- DPL::Tokenize(buffer, constPowderDelimiters,
- std::insert_iterator<StringSet>(data, data.begin()), true);
- return data;
-}
-
-class SetOfTextValuesParser : public DenyUnknownTagsParser
-{
- public:
- explicit SetOfTextValuesParser(std::set<DPL::String>* data) :
- DenyUnknownTagsParser(),
- m_data(data)
- {
- Assert(m_data);
- }
-
- virtual void Accept(const Text& text)
- {
- LogDebug("text");
- m_buffer += text.value;
- }
- void Verify()
- {
- *m_data = TokenizeTag(m_buffer);
- }
-
- private:
- DPL::String m_buffer;
- StringSet* m_data;
-};
-
-// It is data structure used by iriset parser to match IRI's
-// and preserve processing result
-struct IrisetParserData
-{
- const DPL::String* m_host;
- const DPL::String* m_path;
- bool m_matched;
- IrisetParserData(const DPL::String& host,
- const DPL::String& path) :
- m_host(&host),
- m_path(&path),
- m_matched(false)
- {
- }
-};
-
-class IrisetParser : public DenyUnknownTagsParser
-{
- public:
- explicit IrisetParser(IrisetParserData* data) :
- DenyUnknownTagsParser(),
- m_data(data),
- m_hostsDetected(0),
- m_pathsDetected(0)
- {
- Assert(m_data);
- DEFINE_ELEMENT_FUNC(includehosts, IrisetParser);
- DEFINE_ELEMENT_FUNC(includeexactpaths, IrisetParser);
- }
-
- ElementParserPtr OnElement_includehosts()
- {
- m_hostsDetected++;
- return ElementParserPtr(new SetOfTextValuesParser(&m_hosts));
- }
-
- ElementParserPtr OnElement_includeexactpaths()
- {
- m_pathsDetected++;
- return ElementParserPtr(new SetOfTextValuesParser(&m_paths));
- }
-
- void Verify()
- {
- if (m_hostsDetected <= 1 && m_pathsDetected <= 1) {
- LogInfo("Matching iriset for host [" <<
- *m_data->m_host << "] path [" <<
- *m_data->m_path << "]");
- LogInfo("hosts: " << m_hosts <<
- " paths: " << m_paths);
- m_data->m_matched =
- m_hosts.find(*m_data->m_host) != m_hosts.end() &&
- m_paths.find(*m_data->m_path) != m_paths.end();
- } else {
- ThrowMsg(PowderParserException::ParserFailed,
- "Invalid iriset contents");
- }
- }
-
- private:
- IrisetParserData* m_data;
- typedef StringSet Container;
- Container m_hosts;
- Container m_paths;
- size_t m_hostsDetected;
- size_t m_pathsDetected;
-};
-
-class WacCategoryParser : public DenyUnknownTagsParser
-{
- public:
- WacCategoryParser(WrtDB::Powder::Description::LevelEntry* data) :
- DenyUnknownTagsParser(),
- m_data(data)
- {
- Assert(m_data);
- }
-
- virtual void Accept(const Text& text)
- {
- LogDebug("text");
- m_buffer += text.value;
- }
-
- static StringSet GetAllowedAttributes()
- {
- StringSet allowed;
- allowed.insert(DPL::FromUTF32String(L"xa"));
- allowed.insert(DPL::FromUTF32String(L"xb"));
- allowed.insert(DPL::FromUTF32String(L"xc"));
- allowed.insert(DPL::FromUTF32String(L"xd"));
- allowed.insert(DPL::FromUTF32String(L"xe"));
- return allowed;
- }
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- static StringSet allowed = GetAllowedAttributes();
- if (allowed.find(attribute.name) != allowed.end()) {
- if (DPL::FromUTF32String(L"1") == attribute.value) {
- m_data->context.insert(attribute.name);
- } else if (DPL::FromUTF32String(L"0") != attribute.value) {
- ThrowMsg(PowderParserException::ParserFailed,
- "Invalid attribute for WAC category tag");
- }
- } else {
- ThrowMsg(PowderParserException::ParserFailed,
- "Invalid tag in descriptionset");
- }
- }
-
- virtual void Verify()
- {
- StringSet values = TokenizeTag(m_buffer);
- bool numberFound = false;
-
- FOREACH(wordIter, values) {
- DPL::IStringStream str(*wordIter);
- int rating;
- str >> rating;
- if (str.fail()) {
- ThrowMsg(PowderParserException::ParserFailed,
- "WAC category level is not number");
- } else {
- if (numberFound) {
- ThrowMsg(PowderParserException::ParserFailed,
- "Too many WAC category levels");
- } else {
- if (rating >= MIN_AGE_RATING && rating <= MAX_AGE_RATING) {
- m_data->level =
- static_cast<WrtDB::Powder::Description::LevelEnum>(
- rating);
- numberFound = true;
- } else {
- ThrowMsg(PowderParserException::ParserFailed,
- "WAC category level is out of range ");
- }
- }
- }
- }
- if (!numberFound) {
- ThrowMsg(PowderParserException::ParserFailed,
- "WAC category level is not present in tag");
- }
- }
-
- private:
- WrtDB::Powder::Description::LevelEntry* m_data;
- DPL::String m_buffer;
- static const int MIN_AGE_RATING = 0;
- static const int MAX_AGE_RATING = 5;
-};
-
-class DescriptorSetParser : public DenyUnknownTagsParser
-{
- public:
- typedef WrtDB::Powder::Description::CategoryEntries::iterator CatIter;
- explicit DescriptorSetParser(WrtDB::Powder::Description* data) :
- DenyUnknownTagsParser(),
- m_data(data)
- {
- Assert(m_data);
-#define ELEM(tag) DEFINE_ELEMENT_FUNC(tag, DescriptorSetParser)
- ELEM(aa);
- ELEM(nu);
- ELEM(se);
- ELEM(vi);
- ELEM(la);
- ELEM(dr);
- ELEM(ga);
- ELEM(ha);
- ELEM(ug);
-#undef ELEM
- m_map[DPL::FromUTF32String(L"displayicon")] =
- DPL::MakeDelegate(this, &DescriptorSetParser::OnIgnoredElement);
- }
-
- ElementParserPtr OnElement_aa()
- {
- m_ages.push_back(StringSet());
- return ElementParserPtr(new SetOfTextValuesParser(&m_ages.back()));
- }
-
-#define GENERATE_ELEMENT_FUNC(element) \
- ElementParserPtr OnElement_ ## element() \
- { \
- LogInfo("WAC category tag detected: " << # element); \
- CatIter category = \
- m_data->categories.find(DPL::FromUTF32String(L"" # element)); \
- if (m_data->categories.end() == category) \
- { \
- std::pair<CatIter, bool> result = \
- m_data->categories.insert(std::make_pair( \
- DPL::FromUTF32String(L"" # \
- element), \
- WrtDB::Powder::Description:: \
- CategoryEntry())); \
- category = result.first; \
- } \
- category->second.levels.push_back( \
- WrtDB::Powder::Description::LevelEntry()); \
- return ElementParserPtr(new \
- WacCategoryParser( \
- &category->second.levels.back())); \
- } \
-
- GENERATE_ELEMENT_FUNC(nu)
- GENERATE_ELEMENT_FUNC(se)
- GENERATE_ELEMENT_FUNC(vi)
- GENERATE_ELEMENT_FUNC(la)
- GENERATE_ELEMENT_FUNC(dr)
- GENERATE_ELEMENT_FUNC(ga)
- GENERATE_ELEMENT_FUNC(ha)
- GENERATE_ELEMENT_FUNC(ug)
-
-#undef GENERATE_ELEMENT_FUNC
-
- ElementParserPtr OnIgnoredElement()
- {
- return ElementParserPtr(new IgnoringParser());
- }
-
- void Verify()
- {
- if (m_ages.size() > 1) {
- ThrowMsg(PowderParserException::ParserFailed,
- "More than one aa tags: not implemented");
- } else if (m_ages.size() == 1) {
- if (!m_ages.at(0).empty() && m_ages.at(0).size() <= 1) {
- DPL::IStringStream str(*m_ages.at(0).begin());
- int rating = 12;
- str >> rating;
- if (str.fail()) {
- ThrowMsg(PowderParserException::ParserFailed,
- "Invalid number in age rating");
- } else {
- m_data->ageRating = rating;
- }
- } else {
- ThrowMsg(PowderParserException::ParserFailed,
- "Not valid age value in aa tag ");
- }
- }
-// LogInfo("Descriptionset verified: " << *m_data);
- }
-
- private:
- typedef std::vector<StringSet> AgesTags;
- AgesTags m_ages;
- WrtDB::Powder::Description* m_data;
-};
-
-class DrParser : public DenyUnknownTagsParser
-{
- public:
- DrParser(WrtDB::Powder::Description* data,
- const DPL::String& host,
- const DPL::String& path) :
- DenyUnknownTagsParser(),
- m_data(data),
- m_host(host),
- m_path(path)
- {
- Assert(m_data);
- DEFINE_ELEMENT_FUNC(iriset, DrParser);
- DEFINE_ELEMENT_FUNC(descriptorset, DrParser);
- }
-
- ElementParserPtr OnElement_iriset()
- {
- m_iriSetOutcomes.push_back(IrisetParserData(m_host, m_path));
- return ElementParserPtr(new IrisetParser(&m_iriSetOutcomes.back()));
- }
-
- ElementParserPtr OnElement_descriptorset()
- {
- m_descriptions.push_back(WrtDB::Powder::Description());
- return ElementParserPtr(new
- DescriptorSetParser(&m_descriptions.back()));
- }
-
- void Verify()
- {
- if (m_iriSetOutcomes.empty() || m_descriptions.empty()) {
- ThrowMsg(
- PowderParserException::ParserFailed,
- "dr tag don't contain at lease one iriset and descriptionset ");
- } else {
- IriSetOutcomes::const_iterator outIter;
- for (outIter = m_iriSetOutcomes.begin();
- outIter != m_iriSetOutcomes.end() && !outIter->m_matched;
- ++outIter) {
- }
- if (outIter != m_iriSetOutcomes.end()) {
- LogInfo("Matching iriset found");
- typedef PowderDescriptions::const_iterator DescIter;
- for (DescIter descIter = m_descriptions.begin();
- descIter != m_descriptions.end(); ++descIter) {
- MergeDescriptions(m_data, *descIter);
- }
- } else {
- LogWarning("No matching iriset found");
- }
- }
-// LogInfo("dr tag verified" << *m_data);
- }
- private:
- typedef std::vector<WrtDB::Powder::Description> PowderDescriptions;
- PowderDescriptions m_descriptions;
- typedef std::vector<IrisetParserData> IriSetOutcomes;
- IriSetOutcomes m_iriSetOutcomes;
- WrtDB::Powder::Description* m_data;
- const DPL::String& m_host;
- const DPL::String& m_path;
-};
-
-PowderParser::PowderParser(PowderParserData* data) :
- ElementParser(),
- m_data(data->description),
- m_host(data->host),
- m_path(data->path)
-{
- Assert(m_data);
- m_map[DPL::FromUTF32String(L"attribution")] =
- DPL::MakeDelegate(this, &PowderParser::OnIgnoredElement);
- DEFINE_ELEMENT_FUNC(dr, PowderParser);
-}
-
-ElementParserPtr PowderParser::OnIgnoredElement()
-{
- return ElementParserPtr(new IgnoringParser());
-}
-
-ElementParserPtr PowderParser::OnElement_dr()
-{
- return ElementParserPtr(new DrParser(m_data, m_host, m_path));
-}
-
-void PowderParser::Accept(const Element& /*element*/)
-{
-}
-
-void PowderParser::Accept(const XmlAttribute& /*attribute*/)
-{
-}
-
-void PowderParser::Accept(const Text& /*text*/)
-{
-}
-
-void PowderParser::Verify()
-{
-// LogInfo("powder tag verified " << *m_data);
-}
-
-ElementParserPtr PowderParser::OnDenyElement()
-{
- return ElementParserPtr(new DenyAllParser());
-}
-
-ElementParser::ActionFunc PowderParser::GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
-{
- FuncMap::const_iterator it = m_map.find(name);
- if (it != m_map.end()) {
- return it->second;
- } else {
- return DPL::MakeDelegate(this, &PowderParser::OnDenyElement);
- }
-}
-
-#undef DEFINE_ELEMENT_FUNC
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file powder_parser.h
- * @author Piotr Marcinkiewicz (p.marcinkiew@samsung.com)
- * @version 0.1
- * @brief Parser for WAC defined POWDER
- */
-
-#ifndef _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_POWDER_PARSER_H_
-#define _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_POWDER_PARSER_H_
-
-#include <dpl/exception.h>
-#include "element_parser.h"
-#include <dpl/wrt-dao-ro/common_dao_types.h>
-
-//TODO: Move to separate header
-namespace PowderParserException {
-DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
-DECLARE_EXCEPTION_TYPE(Base, ParserFailed)
-}
-
-struct PowderParserData
-{
- WrtDB::Powder::Description* description;
- const DPL::String& host;
- const DPL::String& path;
- PowderParserData(WrtDB::Powder::Description* a_description,
- const DPL::String& a_host,
- const DPL::String& a_path) :
- description(a_description),
- host(a_host),
- path(a_path)
- {
- }
-};
-//TODO: Move to other header
-typedef std::set<DPL::String> StringSet;
-
-class PowderParser : public ElementParser
-{
- public:
- //Typedef used by RootParser
- typedef PowderParserData* Data;
-
- explicit PowderParser(PowderParserData* data);
-
- ElementParserPtr OnNameElement();
-
- //TODO: Remove not implemented methods
- virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name);
- virtual void Accept(const Element& /*element*/);
- virtual void Accept(const XmlAttribute& attribute);
- virtual void Accept(const Text& text);
- virtual void Verify();
-
- ElementParserPtr OnIgnoredElement();
- ElementParserPtr OnElement_dr();
- ElementParserPtr OnDenyElement();
-
- private:
- WrtDB::Powder::Description* m_data;
- const DPL::String& m_host;
- const DPL::String& m_path;
- FuncMap m_map;
-};
-#endif // _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_POWDER_PARSER_H_
virtual void Accept(const Element& element)
{
- if (element.ns == ConfigurationNamespace::W3CWidgetNamespaceName) {
+ // for tizen web apps WARP should be used
+ if (element.ns == ConfigurationNamespace::W3CWidgetNamespaceName ||
+ element.ns == ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
m_standardType = STANDARD_TYPE_WARP;
}
if (element.ns == ConfigurationNamespace::JilWidgetNamespaceName) {
DPL::OptionalString m_href;
};
-class MinVersionParser : public ElementParser
-{
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &DenyAllParser::Create;
- }
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (m_properNamespace) {
- ThrowMsg(Exception::ParseError,
- "attirubte: '" + DPL::ToUTF8String(attribute.name) +
- "' in min-version element not allowed");
- }
- }
-
- virtual void Accept(const Element& element)
- {
- if (element.ns == ConfigurationNamespace::WacWidgetNamespaceName) {
- m_properNamespace = true;
- }
-
- LogDebug("element min-version");
- }
-
- virtual void Accept(const Text& text)
- {
- if (m_properNamespace) {
- m_minVersion = text.value;
- LogDebug("min-version value: " << m_minVersion);
- }
- }
-
- virtual void Verify()
- {
- if (m_properNamespace) {
- if (m_minVersion.IsNull()) {
- ThrowMsg(Exception::ParseError,
- "min-version element must have value");
- }
-
- DPL::OptionalFloat version = ParseMinVersion(*m_minVersion);
- if (version.IsNull()) {
- ThrowMsg(Exception::ParseError,
- "min-version element must have value"
- " that can be parsed to float");
- }
-
- if (m_data.minVersionRequiredFound.IsNull()) {
- m_data.minVersionRequiredFound = 1;
- m_data.minVersionRequired = version;
- LogDebug("MinVersionRequired = " << version);
- } else {
- ThrowMsg(Exception::ParseError,
- "multiple min-version elements not allowed");
- }
- }
- }
-
- MinVersionParser(ConfigParserData& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data),
- m_minVersion()
- {
- LogDebug("MinVersionParser created");
- }
-
- private:
- bool m_properNamespace;
- ConfigParserData& m_data;
- DPL::OptionalString m_minVersion;
-
- static DPL::OptionalFloat ParseMinVersion(const DPL::String& value)
- {
- DPL::OptionalString normalizedValue = value;
- NormalizeString(normalizedValue);
- if (!(*normalizedValue).empty()) {
- char* reterr = NULL;
- errno = 0;
- float valueFloat =
- strtof(DPL::ToUTF8String(value).c_str(), &reterr);
- if (errno != 0 ||
- std::string(reterr) == DPL::ToUTF8String(value) ||
- valueFloat <= 0.0) {
- return DPL::OptionalFloat::Null;
- } else {
- return valueFloat;
- }
- }
- return DPL::OptionalFloat::Null;
- }
-};
-
-// tag: <back supported=true>
-class BackParser : public ElementParser
-{
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &IgnoringParser::Create;
- }
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- LogDebug("attribute");
- if (attribute.name == L"supported") {
- if (attribute.value == L"true") {
- m_backSupported = true;
- } else {
- m_backSupported = false;
- }
- }
- }
-
- virtual void Accept(const Element&)
- {
- LogDebug("element");
- //if empty back element will be passed, we say true
- m_data.backSupported = true;
- }
-
- virtual void Accept(const Text&)
- {
- LogDebug("text");
- ThrowMsg(Exception::ParseError, "back element must be empty");
- }
-
- virtual void Verify()
- {
- m_data.backSupported = m_backSupported;
- }
-
- BackParser(ConfigParserData& data) :
- ElementParser(),
- m_backSupported(false),
- m_data(data)
- {
- }
-
- private:
- bool m_backSupported;
- ConfigParserData& m_data;
-};
-
class SettingParser : public ElementParser
{
public:
DPL::MakeDelegate(this, &WidgetParser::OnPreferenceElement);
m_map[L"flash"] = DPL::MakeDelegate(this, &WidgetParser::OnFlashElement);
m_map[L"link"] = DPL::MakeDelegate(this, &WidgetParser::OnLinkElement);
- m_map[L"min-version"] =
- DPL::MakeDelegate(this, &WidgetParser::OnMinVersionElement);
- m_map[L"back"] = DPL::MakeDelegate(this, &WidgetParser::OnBackElement);
m_map[L"pkgname"] = DPL::MakeDelegate(this, &WidgetParser::OnPkgnameElement);
m_map[L"setting"] =
DPL::MakeDelegate(this, &WidgetParser::OnSettingElement);
return ElementParserPtr(new LinkParser(m_data));
}
-ElementParserPtr WidgetParser::OnMinVersionElement()
-{
- return ElementParserPtr(new MinVersionParser(m_data));
-}
-
-ElementParserPtr WidgetParser::OnBackElement()
-{
- return ElementParserPtr(new BackParser(m_data));
-}
-
ElementParserPtr WidgetParser::OnPkgnameElement()
{
return ElementParserPtr(new PkgnameParser(m_data));
void WidgetParser::Accept(const Element& element)
{
- if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName) {
+ if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName &&
+ element.ns != ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
ThrowMsg(Exception::ParseError,
"Wrong xml namespace for widget element");
}
} else if (attribute.name == L"version") {
m_version = attribute.value;
NormalizeString(m_version);
+ } else if (attribute.name == L"min-version") {
+ LogInfo("min-version attribute was found. Value: " << attribute.value);
+ m_minVersion = attribute.value;
+ NormalizeString(m_minVersion);
+ m_data.minVersionRequired = m_minVersion;
} else if (attribute.name == L"height") {
DPL::OptionalString value = attribute.value;
NormalizeString(value);
} else {
LogWarning("Ignoring subsequent default locale");
}
- } else if (DPL::StringCompare(L"xmlns", attribute.name) < 0) {
- LogWarning("namespace domain" << attribute.name);
- LogWarning("namespace value " << attribute.value);
- DPL::OptionalString ns = attribute.value;
-
- if (attribute.name == L"xmlns:wac") {
- m_nameSpaces.push_back(attribute.value);
- } else if (attribute.name == L"xmlns:tizen") {
- m_nameSpaces.push_back(attribute.value);
- } else if (attribute.name == L"xmlns:jil") {
- m_nameSpaces.push_back(attribute.value);
- }
+
+ //Any other value consider as a namespace definition
+ } else if (attribute.name == L"xmlns" ||
+ attribute.ns == m_nameSpaces[L"xmlns"]) {
+ LogInfo("Namespace domain: " << attribute.name);
+ LogInfo("Namespace value: " << attribute.value);
+ m_nameSpaces[attribute.name] = attribute.value;
+ } else {
+ LogError("Unknown attirbute: namespace=" << attribute.ns <<
+ ", name=" << attribute.name <<
+ ", value=" << attribute.value);
}
}
}
m_data.defaultlocale = m_defaultlocale;
FOREACH(ns, m_nameSpaces) {
- m_data.nameSpaces.insert(*ns);
+ m_data.nameSpaces.insert(ns->second);
}
}
#include "element_parser.h"
#include <list>
+#include <map>
#include <dpl/foreach.h>
#include <dpl/wrt-dao-ro/config_parser_data.h>
ElementParserPtr OnAccessElement();
ElementParserPtr OnFlashElement();
ElementParserPtr OnLinkElement();
- ElementParserPtr OnMinVersionElement();
- ElementParserPtr OnBackElement();
ElementParserPtr OnPkgnameElement();
ElementParserPtr OnSettingElement();
ElementParserPtr OnServiceElement();
Unicode::Direction m_textDirection;
FuncMap m_map;
DPL::Optional<DPL::String> m_version;
+ DPL::Optional<DPL::String> m_minVersion;
std::list<DPL::String> m_windowModes;
DPL::Optional<DPL::String> m_defaultlocale;
- std::list<DPL::String> m_nameSpaces;
+ std::map<DPL::String, DPL::String> m_nameSpaces;
};
struct IconParser;
//WRT INCLUDES
#include <dpl/log/log.h>
+#include <dpl/foreach.h>
#include <job.h>
#include "plugin_install_task.h"
#include "job_plugin_install.h"
m_context->installerTask->UpdateProgress( \
PluginInstallerContext::step, desc);
+#define DISABLE_IF_PLUGIN_WITHOUT_LIB() \
+ if(m_pluginMetafile.m_libraryName.empty()) \
+ { \
+ LogWarning("Plugin without library."); \
+ return; \
+ }
+
namespace Jobs {
namespace PluginInstall {
PluginInstallTask::PluginInstallTask(PluginInstallerContext *inCont) :
reader.initialize(filename);
reader.read(m_pluginMetafile);
+ FOREACH(it, m_pluginMetafile.m_featureContainer)
+ {
+ LogDebug("Parsed feature : " << it->m_name);
+ FOREACH (devCap, it->m_deviceCapabilities) {
+ LogDebug(" | DevCap : " << *devCap);
+ }
+ }
+
SET_PLUGIN_INSTALL_PROGRESS(PLUGIN_PATH, "Config file analyzed");
}
Catch(ValidationCore::ParserSchemaException::Base)
{
LogInfo("Plugin installation: step load library");
+ DISABLE_IF_PLUGIN_WITHOUT_LIB()
+
std::string filename = m_context->pluginFilePath + DIRECTORY_SEPARATOR +
m_pluginMetafile.m_libraryName;
{
LogInfo("Plugin installation: step register objects");
+ DISABLE_IF_PLUGIN_WITHOUT_LIB()
+
//register implemented objects
PluginObjects::ObjectsPtr objects =
m_libraryObjects->getImplementedObject();
{
LogInfo("Plugin installation: step resolve dependencies ");
+ //DISABLE_IF_PLUGIN_WITHOUT_LIB
+ if(m_pluginMetafile.m_libraryName.empty())
+ {
+ PluginDAO::setPluginInstallationStatus(m_pluginHandle,
+ PluginDAO::INSTALLATION_COMPLETED);
+ //Installation completed
+ m_context->pluginHandle = m_pluginHandle;
+ m_context->installationCompleted = true;
+ LogWarning("Plugin without library.");
+ return;
+ }
+
PluginHandleSetPtr handles = PluginHandleSetPtr(new PluginHandleSet);
DbPluginHandle handle = INVALID_PLUGIN_HANDLE;
void PluginMetafileReader::tokenEndApiFeature(PluginMetafileData &data)
{
data.m_featureContainer.insert(m_feature);
+ m_feature.m_deviceCapabilities.clear();
}
void PluginMetafileReader::tokenEndName(PluginMetafileData & /* data */)
#include "widget_parser.h"
#include "parser_runner.h"
#include <widget_install/job_widget_install.h>
-#include <widget_install/task_parental_mode.h>
#include <widget_install/task_unzip.h>
#include <widget_install/task_certify.h>
#include <widget_install/task_widget_config.h>
#include <widget_install/task_smack.h>
#include <widget_install/task_desktop_file.h>
#include <widget_install/task_private_storage.h>
+#include <widget_install/task_prepare_files.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/widget_install_context.h>
#include <string>
#include <dpl/wrt-dao-rw/global_dao.h> // TODO remove
#include <aul.h>
#include <dpl/localization/w3c_file_localization.h>
+#include <libiriwrapper.h>
using namespace WrtDB;
{
const char * const CONFIG_XML = "config.xml";
-struct PathAndFilePair
-{
- std::string path;
- std::string file;
-
- PathAndFilePair(const std::string &p,
- const std::string &f) :
- path(p),
- file(f)
- {
- }
-};
-
-PathAndFilePair SplitFileAndPath(const std::string &filePath)
-{
- std::string::size_type position = filePath.rfind('/');
-
- // Is this only a file without a path ?
- if (position == std::string::npos) {
- return PathAndFilePair(std::string(), filePath);
- }
-
- // This is full file-path pair
- return PathAndFilePair(filePath.substr(0,
- position),
- filePath.substr(position + 1));
-}
-
class InstallerTaskFail :
public DPL::TaskDecl<InstallerTaskFail>
{
m_exceptionCaught(Exceptions::Success)
{
// Configure installation
- ConfigureResult result = ConfigureInstallation(widgetPath);
+ ConfigureResult result = ConfigureInstallation(widgetPath, false);
if (result == ConfigureResult::Ok) {
LogInfo("Configure installation succeeded");
// Create installation tasks
- AddTask(new TaskParentalMode(m_installerContext));
AddTask(new TaskUnzip(m_installerContext));
AddTask(new TaskWidgetConfig(m_installerContext));
AddTask(new TaskCertify(m_installerContext));
}
}
-DPL::Optional<WidgetHandle> JobWidgetInstall::getNewWidgetHandle() const
+JobWidgetInstall::JobWidgetInstall(
+ std::string const & widgetUrl,
+ std::string const & iconPath,
+ const WidgetInstallationStruct &installerStruct) :
+ Job(Installation),
+ JobContextBase<WidgetInstallationStruct>(installerStruct),
+ m_exceptionCaught(Exceptions::Success)
{
- return m_installerContext.widgetHandle;
-}
+ // Configure installation
+ ConfigureResult result = ConfigureInstallation(widgetUrl, true);
-bool JobWidgetInstall::getUnzipStartedFlag() const
-{
- return m_installerContext.unzipStarted;
+ if (result == ConfigureResult::Ok) {
+ LogInfo("Configure installation succeeded");
+
+ // Check web app url
+ LibIri::Wrapper iri(widgetUrl.c_str());
+ if (!iri.Validate()) {
+ ThrowMsg(Exceptions::InvalidWidgetUrl,
+ "Web app url must be a valid iri/uri/url");
+ }
+
+ m_installerContext.widgetConfig.configInfo.startFile =
+ DPL::FromUTF8String(widgetUrl);
+
+ m_installerContext.iconPath = iconPath;
+
+ // Create installation tasks
+ AddTask(new TaskPrepareFiles(m_installerContext));
+ AddTask(new TaskWidgetConfig(m_installerContext));
+ AddTask(new TaskCertify(m_installerContext));
+ AddTask(new TaskDbUpdate(m_installerContext));
+ // TODO: Update progress information for this task
+
+ AddTask(new TaskAceCheck(m_installerContext));
+ //This is sort of quick solution, because ACE verdicts are based upon
+ //data from DAO (DB). So AceCheck for now has to be AFTER DbUpdate
+ //task.
+ AddTask(new TaskSmack(m_installerContext));
+
+ AddTask(new TaskDesktopFile(m_installerContext));
+ AddTask(new TaskPrivateStorage(m_installerContext));
+ } else if (result == ConfigureResult::Deferred) {
+ // Installation is deferred
+ LogInfo("Configure installation deferred");
+
+ AddTask(new InstallerTaskFail(true));
+ } else if (result == ConfigureResult::Failed) {
+ // Installation is not allowed to proceed due to widget update policy
+ LogWarning("Configure installation failed!");
+
+ AddTask(new InstallerTaskFail(false));
+ } else {
+ Assert(false && "Invalid configure result!");
+ }
}
-bool JobWidgetInstall::getUnzipFinishedFlag() const
+DPL::Optional<WidgetHandle> JobWidgetInstall::getNewWidgetHandle() const
{
- return m_installerContext.unzipFinished;
+ return m_installerContext.widgetHandle;
}
JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
- const std::string &widgetPath)
+ const std::string &widgetSource, bool fromBrowser)
{
// Detect widget update
- WidgetUpdateInfo update = detectWidgetUpdate(widgetPath);
+ WidgetUpdateInfo update = detectWidgetUpdate(widgetSource, fromBrowser);
LogInfo(
"Widget install/update: incoming guid = '" <<
if (m_jobStruct.updateMode == WidgetUpdateMode::PolicyWac) {
LogInfo(
"Widget is already running. Policy is update according to WAC");
- LogInfo("Installation deferred: " << widgetPath);
+ LogInfo("Installation deferred: " << widgetSource);
GlobalDAO::AddDefferedWidgetPackageInstallation(
- DPL::FromUTF8String(widgetPath));
+ DPL::FromUTF8String(widgetSource));
return ConfigureResult::Deferred;
} else {
LogInfo(
"Widget is already running. Policy is not update according to WAC");
- LogInfo("Installation aborted: " << widgetPath);
+ LogInfo("Installation aborted: " << widgetSource);
return ConfigureResult::Failed;
}
LogInfo("Whether widget policy allow proceed: " << canProceed);
// Init installer context
- m_installerContext.widgetFilePath = widgetPath;
+ m_installerContext.widgetSource = widgetSource;
m_installerContext.tempWidgetPath = std::string();
m_installerContext.widgetConfig = WidgetRegisterInfo();
- m_installerContext.unzipStarted = false;
- m_installerContext.unzipFinished = false;
m_installerContext.installStep = InstallerContext::INSTALL_START;
m_installerContext.job = this;
m_installerContext.existingWidgetInfo = update.existingWidgetInfo;
}
WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
- const std::string &widgetPath)
+ const std::string &widgetSource, bool fromBrowser)
{
LogInfo("Checking up widget package for config.xml...");
Try
{
- // Open zip file
- DPL::ScopedPtr<DPL::ZipInput> zipFile(
- new DPL::ZipInput(widgetPath));
-
- // Open config.xml file
- DPL::ScopedPtr<DPL::ZipInput::File> configFile(
- zipFile->OpenFile(CONFIG_XML));
-
- // Extract config
- DPL::BinaryQueue buffer;
- DPL::AbstractWaitableInputAdapter inputAdapter(configFile.Get());
- DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
- DPL::Copy(&inputAdapter, &outputAdapter);
-
- // Parse config
- ParserRunner parser;
- ConfigParserData configInfo;
-
- parser.Parse(&buffer,
- ElementParserPtr(
- new RootParser<WidgetParser>(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
-
- // Check widget id
- DPL::OptionalString widgetGUID = configInfo.widget_id;
-
- if (widgetGUID.IsNull()) {
- LogDebug("Installed widget has no GUID");
- return WidgetUpdateInfo();
+ DPL::OptionalString widgetGUID;
+ OptionalWidgetVersion widgetVersion;
+ if (fromBrowser) {
+ widgetGUID = DPL::FromUTF8String(widgetSource);
}
+ else {
+ // Open zip file
+ DPL::ScopedPtr<DPL::ZipInput> zipFile(
+ new DPL::ZipInput(widgetSource));
+
+ // Open config.xml file
+ DPL::ScopedPtr<DPL::ZipInput::File> configFile(
+ zipFile->OpenFile(CONFIG_XML));
+
+ // Extract config
+ DPL::BinaryQueue buffer;
+ DPL::AbstractWaitableInputAdapter inputAdapter(configFile.Get());
+ DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
+ DPL::Copy(&inputAdapter, &outputAdapter);
+
+ // Parse config
+ ParserRunner parser;
+ ConfigParserData configInfo;
+
+ parser.Parse(&buffer,
+ ElementParserPtr(
+ new RootParser<WidgetParser>(configInfo,
+ DPL::FromUTF32String(
+ L"widget"))));
+
+ // Check widget id
+ widgetGUID = configInfo.widget_id;
+
+ if (widgetGUID.IsNull()) {
+ LogDebug("Installed widget has no GUID");
+ return WidgetUpdateInfo();
+ }
- LogDebug("Installed widget GUID: " << *widgetGUID);
+ LogDebug("Installed widget GUID: " << *widgetGUID);
- // Locate widget ID with this GUID
- // Incoming widget version
- OptionalWidgetVersion widgetVersion;
- if (!configInfo.version.IsNull()) {
- widgetVersion =
- DPL::Optional<WidgetVersion>(
- WidgetVersion(*configInfo.version));
+ // Locate widget ID with this GUID
+ // Incoming widget version
+ if (!configInfo.version.IsNull()) {
+ widgetVersion =
+ DPL::Optional<WidgetVersion>(
+ WidgetVersion(*configInfo.version));
+ }
}
try
WidgetUpdateInfo::ExistingWidgetInfo(
dao.getHandle(), dao.getVersion()));
}
- Catch(WidgetDAO::Exception::WidgetNotExist){
+ Catch(WidgetDAOReadOnly::Exception::WidgetNotExist){
// GUID isn't installed
return WidgetUpdateInfo(
widgetGUID,
DPL::Optional<WidgetHandle> handle = getNewWidgetHandle();
Assert(!!handle);
- WidgetDAO dao(*handle);
+ WidgetDAOReadOnly dao(*handle);
std::ostringstream out;
WidgetLocalizedInfo localizedInfo =
}
}
- out << std::endl << "Back Supported: " <<
- (dao.getBackSupported() ? "YES" : "NO");
-
out << std::endl;
LogInfo(out.str());
}
+
} //namespace WidgetInstall
} //namespace Jobs
Ok, Failed, Deferred
};
- ConfigureResult ConfigureInstallation(const std::string &widgetPath);
- WidgetUpdateInfo detectWidgetUpdate(const std::string &widgetPath);
+ ConfigureResult ConfigureInstallation(const std::string &widgetSource,
+ bool fromBrowser);
+ WidgetUpdateInfo detectWidgetUpdate(const std::string &widgetSource,
+ bool fromBrowser);
WidgetUpdateMode::Type CalcWidgetUpdatePolicy(
const OptionalWidgetVersion &existingVersion,
const OptionalWidgetVersion &incomingVersion) const;
*/
JobWidgetInstall(std::string const & widgetPath,
const WidgetInstallationStruct &installerStruct);
+ /**
+ * @brief Automaticaly sets installation process from browser
+ */
+ JobWidgetInstall(std::string const & widgetUrl,
+ std::string const & iconPath,
+ const WidgetInstallationStruct &installerStruct);
DPL::Optional<WidgetHandle> getNewWidgetHandle() const;
- bool getUnzipStartedFlag() const;
- bool getUnzipFinishedFlag() const;
//overrides
void SendProgress();
* @brief Implementation file for installer task ace check
*/
+#include <utility>
+
#include <widget_install/task_ace_check.h>
#include <dpl/assert.h>
+#include <dpl/log/log.h>
+#include <ace-dao-rw/AceDAO.h>
+#include <dpl/foreach.h>
#include <widget_install/widget_install_context.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/job_widget_install.h>
#include <security_controller.h>
-#include <dpl/ace/PolicyResult.h>
-#include <dpl/ace/Request.h>
+#include <ace/PolicyResult.h>
+#include <ace/Request.h>
+#include <dpl/wrt-dao-rw/widget_dao.h>
namespace Jobs {
namespace WidgetInstall {
+
TaskAceCheck::TaskAceCheck(InstallerContext& context) :
DPL::TaskDecl<TaskAceCheck>(this),
m_context(context)
Assert(!!m_context.widgetHandle);
m_context.featureLogic =
FeatureLogicPtr(new FeatureLogic(*m_context.widgetHandle));
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_ACE_PREPARE,
+ "Widget Access Control Check Prepared");
}
void TaskAceCheck::StepAceCheck()
// No device caps left to process
if (m_context.featureLogic->isDone()) {
LogInfo("All responses has been received from ACE.");
+
+ // Saving static dev cap permissions
+ FOREACH (cap, m_context.staticPermittedDevCaps) {
+ LogInfo("staticPermittedDevCaps : " << cap->first
+ << " smack: " << cap->second);
+ }
+
+ AceDB::AceDAO::setRequestedDevCaps(
+ *(m_context.widgetHandle),
+ m_context.staticPermittedDevCaps);
+
return;
}
ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
"Some deviceCap was not accepted by ACE.");
}
+ LogInfo("Updating \"feature reject status\" in database!");
+ auto it = m_context.featureLogic->resultBegin();
+ auto end = m_context.featureLogic->resultEnd();
+ for(;it != end; ++it){
+ LogInfo(" |- Feature: " << it->name << " has reject status: " << it->rejected);
+ if (it->rejected) {
+ WrtDB::WidgetDAO dao(*(m_context.widgetHandle));
+ dao.updateFeatureRejectStatus(*it);
+ }
+ }
LogInfo("Installation continues...");
+
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_ACE_CHECK,
+ "Widget Access Control Check Finished");
}
void TaskAceCheck::ProcessAceResponse(PolicyResult policyResult)
DPL::String deviceCap = m_context.featureLogic->getDevice();
- if (policyResult == PolicyEffect::PERMIT)
- m_context.staticPermittedDevCaps.insert(deviceCap);
+ LogInfo("DevCap is : " << deviceCap);
+ LogInfo("PolicyResult is : " <<
+ PolicyResult::serialize(policyResult));
+ m_context.staticPermittedDevCaps.insert(std::make_pair(deviceCap,
+ policyResult == PolicyEffect::PERMIT));
m_context.featureLogic->setAceResponse(policyResult != PolicyEffect::DENY);
m_context.job->Resume();
#include <dpl/task.h>
#include <dpl/event/inter_context_delegate.h>
-#include <dpl/ace/PolicyResult.h>
+#include <ace/PolicyResult.h>
class InstallerContext;
}
LogInfo("================ Step: <<CSignature>> DONE ================");
+
+ m_contextData.job->UpdateProgress(
+ InstallerContext::INSTALL_DIGSIG_CHECK,
+ "Widget Signature checked");
}
void TaskCertify::stepWarningPopup()
void TaskCertify::stepFinalize()
{
LogInfo("Step: <<CERTYFYING DONE>>");
+
+ m_contextData.job->UpdateProgress(
+ InstallerContext::INSTALL_CERT_CHECK,
+ "Widget Certification Check Finished");
}
void TaskCertify::onWarningPopupAnswer(const DPL::Popup::AnswerCallbackData& answer)
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file task_commons.cpp
+ * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
+ * @version 1.0
+ */
+
+#include "task_commons.h"
+#include <unistd.h>
+#include <sstream>
+#include <ftw.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/log/log.h>
+#include <dpl/exception.h>
+#include <dpl/errno_string.h>
+#include <dpl/utils/file_utils.h>
+
+namespace Jobs {
+namespace WidgetInstall {
+
+namespace {
+
+const char * const TEMPORARY_PATH_POSTFIX = "temp";
+const mode_t TEMPORARY_PATH_MODE = 0775;
+
+int lambdaDeleteFile(const char *fpath,
+ const struct stat* /*sb*/,
+ int tflag,
+ struct FTW* /*ftwbuf*/)
+{
+ switch (tflag) {
+ case FTW_D:
+ case FTW_DNR:
+ case FTW_DP:
+ LogInfo("Removing old temporary directory" << fpath);
+ return rmdir(fpath);
+ break;
+ default:
+ LogInfo("Unlinking old temporary file" << fpath);
+ return unlink(fpath);
+ break;
+ }
+ return 0;
+}
+
+} // namespace
+
+void removeTemporaryDir(const std::string& dir)
+{
+ LogError("[GenerateConfig Task] Aborting... (removing temporary dir: " <<
+ dir << " )");
+
+ static const int maxDepth = 1024;
+ struct stat fileInfo;
+ if (stat(dir.c_str(), &fileInfo) == 0) {
+ nftw(dir.c_str(), lambdaDeleteFile, maxDepth, FTW_DEPTH);
+ }
+}
+
+std::string createTempPath()
+{
+ LogInfo("Step: Creating temporary path");
+
+ // Temporary path
+ std::ostringstream tempPathBuilder;
+
+ tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+ tempPathBuilder << "/";
+ tempPathBuilder << "widget";
+ tempPathBuilder << "/";
+ tempPathBuilder << TEMPORARY_PATH_POSTFIX;
+ tempPathBuilder << "_";
+
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ tempPathBuilder <<
+ (static_cast<unsigned long long>(tv.tv_sec) * 1000000ULL +
+ static_cast<unsigned long long>(tv.tv_usec));
+
+ std::string tempPath = tempPathBuilder.str();
+
+ // Remove old path if any
+ struct stat fileInfo;
+
+ // FIXME: what if there are more then maxDepth recursive directories
+ static const int maxDepth = 1024;
+ if (stat(tempPath.c_str(), &fileInfo) == 0) {
+ int error = nftw(
+ tempPath.c_str(), lambdaDeleteFile, maxDepth, FTW_DEPTH);
+
+ if (error == -1) {
+ ThrowMsg(DPL::CommonException::InternalError,
+ DPL::GetErrnoString());
+ }
+ }
+ // Create new path
+ FileUtils::MakePath(tempPath, TEMPORARY_PATH_MODE);
+
+ return tempPath;
+}
+
+void createTempPath(const std::string& path)
+{
+ FileUtils::MakePath(path, TEMPORARY_PATH_MODE);
+}
+
+} // WidgetInstall
+} // Jobs
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file task_commons.h
+ * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
+ * @version 1.0
+ */
+
+#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_
+#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_
+
+#include <string>
+
+namespace Jobs {
+namespace WidgetInstall {
+
+void removeTemporaryDir(const std::string& path);
+
+std::string createTempPath();
+
+void createTempPath(const std::string& path);
+
+} // WidgetInstall
+} // Jobs
+
+
+#endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_ */
#include <dpl/wrt-dao-ro/config_parser_data.h>
#include <dpl/utils/wrt_utility.h>
#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/ace-dao-rw/AceDAO.h>
-#include <string>
+#include <ace-dao-rw/AceDAO.h>
+#include <dpl/foreach.h>
+#include <dpl/log/log.h>
#include <dpl/assert.h>
#include <dpl/wrt-dao-ro/global_config.h>
+#include <string>
//#include <widget_controller.h>
#include <Ecore_File.h>
#include <sstream>
widgetSrcPath += GlobalConfig::GetWidgetSrcPath();
_WrtMakeDir(widgetSrcPath.c_str(), 0755, WRT_FILEUTILS_RECUR);
+
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_DIR_CREATE,
+ "Widget Directory Created");
}
void TaskDbUpdate::StepDbUpdate()
m_context.wacSecurity,
GetUserAgentLanguageTags());
- AceDB::AceDAO::setStaticDevCapPermissions(
+ FOREACH (cap, m_context.staticPermittedDevCaps) {
+ LogInfo("staticPermittedDevCaps : " << cap->first
+ << " smack status: " << cap->second);
+ }
+
+ AceDB::AceDAO::setRequestedDevCaps(
*(m_context.widgetHandle),
m_context.staticPermittedDevCaps);
Assert(!!m_context.widgetHandle);
WidgetDAO dao(*m_context.widgetHandle);
LanguageTagsList languageTags(dao.getLanguageTags());
+ bool defaultNameSaved = false;
+ auto generateWidgetName = [&] (const DPL::OptionalString& tag,
+ const DPL::OptionalString& language)
+ {
+ DPL::OptionalString name = dao.getLocalizedInfo(*language).name;
+ if (!!name) {
+ if (!!tag)
+ {
+ saveLocalizedKey(file, L"Name", *tag);
+ }
+ else
+ {
+ file << "Name=";
+ defaultNameSaved = true;
+ }
+ file << *name;
+ file << std::endl;
+ }
+ };
+
FOREACH(i, languageTags)
{
DPL::OptionalString tag = getLangTag(*i);// translate en -> en_US etc
if (tag.IsNull()) { tag = *i; }
- saveLocalizedKey(file, L"Name", *tag);
+ generateWidgetName(tag, *i);
- DPL::OptionalString name = dao.getLocalizedInfo(*i).name;
- if (!!name) {
- file << *name;
- } else {
- file << "Widget " << *m_context.widgetHandle;
- }
- file << std::endl;
+ }
+ DPL::OptionalString defaultLocale = dao.getDefaultlocale();
+ if (!!defaultLocale && !defaultNameSaved)
+ {
+ generateWidgetName(DPL::OptionalString::Null, *defaultLocale);
}
}
void TaskDesktopFile::saveWidgetIcons(std::ofstream &file)
{
+ DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
+ if (pkgname.IsNull()) {
+ ThrowMsg(Exceptions::InternalError, "No Package name exists.");
+ }
+
//TODO this file will need to be updated when user locale preferences
//changes.
Assert(!!m_context.widgetHandle);
WidgetDAO::WidgetIconList list = dao.getIconList();
LanguageTagsList languageTags(dao.getLanguageTags());
- FOREACH(it, locList)
- {
- DPL::String i = it->widgetLocale;
- DPL::OptionalString tag = getLangTag(i); // translate en -> en_US etc
- if (tag.IsNull()) { tag = i; }
+ bool defaultIconSaved = false;
- saveLocalizedKey(file, L"Icon", *tag);
+
+ auto generateWidgetIcon = [&] (const DPL::OptionalString& tag,
+ const DPL::String& language,
+ int iconId)
+ {
+ if (!!tag)
+ {
+ saveLocalizedKey(file, L"Icon", *tag);
+ }
+ else
+ {
+ file << "Icon=";
+ defaultIconSaved = true;
+ }
DPL::OptionalString src;
FOREACH(icon, list)
{
- if (icon->iconId == it->iconId) {
+ if (icon->iconId == iconId) {
src = icon->iconSrc;
}
}
if (!!src) {
//If menuscreen need use absolute path of widget's icon, comment out
//the following lines.
- //file << GlobalConfig::GetUserInstalledWidgetPath() << "/";
- //file << WRT_WIDGET_PKGNAME_PREFIX << m_context.widgetHandle
- // << "/";
- //file << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
- file << getIconTargetFilename(i) << std::endl;
+
+ file << GlobalConfig::GetUserInstalledWidgetPath() << "/";
+ file << pkgname << "/";
+ file << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
+ file << getIconTargetFilename(language) << std::endl;
+ }
+ };
+
+ FOREACH(it, locList)
+ {
+ DPL::String i = it->widgetLocale;
+ DPL::OptionalString tag = getLangTag(i); // translate en -> en_US etc
+ if (tag.IsNull()) { tag = i; }
+
+ generateWidgetIcon(tag, i, it->iconId);
+
+ }
+ DPL::OptionalString defaultLocale = dao.getDefaultlocale();
+ if (!!defaultLocale && !defaultIconSaved)
+ {
+ int iconId = -1;
+ FOREACH(it, locList)
+ {
+ if (it->widgetLocale == *defaultLocale)
+ {
+ iconId = it->iconId;
+ }
+ }
+ if (-1 != iconId)
+ {
+ generateWidgetIcon(DPL::OptionalString::Null,
+ DPL::String(),
+ iconId);
}
}
}
//file << "BG_SCHEDULE=True" << std::endl;
/* visible */
- file << "Visible=True" << std::endl;
+ file << "nodisplay=FALSE" << std::endl;
- file << "X-SLP-BaseLayoutWidth=720" << std::endl;
- file << "X-SLP-BaseLayoutHeight=1280" << std::endl;
- file << "X-SLP-IsHorizontalScale=True" << std::endl;
- file << "X-SLP-PackageType=wgt" << std::endl;
+ file << "X-TIZEN-PackageType=wgt" << std::endl;
if (!widgetID.IsNull()) {
- file << "X-SLP-PackageID=" << DPL::ToUTF8String(*widgetID).c_str() << std::endl;
+ file << "X-TIZEN-PackageID=" << DPL::ToUTF8String(*widgetID).c_str() << std::endl;
}
}
return;
}
- // X-SLP-SVC=operation:scheme:mime;
- file << "X-SLP-SVC=";
+ // x-tizen-svc=http://tizen.org/appsvc/operation/pick|NULL|image;
+ file << "X-TIZEN-SVC=";
FOREACH(it, appServiceList) {
- file << DPL::ToUTF8String(it->operation).c_str() << ":";
+ if (appServiceList.begin() != it) {
+ file << ";";
+ }
+ file << DPL::ToUTF8String(it->operation).c_str() << "|";
if (it->scheme.empty()) {
- file << "NULL" << ":";
+ file << "NULL" << "|";
} else {
- file << DPL::ToUTF8String(it->scheme).c_str() << ":";
+ file << DPL::ToUTF8String(it->scheme).c_str() << "|";
}
if (it->mime.empty()) {
- file << "NULL" << ";";
+ file << "NULL";
} else {
- file << DPL::ToUTF8String(it->mime).c_str() << ";";
+ file << DPL::ToUTF8String(it->mime).c_str();
}
}
}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file task_parental_mode.cpp
- * @author Janusz Majnert (j.majnert@samsung.com)
- * @version 1.0
- * @brief Implementation for parental mode check installer task
- */
-#include <widget_install/task_parental_mode.h>
-#include <widget_install/widget_install_errors.h>
-#include <widget_install/widget_install_context.h>
-#include <dpl/wrt-dao-ro/global_config.h>
-#include <dpl/log/log.h>
-
-namespace Jobs {
-namespace WidgetInstall {
-TaskParentalMode::TaskParentalMode(InstallerContext &installerContext) :
- DPL::TaskDecl<TaskParentalMode>(this),
- m_installerContext(installerContext)
-{
- AddStep(&TaskParentalMode::StepCheckParentalMode);
-}
-
-TaskParentalMode::~TaskParentalMode()
-{
- //Nothing to do for now
-}
-
-void TaskParentalMode::StepCheckParentalMode()
-{
- LogInfo("Step: Checking parental mode status");
-
- using namespace WrtDB;
- if (GlobalDAOReadOnly::GetParentalMode()) {
- Throw(Exceptions::ParentalModeActive);
- }
-}
-} //namespace WidgetInstall
-} //namespace Jobs
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file task_generate_config.cpp
+ * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
+ * @version 1.0
+ */
+
+#include "task_prepare_files.h"
+#include <memory>
+#include <string>
+#include <dpl/file_output.h>
+#include <dpl/file_input.h>
+#include <dpl/copy.h>
+#include <dpl/log/log.h>
+#include <dpl/wrt-dao-ro/feature_dao_read_only.h>
+#include <dpl/binary_queue.h> // config.xml logging only
+#include <dpl/foreach.h>
+#include <widget_install/widget_install_context.h>
+#include <widget_install_errors.h>
+#include <task_commons.h>
+#include <config_generator/config_generator.h>
+
+namespace Jobs {
+namespace WidgetInstall {
+
+namespace {
+
+const std::string TIZEN_KEYWORD = "tizen";
+const char* BACKKEY = "backbutton-presence";
+const char* ENABLE = "enable";
+const char* DISABLE = "disable";
+const char* ROTATION = "rotation-lock";
+const char* LANDSCAPE = "landscape";
+const char* PORTRAIT = "portrait";
+const char* INDICATOR = "indicator-presence";
+
+const char* VIEWMODES[] = {
+ "windowed ",
+ "floating ",
+ "fullscreen ",
+ "maximized ",
+ "minimized "};
+
+} // namespace
+
+TaskPrepareFiles::TaskPrepareFiles(InstallerContext &installerContext) :
+ DPL::TaskDecl<TaskPrepareFiles>(this),
+ m_installerContext(installerContext)
+{
+ // Install steps
+ AddStep(&TaskPrepareFiles::StepShowPopup);
+ AddStep(&TaskPrepareFiles::StepCreateTempPath);
+ AddStep(&TaskPrepareFiles::StepCopyIcon);
+ AddStep(&TaskPrepareFiles::StepCreateConfig);
+
+ AddAbortStep(&TaskPrepareFiles::StepAbort);
+}
+
+void TaskPrepareFiles::StepCreateTempPath()
+{
+ m_installerContext.tempWidgetPath = createTempPath();
+}
+
+void TaskPrepareFiles::StepCopyIcon()
+{
+ if(m_installerContext.iconPath.empty()) {
+ LogWarning("No icon specified");
+ return;
+ }
+
+ DPL::String path = DPL::FromUTF8String(m_installerContext.iconPath);
+ std::string filename = m_installerContext.iconPath;
+ size_t last = m_installerContext.iconPath.find_last_of( "\\/" );
+ if(last != std::string::npos) {
+ filename = m_installerContext.iconPath.substr( last+1 );
+ }
+ std::string target = m_installerContext.tempWidgetPath + '/' + filename;
+ LogDebug("source " << m_installerContext.iconPath << "#");
+ LogDebug("target " << target);
+
+ Try
+ {
+ DPL::FileInput input(m_installerContext.iconPath);
+ DPL::FileOutput output(target);
+ DPL::Copy(&input, &output);
+ m_installerContext.iconPath = target;
+ }
+ Catch(DPL::FileInput::Exception::Base)
+ {
+ LogError("File input error");
+ // Error while opening or closing source file
+ ReThrowMsg(Exceptions::CopyIconFailed, m_installerContext.iconPath);
+ }
+ Catch(DPL::FileOutput::Exception::Base)
+ {
+ LogError("File output error");
+ // Error while opening or closing target file
+ ReThrowMsg(Exceptions::CopyIconFailed, target);
+ }
+ Catch(DPL::CopyFailed)
+ {
+ LogError("File copy error");
+ // Error while copying
+ ReThrowMsg(Exceptions::CopyIconFailed, target);
+ }
+}
+
+void TaskPrepareFiles::StepShowPopup()
+{
+ LogError("Not implemented");
+ /*
+ * TODO show configuration popup, store results in installer context or
+ * abort. The icon path is stored in m_installerContext.iconPath. It should
+ * be updated if necessary.
+ */
+
+ // TODO get user options from popup
+ m_enableIndicator = true;
+ m_backKey = false;
+ (void)m_portrait;
+ m_viewModes.push_back(FULLSCREEN);
+ m_viewModes.push_back(WINDOWED);
+ m_viewModes.push_back(FLOATING);
+ m_viewModes.unique();
+}
+
+
+void TaskPrepareFiles::StepCreateConfig()
+{
+ LogInfo("creating config.xml...");
+
+ Try
+ {
+ // create document
+ ConfigXml::DocumentPtr doc = ConfigXml::Document::Create();
+
+ // setup view modes
+ std::string modes;
+ FOREACH(it, m_viewModes) {
+ modes += VIEWMODES[*it];
+ }
+
+ ConfigXml::ElementPtr root = doc->Add<ConfigXml::WIDGET>(
+ m_installerContext.widgetSource.c_str(),
+ modes.c_str());
+
+ // access to all sites
+ root->Add<ConfigXml::ACCESS>("*");
+
+ // add features
+ {
+ using namespace WrtDB;
+ FeatureHandleList features = FeatureDAOReadOnly::GetHandleList();
+ FOREACH(it, features) {
+ FeatureDAOReadOnly feature(*it);
+ std::string name = feature.GetName();
+ // tizen only
+ if (std::string::npos != name.find(TIZEN_KEYWORD)) {
+ root->Add<ConfigXml::FEATURE>(name.c_str(), false);
+ }
+ }
+ }
+
+ // add settings
+ if (!!m_enableIndicator) {
+ root->Add<ConfigXml::TIZEN_SETTING>(
+ INDICATOR,
+ (*m_enableIndicator ? ENABLE : DISABLE));
+ }
+ if (!!m_backKey) {
+ root->Add<ConfigXml::TIZEN_SETTING>(
+ BACKKEY,
+ (*m_backKey ? ENABLE : DISABLE));
+ }
+ if (!!m_portrait) {
+ root->Add<ConfigXml::TIZEN_SETTING>(
+ ROTATION,
+ (*m_portrait ? PORTRAIT : LANDSCAPE));
+ }
+
+ DPL::BinaryQueue bq;
+ doc->Write(bq);
+
+ std::unique_ptr<char[]> buffer(new char[bq.Size()]);
+
+ bq.FlattenConsume(buffer.get(),bq.Size());
+ LogInfo("Generated XML:\n\n" << buffer.get());
+
+ std::string configPath =
+ m_installerContext.tempWidgetPath + "/config.xml";
+
+ DPL::FileOutput fo(configPath);
+ doc->Write(fo);
+ fo.Close();
+
+ // Done
+ LogInfo("Config xml created");
+ }
+ Catch(ConfigXml::Base)
+ {
+ LogError("Config xml creation failed");
+ ReThrowMsg(ConfigXml::Base, m_installerContext.widgetSource);
+ }
+}
+
+void TaskPrepareFiles::StepAbort()
+{
+ removeTemporaryDir(m_installerContext.tempWidgetPath);
+}
+
+} // namespace WidgetInstall
+} // namespace Jobs
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @file task_parental_mode.h
- * @author Janusz Majnert (j.majnert@samsung.com)
- * @version 1.0
- * @brief Implementation for parental mode check installer task
+/*
+ * @file task_prepare_files.h
+ * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
+ * @version 1.0
*/
-#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_PARENTAL_MODE_H
-#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_PARENTAL_MODE_H
+
+#ifndef SRC_JOBS_WIDGET_INSTALL_TASK_PREPARE_FILES_H_
+#define SRC_JOBS_WIDGET_INSTALL_TASK_PREPARE_FILES_H_
#include <dpl/task.h>
+#include <list>
+#include <dpl/optional_typedefs.h>
+#include <view_mode.h>
class InstallerContext;
namespace Jobs {
namespace WidgetInstall {
-class TaskParentalMode :
- public DPL::TaskDecl<TaskParentalMode>
+
+class TaskPrepareFiles : public DPL::TaskDecl<TaskPrepareFiles>
{
- private:
+private:
// Installation context
InstallerContext &m_installerContext;
+ DPL::OptionalBool m_enableIndicator;
+ DPL::OptionalBool m_backKey;
+ DPL::OptionalBool m_portrait;
+ std::list<ViewMode> m_viewModes;
+ // TODO anything else?
// Steps
- void StepCheckParentalMode();
+ void StepCreateTempPath();
+ void StepCopyIcon();
+ void StepShowPopup();
+ void StepCreateConfig();
+ void StepAbort();
public:
- explicit TaskParentalMode(InstallerContext &installerContext);
- virtual ~TaskParentalMode();
+ explicit TaskPrepareFiles(InstallerContext &installerContext);
};
-} //namespace WidgetInstall
-} //namespace Jobs
-#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_PARENTAL_MODE_H
+} // namespace WidgetInstall
+} // namespace Jobs
+#endif /* SRC_JOBS_WIDGET_INSTALL_TASK_PREPARE_FILES_H_ */
#ifdef WRT_SMACK_ENABLED
std::stringstream devcaps;
FOREACH(it, m_context.staticPermittedDevCaps) {
- std::string utf8 = DPL::ToUTF8String(*it);
- if (it != m_context.staticPermittedDevCaps.begin())
- devcaps << ",";
- devcaps << utf8;
+ if (it->second) {
+ std::string utf8 = DPL::ToUTF8String(it->first);
+ if (it != m_context.staticPermittedDevCaps.begin())
+ devcaps << ",";
+ devcaps << utf8;
+ }
}
DPL::OptionalString pkgName = m_context.widgetConfig.Pkgname;
Assert(!pkgName.IsNull() && "widget doesn't have a pkg name");
devcaps.str().c_str(),
OPERATION_INSTALL);
Assert(result==PC_OPERATION_SUCCESS && "access control setup failed");
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_SMACK_ENABLE,
+ "Widget SMACK Enabled");
#endif
}
#include <dpl/task.h>
#include <dpl/event/inter_context_delegate.h>
-#include <dpl/ace/PolicyResult.h>
+#include <ace/PolicyResult.h>
class InstallerContext;
#include <widget_install/task_unzip.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/widget_install_context.h>
-#include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/log/log.h>
#include <dpl/copy.h>
#include <dpl/file_output.h>
#include <dpl/abstract_waitable_input_adapter.h>
-#include <dpl/errno_string.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <ftw.h>
-#include <dpl/utils/file_utils.h>
+#include <task_commons.h>
-using namespace WrtDB;
-
-namespace // anonymous
-{
-const char * const TEMPORARY_PATH_POSTFIX = "temp";
-const mode_t TEMPORARY_PATH_MODE = 0775;
+namespace {
struct PathAndFilePair
{
filePath.substr(position + 1));
}
-static int lambdaDeleteFile(const char *fpath,
- const struct stat *sb,
- int tflag,
- struct FTW *ftwbuf)
-{
- (void)sb;
- (void)ftwbuf;
-
- switch (tflag) {
- case FTW_D:
- case FTW_DNR:
- case FTW_DP:
- LogInfo("Removing old temporary directory" << fpath);
- return rmdir(fpath);
- break;
- default:
- LogInfo("Unlinking old temporary file" << fpath);
- return unlink(fpath);
- break;
- }
-
- return 0;
}
-} // namespace anonymous
namespace Jobs {
namespace WidgetInstall {
void TaskUnzip::StepCreateTempPath()
{
- LogInfo("Step: Creating temporary path");
-
- // Temporary path
- std::ostringstream tempPathBuilder;
-
- tempPathBuilder << GlobalConfig::GetUserInstalledWidgetPath();
- tempPathBuilder << "/";
- tempPathBuilder << "widget";
- tempPathBuilder << "/";
- tempPathBuilder << TEMPORARY_PATH_POSTFIX;
- tempPathBuilder << "_";
-
- timeval tv;
- gettimeofday(&tv, NULL);
- tempPathBuilder <<
- (static_cast<unsigned long long>(tv.tv_sec) * 1000000ULL +
- static_cast<unsigned long long>(tv.tv_usec));
-
- std::string tempPath = tempPathBuilder.str();
-
- // Remove old path if any
- struct stat fileInfo;
-
- // FIXME: what if there are more then maxDepth recursive directories
- static const int maxDepth = 1024;
- if (stat(tempPath.c_str(), &fileInfo) == 0) {
- int error = nftw(
- tempPath.c_str(), lambdaDeleteFile, maxDepth, FTW_DEPTH);
-
- if (error == -1) {
- ThrowMsg(DPL::CommonException::InternalError,
- DPL::GetErrnoString());
- }
- }
- // Create new path
- FileUtils::MakePath(tempPath, TEMPORARY_PATH_MODE);
-
// Step succedded, save temporary widget path
- m_installerContext.tempWidgetPath = tempPath;
- m_installerContext.unzipStarted = true;
+ m_installerContext.tempWidgetPath = createTempPath();
}
void TaskUnzip::StepUnzipPrepare()
Try
{
- m_zip.Reset(new DPL::ZipInput(m_installerContext.widgetFilePath));
+ m_zip.Reset(new DPL::ZipInput(m_installerContext.widgetSource));
LogInfo("Widget package comment: " << m_zip->GetGlobalComment());
// Widget package must not be empty
if (m_zip->empty()) {
- ThrowMsg(Exceptions::ZipEmpty, m_installerContext.widgetFilePath);
+ ThrowMsg(Exceptions::ZipEmpty, m_installerContext.widgetSource);
}
// Set iterator to first file
}
Catch(DPL::ZipInput::Exception::OpenFailed)
{
- ReThrowMsg(Exceptions::OpenZipFailed, m_installerContext.widgetFilePath);
+ ReThrowMsg(Exceptions::OpenZipFailed, m_installerContext.widgetSource);
}
}
LogPedantic("Path to extract: " << newPath);
// Create path in case of it is empty
- FileUtils::MakePath(newPath, TEMPORARY_PATH_MODE);
+ createTempPath(newPath);
} else {
// This is regular file
std::string fileExtractPath =
" : " << pathAndFile.file);
// First, ensure that path exists
- FileUtils::MakePath(pathAndFile.path, TEMPORARY_PATH_MODE);
+ createTempPath(pathAndFile.path);
Try
{
// Unzip finished, close internal structures
m_zip.Reset();
- m_installerContext.unzipFinished = true;
-
// Done
LogInfo("Unzip finished");
}
void TaskUnzip::StepAbort()
{
- LogError("[Unzip Task] Aborting... (removing temporary dir: " <<
- m_installerContext.tempWidgetPath << " )");
-
- static const int maxDepth = 1024;
- struct stat fileInfo;
- if (stat(m_installerContext.tempWidgetPath.c_str(), &fileInfo) == 0) {
- nftw(m_installerContext.tempWidgetPath.c_str(),
- lambdaDeleteFile, maxDepth, FTW_DEPTH);
- }
+ removeTemporaryDir(m_installerContext.tempWidgetPath);
}
} //namespace WidgetInstall
} //namespace Jobs
#include <dpl/foreach.h>
#include <dpl/errno_string.h>
#include <dpl/wrt-dao-rw/feature_dao.h>
+#include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/utils/wrt_utility.h>
#include <root_parser.h>
-#include <powder_parser.h>
#include <widget_parser.h>
#include <parser_runner.h>
#include <libiriwrapper.h>
#include <dpl/utils/file_utils.h>
#include <dpl/utils/mime_type_utils.h>
#include <sys/stat.h>
-#include "wrt_powder_info_util.h"
#include <dpl/utils/wrt_global_settings.h>
namespace { // anonymous
-const char *WIDGET_SCHEMA = "widget";
const WidgetHandle WIDGET_HANDLE_START_VALUE = 1000;
-const char * AGE_RATING = "Age Rating: ";
-const char * CATEGORY = "Category: ";
-const char * LEVEL = "Level: ";
-const char * CONTEXT = "Context: ";
-const DPL::String POWDER_INFO = DPL::FromUTF8String("Powder Info");
-const DPL::String POWDER_PASSWORD = DPL::FromUTF8String(
- "Parental Mode is ON.<br>"
- "Please enter your password");
const DPL::String WIDGET_HEAD = DPL::FromUTF8String("Widget information");
const std::string OK_BUTTON_LABEL = "OK";
const std::string CANCEL_BUTTON_LABEL = "Cancel";
const DPL::String BR = DPL::FromUTF8String("<br>");
const DPL::String DOUBLE_BR = DPL::FromUTF8String("<br><br>");
-const DPL::String POWDER_HEAD = DPL::FromUTF8String("Powder information");
const DPL::String FEATURE_HEAD = DPL::FromUTF8String("Feature information");
+const DPL::String WIDGET_NOT_COMPATIBLE = DPL::FromUTF8String("This widget is "
+ "not compatible with WRT. Do you want install it anyway?");
} // namespace anonymous
namespace Jobs {
AddStep(&TaskWidgetConfig::ReadLocaleFolders);
AddStep(&TaskWidgetConfig::ProcessLocalizedStartFiles);
AddStep(&TaskWidgetConfig::ProcessLocalizedIcons);
- AddStep(&TaskWidgetConfig::StepProcessPowderFile);
AddStep(&TaskWidgetConfig::StepVerifyFeatures);
//in case of tests, no popups are shown
if (GlobalSettings::GetPopupsEnabledFlag()) {
AddStep(&TaskWidgetConfig::StepShowWidgetInfo);
AddStep(&TaskWidgetConfig::StepCancelWidgetInstallation);
+ AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
+ AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion);
}
}
// set property data for hosted start url
// Hosted start url only support TIZEN WebApp
if (m_installContext.widgetConfig.type ==
- APP_TYPE_TIZENWEBAPP)
+ APP_TYPE_TIZENWEBAPP)
{
const char *startPath =
DPL::ToUTF8String(startFileData.path).c_str();
ProcessIcon(ConfigParserData::Icon(L"icon.png"));
ProcessIcon(ConfigParserData::Icon(L"icon.gif"));
ProcessIcon(ConfigParserData::Icon(L"icon.jpg"));
+ ProcessIcon(ConfigParserData::Icon(
+ DPL::FromUTF8String(m_installContext.iconPath)));
FOREACH(i, m_installContext.widgetConfig.configInfo.iconsList)
{
if (m_processedIconSet.count(icon.src) > 0) {
return;
}
-
m_processedIconSet.insert(icon.src);
LocaleSet localesAvailableForIcon;
}
}
-void TaskWidgetConfig::StepProcessPowderFile(void)
-{
- using namespace WrtDB;
- const std::string& path = m_installContext.tempWidgetPath;
- WidgetRegisterInfo* widgetConfiguration =
- &m_installContext.widgetConfig;
-
- LogInfo("Process powder for guid " <<
- widgetConfiguration->guid);
- if (!!widgetConfiguration->guid) {
- LibIri::Wrapper iri(DPL::ToUTF8String(
- *widgetConfiguration->guid).c_str());
- DPL::String widgetHost;
- DPL::String widgetPath;
- if (NULL != iri.m_Iri->host) {
- widgetHost = DPL::FromUTF8String(iri.m_Iri->host);
- }
- if (NULL != iri.m_Iri->path) {
- widgetPath = DPL::FromUTF8String(iri.m_Iri->path);
- }
- PowderParserData parserData(&widgetConfiguration->powderDescription,
- widgetHost, widgetPath);
- ConfigParserData::StringsList& descriptions =
- widgetConfiguration->configInfo.powderDescriptionLinks;
-
- FOREACH(linkIter, descriptions)
- {
- LogInfo("Process powder link: " << *linkIter);
- LibIri::Wrapper link(DPL::ToUTF8String(*linkIter).c_str());
- LogInfo("Parser link" << link);
- if (strcmp(link.m_Iri->scheme, WIDGET_SCHEMA) == 0) {
- if (NULL != link.m_Iri->host) {
- std::ostringstream stream;
- //FIXME: Current libiri library is not able to parse
- // URL: widget:/powder.xml Field host
- // is filed with path
- stream << path << "/" << link.m_Iri->host;
- ParserRunner().Parse(
- stream.str(),
- ElementParserPtr(new
- RootParser<PowderParser>(&parserData,
- DPL::
- FromUTF32String(
- L"powder"))));
- } else {
- ThrowMsg(Exceptions::WidgetConfigFileInvalid,
- "Powder link " << *linkIter << " path empty.");
- }
- } else {
- ThrowMsg(Exceptions::WidgetConfigFileInvalid,
- "Powder link " <<
- *linkIter <<
- " schema not supported.");
- }
- }
- }
-
- //TODO:FIXME make progress valid
- m_installContext.job->UpdateProgress(
- InstallerContext::INSTALL_WIDGET_CONFIG1,
- "Widget Config powder step Finished");
-}
-
void TaskWidgetConfig::AnswerCallback(const DPL::Popup::AnswerCallbackData &answer)
{
LogInfo("Callback called");
}
}
-//TODO this step is not added in constructor
-void TaskWidgetConfig::StepShowPowderPasswordCancel()
+void TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion()
{
if (WRT_POPUP_BUTTON_CANCEL == m_installCancel) {
- ThrowMsg(Exceptions::NotAllowed, "Parental Mode is ON");
+ ThrowMsg(Exceptions::NotAllowed, "WRT version incompatible.");
}
}
CONTROLLER_POST_EVENT(PopupController, event);
}
-DPL::String TaskWidgetConfig::createPowderInfo() const
+void TaskWidgetConfig::PopupMinVersionConfirmationCreate()
{
- WrtDB::Powder::Description &powderDescription =
- m_installContext.widgetConfig.powderDescription;
- std::ostringstream powderInfo;
- if (!!powderDescription.ageRating) {
- powderInfo << AGE_RATING;
- powderInfo << *powderDescription.ageRating;
- powderInfo << BR;
- }
- FOREACH(categoriesIterator, powderDescription.categories) {
- powderInfo << CATEGORY;
- powderInfo << PowderInfoUtilSingleton::Instance().
- getCategoryLabel(categoriesIterator->first);
- powderInfo << BR;
-
- FOREACH(levelIterator, categoriesIterator->second.levels) {
- powderInfo << LEVEL;
- powderInfo << static_cast<int>(levelIterator->level);
- powderInfo << BR;
-
- FOREACH(contextIterator, levelIterator->context) {
- powderInfo << CONTEXT;
- powderInfo << PowderInfoUtilSingleton::Instance().
- getContextLabel(*contextIterator);
- powderInfo << BR;
- }
- }
- }
-
- return DPL::FromUTF8String(powderInfo.str());
+ m_installContext.job->Pause();
+ LogDebug("Creating minVersion confirmation popup.");
+ using namespace DPL::Popup;
+ CtrlPopupPtr popup = PopupControllerSingleton::Instance().CreatePopup();
+ popup->SetTitle(DPL::ToUTF8String(WIDGET_HEAD));
+ popup->Append(new PopupObject::Label(
+ DPL::ToUTF8String(WIDGET_NOT_COMPATIBLE)));
+ popup->Append(new PopupObject::Button(OK_BUTTON_LABEL,
+ WRT_POPUP_BUTTON_OK));
+ popup->Append(new PopupObject::Button(CANCEL_BUTTON_LABEL,
+ WRT_POPUP_BUTTON_CANCEL));
+ ListenForAnswer(popup);
+ ShowPopupEvent event(popup,
+ MakeAnswerCallback(this, &TaskWidgetConfig::AnswerCallback),
+ DPL::Event::UNDEFINED_LOOP_HANDLE);
+ CONTROLLER_POST_EVENT(PopupController, event);
}
void TaskWidgetConfig::StepShowWidgetInfo()
{
- if (!createPowderInfo().empty()) {
- m_popupData.addWidgetInfo(POWDER_HEAD,
- createPowderInfo());
- }
-
if (!m_popupData.widgetInfo.empty()) {
PopupCreate();
m_installContext.job->UpdateProgress(
}
}
-//TODO this step is not added in constructor
-void TaskWidgetConfig::StepShowPowderPassword()
+void TaskWidgetConfig::StepCheckMinVersionInfo()
{
- using namespace WrtDB;
- if (GlobalDAOReadOnly::GetParentalMode()) {
- m_popupData.addWidgetInfo(POWDER_INFO, POWDER_PASSWORD);
+ if (!isWACVersionCompatible(m_installContext.widgetConfig.minVersion)) {
+ PopupMinVersionConfirmationCreate();
+ m_installContext.job->UpdateProgress(
+ InstallerContext::INSTALL_WIDGET_CONFIG2,
+ "Show MinVersion Info Finished");
}
- m_installContext.job->UpdateProgress(
- InstallerContext::INSTALL_WIDGET_CONFIG2,
- "Show Powder Password Finished");
}
void TaskWidgetConfig::StepVerifyFeatures()
ThrowMsg(
Exceptions::WidgetConfigFileInvalid,
- "Widget cannot be installedm equired feature is missing:["
+ "Widget cannot be installed, required feature is missing:["
+
DPL::ToUTF8String(it->name) + "]");
}
return false;
}
+bool TaskWidgetConfig::parseVersionString(const std::string &version,
+ long &majorVersion, long &minorVersion, long µVersion) const
+{
+ std::istringstream inputString(version);
+ inputString >> majorVersion;
+ if (inputString.bad() || inputString.fail()) {
+ LogWarning("Invalid minVersion format.");
+ return false;
+ }
+ inputString.get(); // skip period
+ inputString >> minorVersion;
+ if (inputString.bad() || inputString.fail()) {
+ LogWarning("Invalid minVersion format");
+ return false;
+ } else {
+ inputString.get(); // skip period
+ if (inputString.bad() || inputString.fail()) {
+ inputString >> microVersion;
+ }
+ }
+ return true;
+}
+
+bool TaskWidgetConfig::isWACVersionCompatible(const DPL::OptionalString
+ &widgetVersion) const
+{
+ if (widgetVersion.IsNull() || (*widgetVersion).empty())
+ {
+ LogWarning("minVersion attribute is empty. WRT assumes platform "
+ "supports this widget.");
+ return true;
+ }
+
+ //Parse widget version
+ long majorWidget = 0, minorWidget = 0, microWidget = 0;
+ if (!parseVersionString(DPL::ToUTF8String(*widgetVersion), majorWidget,
+ minorWidget, microWidget)) {
+ LogWarning("Invalid format of widget version string.");
+ return true;
+ }
+
+ //Parse supported version
+ long majorSupported = 0, minorSupported = 0, microSupported = 0;
+ if (!parseVersionString(WrtDB::GlobalConfig::GetWACVersion(),
+ majorSupported, minorSupported, microSupported)) {
+ LogWarning("Invalid format of WAC version string.");
+ return true;
+ }
+
+ if (majorWidget > majorSupported ||
+ minorWidget > minorSupported ||
+ microWidget > microSupported) {
+ LogInfo("Platform doesn't support this widget.");
+ return false;
+ }
+ return true;
+}
+
} //namespace WidgetInstall
} //namespace Jobs
public DPL::Popup::PopupControllerUser
{
private:
- enum PowderInfoButton
+ enum InfoPopupButton
{
WRT_POPUP_BUTTON_OK, WRT_POPUP_BUTTON_CANCEL
};
bool typeForcedInConfig = false);
void ProcessLocalizedIcons();
void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
- void StepProcessPowderFile();
void StepVerifyFeatures();
void StepShowWidgetInfo();
- void StepPowderCancel();
- void StepFeatureCancel();
+ void StepCheckMinVersionInfo();
void StepCancelWidgetInstallation();
- void StepShowPowderPassword();
- void StepShowPowderPasswordCancel();
+ void StepCancelWidgetInstallationAfterMinVersion();
void PopupCreate();
- DPL::String createPowderInfo() const;
+ void PopupMinVersionConfirmationCreate();
void AnswerCallback(const DPL::Popup::AnswerCallbackData& answer);
DPL::String createAuthorWidgetInfo() const;
void setApplicationType();
bool isFeatureAllowed(
WrtDB::AppType appType, DPL::String featureName);
+ bool isWACVersionCompatible(const DPL::OptionalString &widgetVersion) const;
+ /**
+ * @brief Parses version string in format "major.minor.micro anything"
+ * Returns false if format is invalid
+ */
+ bool parseVersionString(const std::string &version, long &majorVersion,
+ long &minorVersion, long µVersion) const;
public:
TaskWidgetConfig(InstallerContext& installTaskContext);
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file view_mode.h
+ * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
+ * @version 1.0
+ */
+
+#ifndef SRC_JOBS_WIDGET_INSTALL_VIEW_MODE_H_
+#define SRC_JOBS_WIDGET_INSTALL_VIEW_MODE_H_
+
+namespace Jobs {
+namespace WidgetInstall {
+
+enum ViewMode
+{
+ WINDOWED = 0,
+ FLOATING,
+ FULLSCREEN,
+ MAXIMIZED,
+ MINIMIZED
+};
+
+} // WidgetInstall
+} // Jobs
+
+#endif /* SRC_JOBS_WIDGET_INSTALL_VIEW_MODE_H_ */
#ifndef INSTALLER_CONTEXT_H
#define INSTALLER_CONTEXT_H
+#include <map>
#include <string>
+#include <dpl/string.h>
#include <dpl/wrt-dao-rw/widget_dao.h>
#include <widget_install/wac_security.h>
#include <feature_logic.h>
#include <widget_install/widget_update_info.h>
+#include <ace-dao-ro/AceDAOReadOnly.h>
namespace Jobs {
namespace WidgetInstall {
INSTALL_WIDGET_CONFIG3,
INSTALL_WIDGET_CONFIG4,
INSTALL_WIDGET_CONFIG5,
+ INSTALL_DIGSIG_CHECK,
+ INSTALL_CERT_CHECK,
INSTALL_DB_UPDATE,
+ INSTALL_DIR_CREATE,
INSTALL_RENAME_PATH,
+ INSTALL_ACE_PREPARE,
+ INSTALL_ACE_CHECK,
+ INSTALL_SMACK_ENABLE,
+ INSTALL_COPY_ICONFILE,
INSTALL_CREATE_DESKTOP,
INSTALL_CREATE_EXECFILE,
- INSTALL_COPY_ICONFILE,
INSTALL_CREATE_PRIVATE_STORAGE,
INSTALL_END
} InstallStep;
// Installation state variables
- std::string widgetFilePath; ///< Source widget zip file
+ std::string widgetSource; ///< Source widget zip file/widget url
std::string tempWidgetPath; ///< Unpacked widget temporary path
WrtDB::WidgetRegisterInfo widgetConfig; ///< WidgetConfigInfo
DPL::Optional<WrtDB::DbWidgetHandle> widgetHandle;
Jobs::WidgetInstall::WacSecurity wacSecurity;///< Widget Domain information.
- bool unzipStarted;
- ///< flag that indicates whether installer starts to unzip .wgt file
- bool unzipFinished;
- ///< flag that indicates whether installer finishes to unzip completely.
InstallStep installStep; ///< current step of installation
Jobs::WidgetInstall::JobWidgetInstall *job;
///< pointer of instance of JobWidgetInstall
WidgetUpdateInfo::ExistingWidgetInfo existingWidgetInfo;
///< Whether this is an update or normal installation
Jobs::WidgetInstall::FeatureLogicPtr featureLogic;
- /** List of dev-caps that get "static" permission (will always
- * have PERMIT from ACE Policy). They will therefore receive
+ /** List of dev-caps that are requested in widget config file.
+ * Additional flag tells whether dev cap gets "static" permission
+ * (will always have PERMIT from ACE Policy). They will therefore receive
* static SMACK permission. (They may be forbidden because
* of ACE User Settings, but for now we do not protect this
* case with SMACK). */
- std::set<DPL::String> staticPermittedDevCaps;
+ AceDB::RequestedDevCapsMap staticPermittedDevCaps;
+ ///< Optional path to downloaded widget icon
+ std::string iconPath;
};
#endif // INSTALLER_CONTEXT_H
ErrorInvalidPackage, ///< Widget signature is invalid.
ErrorAlreadyInstalled, ///< ?
ErrorInternal, ///< ?
- ErrorParentalMode, ///< Widget cannot be installed when parental mode is active
ErrorNotAllowed, ///< Widget installation or update not allowed
///< because violation of policy ocurred
ErrorDeferred, ///< Widget installation was deferred and will be continued when possible
// PREPARE
DECLARE_JOB_EXCEPTION(Base, NotAllowed, ErrorNotAllowed)
DECLARE_JOB_EXCEPTION(Base, Deferred, ErrorDeferred)
-
-//PARENTAL MODE
-DECLARE_JOB_EXCEPTION(Base, ParentalModeActive, ErrorParentalMode)
+DECLARE_JOB_EXCEPTION(Base, InvalidWidgetUrl, ErrorInvalidWidgetPackage)
//UNZIP
DECLARE_JOB_EXCEPTION(Base, OpenZipFailed, ErrorInvalidWidgetPackage)
//WCONFIG
DECLARE_JOB_EXCEPTION(Base, WidgetConfigFileInvalid, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, WidgetPowderFileInvalid, ErrorInvalidWidgetPackage)
DECLARE_JOB_EXCEPTION(Base, NotInstalled, ErrorInvalidWidgetPackage)
DECLARE_JOB_EXCEPTION(Base, InstallationFailed, ErrorInvalidWidgetPackage)
DECLARE_JOB_EXCEPTION(Base, AlreadyInstalled, ErrorAlreadyInstalled)
} catch (WrtDB::WidgetDAOReadOnly::Exception) {
Assert(false && "can't access widget data");
}
+
+ m_context.job->UpdateProgress(
+ UninstallerContext::INSTALL_SMACK_UNENABLE,
+ "Widget SMACK Enabled");
#endif
}
{
UNINSTALL_START,
UNINSTALL_CHECK,
- UNINSTALL_DB_UPDATE,
UNINSTALL_REMOVE_PREPARE,
UNINSTALL_REMOVE_ONEFILE,
UNINSTALL_REMOVE_DIRECTORIES,
- UNINSTALL_REMOVE_FINISHED,
UNINSTALL_REMOVE_DESKTOP,
+ UNINSTALL_REMOVE_FINISHED,
+ UNINSTALL_DB_UPDATE,
UNINSTALL_END
};
{
m_installerLogic.Terminate();
}
+
+void InstallerController::OnEventReceived(
+ const InstallerControllerEvents::InstallWidgetFromBrowserEvent &event)
+{
+ std::string url = event.GetArg0();
+ std::string icon = event.GetArg1();
+ WidgetInstallationStruct installerStruct = event.GetArg2();
+ Jobs::JobHandle handle = m_installerLogic.InstallWidgetFromBrowser(
+ url,
+ icon,
+ installerStruct);
+
+ //TODO return handle to API
+ (void)handle;
+}
DECLARE_GENERIC_EVENT_0(InitializeEvent)
DECLARE_GENERIC_EVENT_0(TerminateEvent)
+/**
+ * @brief Event for initiating from web widget installation. This event
+ * contains widget url and optionally widget icon url.
+ */
+DECLARE_GENERIC_EVENT_3(InstallWidgetFromBrowserEvent,
+ std::string,
+ std::string,
+ WidgetInstallationStruct)
+
} // namespace InstallerEvents
/**
InstallerControllerEvents::NextStepEvent,
InstallerControllerEvents::InstallDeferredWidgetPackagesEvent,
InstallerControllerEvents::InitializeEvent,
- InstallerControllerEvents::TerminateEvent>::Type
+ InstallerControllerEvents::TerminateEvent,
+ InstallerControllerEvents::InstallWidgetFromBrowserEvent>::Type
InstallerControllerEventsSet;
class InstallerController : public DPL::Event::Controller<InstallerControllerEventsSet>
virtual void OnEventReceived(
const InstallerControllerEvents::TerminateEvent &event);
+ virtual void OnEventReceived(
+ const InstallerControllerEvents::InstallWidgetFromBrowserEvent &event);
+
private:
// Embedded logic
InstallerLogic m_installerLogic;
#include <installer_controller.h>
#include <dpl/string.h>
#include <dpl/foreach.h>
-//#include <plugin_logic.h>
#include <dpl/wrt-dao-rw/feature_dao.h>
#include <dpl/wrt-dao-rw/plugin_dao.h>
#include <dpl/wrt-dao-ro/global_config.h>
return AddAndStartJob(job);
}
+Jobs::JobHandle InstallerLogic::InstallWidgetFromBrowser(
+ std::string const & url,
+ std::string const & icon,
+ const WidgetInstallationStruct &installerStruct)
+{
+ LogDebug("New Widget Installation:");
+
+ Jobs::Job *job = new Jobs::WidgetInstall::JobWidgetInstall(
+ url,
+ icon,
+ installerStruct);
+
+ return AddAndStartJob(job);
+}
+
#define TRANSLATE_JOB_EXCEPTION() \
_rethrown_exception.getParam()
#define TRANSLATE_JOB_MESSAGE() \
Try {
bool stepSucceded = job->NextStep();
- if (stepSucceded) {
- job->SendProgress();
+ job->SendProgress();
+ if (stepSucceded) {
return !job->IsPaused();
}
Jobs::JobHandle InstallPlugin(std::string const & pluginPath,
const PluginInstallerStruct &installerStruct);
+ Jobs::JobHandle InstallWidgetFromBrowser(
+ std::string const & url,
+ std::string const & icon,
+ const WidgetInstallationStruct &installerStruct);
+
bool NextStep(Jobs::Job* installModel);
//TODO implement me
#include <dpl/noncopyable.h>
#include <dpl/string.h>
#include <dpl/foreach.h>
-
+#include <dpl/log/log.h>
#include <dpl/wrt-dao-rw/widget_dao.h>
#include <dpl/wrt-dao-rw/global_dao.h>
WrtDB::WidgetDAO widgetDao(handle);
WidgetFeatureSet featureSet = widgetDao.getFeaturesList();
FOREACH(it, featureSet) {
+ LogInfo("Feature name : " << it->name);
WrtDB::DeviceCapabilitySet dcs =
WrtDB::GlobalDAO::GetDeviceCapability(it->name);
+ FOREACH (devCap, dcs) {
+ LogInfo("--- dev cap : " << *devCap);
+ }
Feature feature(*it, dcs);
m_featureList.push_back(feature);
}
return m_rejected;
}
- private:
- bool isProcessable() const;
-
struct Feature : public WidgetFeature {
WrtDB::DeviceCapabilitySet devCapSet;
WrtDB::DeviceCapabilitySet::const_iterator currentCap;
- bool rejected;
Feature(const WidgetFeature &wf, const WrtDB::DeviceCapabilitySet &set)
: WidgetFeature(wf)
, devCapSet(set)
- , rejected(false)
{
currentCap = devCapSet.begin();
}
currentCap = devCapSet.find(*second.currentCap);
}
};
+
typedef std::list<Feature> FeatureList;
+ typedef FeatureList::const_iterator FeatureIterator;
+
+ FeatureIterator resultBegin() { return m_featureList.begin(); }
+ FeatureIterator resultEnd() { return m_featureList.end(); }
+
+ private:
+ bool isProcessable() const;
FeatureList m_featureList;
FeatureList::iterator m_currentFeature;
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file wrt_powder_info_util.h
- * @author Justyna Mejzner (j.kwiatkowsk@samsung.com)
- * @version 1.0
- */
-
-#include "wrt_powder_info_util.h"
-#include <dpl/singleton_impl.h>
-IMPLEMENT_SINGLETON(PowderInfoUtil)
-
-PowderInfoUtil::PowderInfoUtil()
-{
- m_categories[DPL::FromUTF8String("nu")] = "Nudity";
- m_categories[DPL::FromUTF8String("se")] = "Sex";
- m_categories[DPL::FromUTF8String("vi")] = "Violence";
- m_categories[DPL::FromUTF8String("la")] = "Potentially offensive language";
- m_categories[DPL::FromUTF8String("dr")] = "Drug use";
- m_categories[DPL::FromUTF8String("ga")] = "Gambling";
- m_categories[DPL::FromUTF8String("ha")] = "Hate or harmful activities";
- m_categories[DPL::FromUTF8String("ug")] = "Use of user-generated content";
-
- m_contexts[DPL::FromUTF8String("xa")] = "This material appears in"
- " an artistic conteaxt";
- m_contexts[DPL::FromUTF8String("xb")] = "This material appears in"
- " an educational context";
- m_contexts[DPL::FromUTF8String("xc")] = "This material appears in"
- " a medical context";
- m_contexts[DPL::FromUTF8String("xd")] = "This material appears in"
- " a sports context";
- m_contexts[DPL::FromUTF8String("xe")] = "This material appears in"
- " a violent context";
-}
-
-std::string PowderInfoUtil::getCategoryLabel(const DPL::String &category) const
-{
- CategoryMap::const_iterator categoryIterator = m_categories.find(category);
- if (categoryIterator == m_categories.end()) {
- ThrowMsg(PowderException::IncorrectTypeError,
- "Wrong type of category.");
- }
- return categoryIterator->second;
-}
-
-std::string PowderInfoUtil::getContextLabel(const DPL::String &context) const
-{
- ContextMap::const_iterator contextIterator = m_contexts.find(context);
- if (contextIterator == m_contexts.end()) {
- ThrowMsg(PowderException::IncorrectTypeError, "Wrong type of context.");
- }
- return contextIterator->second;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file wrt_powder_info_util.h
- * @author Justyna Mejzner (j.kwiatkowsk@samsung.com)
- * @version 1.0
- */
-
-#ifndef _WRT_SRC_INSTALLERCORE_POWDERINFOUTIL_H_
-#define _WRT_SRC_INSTALLERCORE_POWDERINFOUTIL_H_
-
-#include <map>
-
-#include <dpl/string.h>
-#include <dpl/singleton.h>
-
-class PowderInfoUtil
-{
- public:
- class PowderException
- {
- public:
- DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
- DECLARE_EXCEPTION_TYPE(Base, IncorrectTypeError)
- };
-
- std::string getCategoryLabel(const DPL::String &category) const;
- std::string getContextLabel(const DPL::String &context) const;
-
- private:
- PowderInfoUtil();
- friend class DPL::Singleton<PowderInfoUtil>;
-
- typedef std::map<DPL::String, std::string> CategoryMap;
- typedef std::map<DPL::String, std::string> ContextMap;
- CategoryMap m_categories;
- ContextMap m_contexts;
-};
-
-typedef DPL::Singleton<PowderInfoUtil> PowderInfoUtilSingleton;
-
-#endif /* _WRT_SRC_INSTALLERCORE_POWDERINFOUTIL_H_ */
-
#include "package-manager-plugin.h"
#include <dlog.h>
#include <dpl/wrt-dao-ro/global_config.h>
-#include <dpl/ace-dao-rw/AceDAO.h>
+#include <ace-dao-rw/AceDAO.h>
#include <vcore/VCore.h>
#include <dpl/wrt-dao-ro/WrtDatabase.h>
#include <dpl/wrt-dao-rw/widget_dao.h>
#include <dpl/db/sql_connection.h>
#include <dpl/log/log.h>
#include <dpl/foreach.h>
-#include <dpl/ace-dao-ro/wrt_db_types.h>
#include <dpl/utils/folder_size.h>
+#include <dpl/wrt-dao-ro/wrt_db_types.h>
using namespace WrtDB;
public:
void AttachDatabase()
{
- WrtDB::WrtDatabase::attachToThread();
+ WrtDB::WrtDatabase::attachToThreadRO();
}
void DetachDatabase()
#include <dpl/log/log.h>
//#include <widget_controller.h>
#include <dpl/localization/w3c_file_localization.h>
-#include <dpl/ace/PolicyEnforcementPoint.h>
-#include <dpl/ace/PolicyEvaluator.h>
-#include <dpl/ace/Preference.h>
+#include <ace/PolicyEnforcementPoint.h>
+#include <ace/PolicyEvaluator.h>
+#include <ace/Preference.h>
#include <dpl/wrt-dao-rw/feature_dao.h>
#include <dpl/wrt-dao-rw/widget_dao.h>
#include <vector>
#include <map>
-#include <dpl/ace-dao-rw/AceDAO.h>
-#include <dpl/ace/SettingsLogic.h>
+#include <ace-dao-rw/AceDAO.h>
+#include <ace/SettingsLogic.h>
#include <dpl/wrt-dao-rw/global_dao.h>
using namespace WrtDB;
#include <i_ace_settings_client.h>
#include <string>
-#include <dpl/ace-dao-ro/wrt_db_types.h>
+#include <dpl/wrt-dao-ro/wrt_db_types.h>
class PolicyEnforcementPoint;
#include <stdexcept>
#include <map>
#include <cstdlib>
+#include <dpl/wrt-dao-ro/wrt_db_types.h>
#include <dpl/wrt-dao-rw/widget_dao.h>
#include <dpl/wrt-dao-rw/feature_dao.h>
-#include <dpl/ace/WRT_INTERFACE.h>
+#include <ace/WRT_INTERFACE.h>
#include <map>
#include <dpl/log/log.h>
#include <attribute_facade.h>
-#include <dpl/ace/Request.h>
+#include <ace/Request.h>
#include <simple_roaming_agent.h>
using namespace WrtDB;
#include <map>
#include <vector>
-#include <dpl/ace/WRT_INTERFACE.h>
+#include <ace/WRT_INTERFACE.h>
class Request;
#define WRT_SRC_ACCESS_CONTROL_I_ACE_PERMISSSIONS_H_
#include <vector>
-#include <dpl/ace-dao-ro/PreferenceTypes.h>
+#include <ace-dao-ro/PreferenceTypes.h>
namespace AceSettings {
#define WRT_SRC_UI_SHARED_GADGET_IACESETTINGSCLIENT_H_
#include <dpl/fast_delegate.h>
-#include <dpl/ace-dao-ro/PreferenceTypes.h>
+#include <ace-dao-ro/PreferenceTypes.h>
#include <string>
#include <vector>
#include <i_ace_permissions.h>
*/
#include <security_controller.h>
-#include <dpl/ace/PolicyEnforcementPoint.h>
-#include <dpl/ace/WRT_INTERFACE.h>
-#include <dpl/ace/PolicyEvaluatorFactory.h>
+#include <ace/PolicyEnforcementPoint.h>
+#include <ace/WRT_INTERFACE.h>
+#include <ace/PolicyEvaluatorFactory.h>
#include <dpl/singleton_impl.h>
#include <dpl/log/log.h>
#include <dpl/type_list.h>
#include <string>
#include <ace_settings_logic.h>
-#include <dpl/ace-dao-ro/PreferenceTypes.h>
-#include <dpl/ace/AbstractPolicyEnforcementPoint.h>
+#include <ace-dao-ro/PreferenceTypes.h>
+#include <ace/AbstractPolicyEnforcementPoint.h>
#include <string>
#include <dpl/event/inter_context_delegate.h>
-#include <dpl/ace-dao-ro/wrt_db_types.h>
+#include <dpl/wrt-dao-ro/wrt_db_types.h>
namespace Jobs {
class Job;
* @brief Header file for security logic
*/
-#include <dpl/ace/PromptDecision.h>
+#include <ace/PromptDecision.h>
#include <security_logic.h>
#include <attribute_facade.h>
#ifdef WRT_SMACK_ENABLED
#ifndef SECURITY_LOGIC_H
#define SECURITY_LOGIC_H
-#include <dpl/ace/Request.h>
-#include <dpl/ace/PolicyResult.h>
-#include <dpl/ace/AbstractPolicyEnforcementPoint.h>
-#include <dpl/ace/Preference.h>
+#include <ace/Request.h>
+#include <ace/PolicyResult.h>
+#include <ace/AbstractPolicyEnforcementPoint.h>
+#include <ace/Preference.h>
#include <i_ace_settings_client.h>
-#include <dpl/ace/PolicyEnforcementPoint.h>
+#include <ace/PolicyEnforcementPoint.h>
//#include "ace_settings_logic.h"
#include "installer_main_thread.h"
#include <dpl/assert.h>
#include <dpl/wrt-dao-ro/WrtDatabase.h>
-#include <dpl/ace-dao-rw/AceDAO.h>
+#include <ace-dao-rw/AceDAO.h>
#include <vcore/VCore.h>
#include <dpl/singleton_impl.h>
#include <dpl/assert.h>
{
Assert(!m_attached);
// Attach databases
- ValidationCore::AttachToThread();
- AceDB::AceDAO::attachToThread();
- WrtDB::WrtDatabase::attachToThread();
+ ValidationCore::AttachToThreadRW();
+ AceDB::AceDAO::attachToThreadRW();
+ WrtDB::WrtDatabase::attachToThreadRW();
m_attached = true;
}
#include <string>
#include <fstream>
#include <unistd.h>
+#include <sys/resource.h>
#include <dpl/optional.h>
#include <dpl/scoped_free.h>
#include <dpl/optional_typedefs.h>
if(pkgmgr_installer_send_signal(installer, PKG_TYPE, pkg_name, key, val)) {\
LogDebug("Failed to send signal to pkgmgr"); \
}
+#define NOFILE_CNT_FOR_INSTALLER 9999
+
using namespace WrtDB;
namespace { // anonymous
const char AUL_ARG_KEY[] = "widget_arg";
}
arg = m_argv[1];
-
if (arg == "-h" || arg == "--help") {
if (m_argc != 2) {
return showHelpAndQuit();
return showHelpAndQuit();
}
m_webAppUrl = m_argv[2];
-
+ // TODO another option for policy?
+ m_installPolicy = WRT_WIM_POLICY_FORCE_INSTALL;
DPL::OptionalString icon = OptionParser::QueryOption(m_argc,
m_argv,
"--icon");
if (!icon.IsNull()) {
+ if(icon->empty()) {
+ return showHelpAndQuit();
+ }
m_webAppIcon = DPL::ToUTF8String(*icon);
+ // TODO fix DPL string conversion to get rid of additional space
+ m_webAppIcon.erase(remove_if(m_webAppIcon.begin(),
+ m_webAppIcon.end(),
+ isspace));
}
+ AddStep(&WrtInstaller::installFromWebStep);
}
} else if (arg.find("backend") != std::string::npos) {
m_installByPkgmgr = true;
void WrtInstaller::installStep()
{
LogDebug("Installing widget ...");
- if (!m_quiet) {
- m_popup->init();
- }
DPL::ScopedFree<char> packagePath(canonicalize_file_name(
m_packagePath.c_str()));
wrt_install_widget(packagePath ? packagePath.Get() : m_packagePath.c_str(),
void WrtInstaller::uninstallStep()
{
LogDebug("Uninstalling widget ...");
- if (!m_quiet) {
- m_popup->init();
- }
-
wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback,
(!m_quiet || m_installByPkgmgr)
? &staticWrtUninstallProgressCallback : NULL);
void WrtInstaller::uninstallPkgNameStep()
{
LogDebug("Uninstalling widget ...");
- if (!m_quiet) {
- m_popup->init();
- }
-
WrtErrStatus status = wrt_get_widget_by_pkgname(m_name, &m_handle);
if (status == WRT_SUCCESS) {
LogDebug("Get Widget Handle by package name : " << m_handle);
void WrtInstaller::uninstallGuidStep()
{
LogDebug("Uninstalling widget ...");
- if (!m_quiet) {
- m_popup->init();
- }
-
WrtErrStatus status = wrt_get_widget_by_guid(m_name, &m_handle);
if (status == WRT_SUCCESS) {
LogDebug("Get Widget Handle by guid : " << m_handle);
}
}
+void WrtInstaller::installFromWebStep()
+{
+ LogDebug("Installing widget ...");
+ if (!m_quiet) {
+ m_popup->init();
+ }
+
+ DPL::ScopedFree<char> icon(canonicalize_file_name(
+ m_webAppIcon.c_str()));
+
+ wrt_install_widget_from_browser(
+ m_webAppUrl.c_str(),
+ icon ? icon.Get() : m_webAppIcon.c_str(),
+ this,
+ &staticWrtStatusCallback,
+ (!m_quiet || m_installByPkgmgr) ?
+ &staticWrtInstallProgressCallback : NULL,
+ m_installPolicy);
+}
+
void WrtInstaller::staticWrtInitCallback(WrtErrStatus status,
void* userdata)
{
}
if (!This->m_quiet) {
+ This->m_popup->init();
elm_progressbar_value_set(This->m_popup->m_progressbar, 100.0);
evas_object_show(This->m_popup->m_popup);
}
::PostEvent(WRTInstallerNS::NextStepEvent());
} else {
if (!This->m_quiet) {
+ This->m_popup->init();
float percent = (This->m_totalPlugins - This->m_numPluginsToInstall)/(float)This->m_totalPlugins;
elm_progressbar_value_set(This->m_popup->m_progressbar, percent);
evas_object_show(This->m_popup->m_popup);
WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
std::stringstream percentStr;
LogInfo(" progress: " << percent <<
- "description " << description);
+ " description: " << description);
if (This->m_installByPkgmgr) {
if (This->m_sendSig) {
This->m_sendSig = false;
}
- LogDebug("Broadcast Progress, pkgname" << This->m_name);
+ LogDebug("Broadcast Progress, pkgname " << This->m_name);
percentStr << static_cast<int>(percent);
PKGMGR_SEND_SIG(This->m_installer, This->m_name.c_str(),
}
if (!This->m_quiet) {
+ This->m_popup->init();
elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
evas_object_show(This->m_popup->m_popup);
}
WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
std::stringstream percentStr;
LogInfo(" progress: " << percent <<
- "description " << description);
+ " description: " << description);
if (This->m_installByPkgmgr) {
if (This->m_sendSig) {
PKGMGR_START_KEY, "uninstall");
This->m_sendSig = false;
}
- LogDebug("Broadcast Progress, pkgname" << This->m_name);
+ LogDebug("Broadcast Progress, pkgname " << This->m_name);
percentStr << static_cast<int>(percent);
PKGMGR_SEND_SIG(This->m_installer, This->m_name.c_str(),
}
if (!This->m_quiet) {
+ This->m_popup->init();
elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
evas_object_show(This->m_popup->m_popup);
}
{
LogDebug("Window Init");
- // create window
- m_win = createWin("wrt-installer");
+ if (m_win == NULL) {
+ // create window
+ m_win = createWin("wrt-installer");
- // security popup uses installer window
- using namespace DPL::Popup;
- PopupControllerSingleton::Instance().setExternalCanvas(m_win);
- evas_object_show(m_win);
+ // security popup uses installer window
+ using namespace DPL::Popup;
+ PopupControllerSingleton::Instance().setExternalCanvas(m_win);
- // create popup
- m_popup = elm_popup_add(m_win);
+ // create popup
+ m_popup = elm_popup_add(m_win);
- // create progressbar
- m_progressbar = elm_progressbar_add(m_popup);
- elm_object_style_set(m_progressbar, "list_progress");
- elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
- evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
+ // create progressbar
+ m_progressbar = elm_progressbar_add(m_popup);
+ elm_object_style_set(m_progressbar, "list_progress");
+ elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
+ evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
+ evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
- elm_popup_content_set(m_popup, m_progressbar);
- elm_progressbar_value_set(m_progressbar, 0.0);
- evas_object_show(m_progressbar);
+ elm_object_content_set(m_popup, m_progressbar);
+ elm_progressbar_value_set(m_progressbar, 0.0);
+ evas_object_show(m_progressbar);
- // set progressbar to popup
- evas_object_show(m_popup);
+ evas_object_show(m_popup);
+ evas_object_show(m_win);
+ }
}
Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name)
xScale = (double)w / BASE_LAYOUT_W;
yScale = (double)h / BASE_LAYOUT_H;
scale = xScale < yScale ? xScale : yScale;
- elm_scale_set(scale);
+ elm_config_scale_set(scale);
return win;
}
const DPL::String& pkgMsg,
ShowResultCallback callback)
{
+ Evas_Object *btn;
+
+
LogDebug("Result Popup Created");
evas_object_del(m_popup);
m_popup = NULL;
- m_popup = elm_popup_with_buttons_add(m_win, "RESULT",
- DPL::ToUTF8String(pkgMsg).c_str(),
- 1, "OK", 5, NULL);
- evas_object_smart_callback_add(m_popup, "response", callback, userdata);
+ m_popup = elm_popup_add(m_win);
+ if (!m_popup)
+ return;
+
+ btn = elm_button_add(m_popup);
+ if (!btn) {
+ evas_object_del(m_popup);
+ return;
+ }
+ elm_object_text_set(btn, "OK");
+ evas_object_smart_callback_add(btn, "clicked", callback, userdata);
+ elm_object_part_content_set(m_popup, "button1", btn);
+ elm_object_part_text_set(m_popup, "title,text", "RESULT");
+ elm_object_text_set(m_popup, DPL::ToUTF8String(pkgMsg).c_str());
+
evas_object_show(m_popup);
+ evas_object_show(m_win);
+
}
void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/,
// the output may not be flushed).
setlinebuf(stdout);
- // enable gl
- if (!getenv("ELM_ENGINE")) {
- if (setenv("ELM_ENGINE", "gl", 1)) {
- LogDebug("Enable gl for HW Accel");
+ // Check and re-set the file open limitation
+ struct rlimit rlim;
+ if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) {
+ LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" );
+ LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" );
+
+ if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) {
+ rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER;
+ rlim.rlim_max = NOFILE_CNT_FOR_INSTALLER;
+ if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) {
+ LogError("setrlimit is fail!!");
+ }
}
+ } else {
+ LogError("getrlimit is fail!!");
}
WrtInstaller app(argc, argv);
void shutdownStep();
void registerCallbackStep();
void queryListStep();
+ void installFromWebStep();
// Static callbacks
return TRUE;
}
+ // Initialize ValidationCore - this must be done before AttachDatabases
+ ValidationCore::VCoreInit(
+ std::string(GlobalConfig::GetFingerprintListFile()),
+ std::string(GlobalConfig::GetFingerprintListSchema()),
+ std::string(GlobalConfig::GetVCoreDatabaseFilePath()));
+
InstallerMainThreadSingleton::Instance().AttachDatabases();
//checking for correct DB version
LanguageSubtagRstTreeSingleton::Instance().Initialize();
LocalizationUtils::Initialize();
- // Initialize ValidationCore
- ValidationCore::VCoreInit(
- std::string(GlobalConfig::GetFingerprintListFile()),
- std::string(GlobalConfig::GetFingerprintListSchema()),
- std::string(GlobalConfig::GetVCoreDatabaseFilePath()));
-
// Security Logic initialization
CONTROLLER_POST_SYNC_EVENT(
SecurityController,
InstallerMainThreadSingleton::Instance().DetachDatabases();
+ // This must be done after DetachDatabase
+ ValidationCore::VCoreDeinit();
+
// Global deinit check
LogInfo("Cleanup libxml2 global values.");
xmlCleanupParser();
UNHANDLED_EXCEPTION_HANDLER_END
}
+ EXPORT_API void wrt_install_widget_from_browser(
+ const char *url,
+ const char* icon,
+ void* userdata,
+ WrtInstallerStatusCallback status_cb,
+ WrtProgressCallback progress_cb,
+ wrt_widget_update_mode_t update_mode)
+ {
+ UNHANDLED_EXCEPTION_HANDLER_BEGIN
+ {
+ LogInfo("[WRT-API] INSTALL WIDGET: " << url);
+ // Post installation event
+ CONTROLLER_POST_EVENT(
+ InstallerController,
+ InstallerControllerEvents::InstallWidgetFromBrowserEvent(
+ url, icon, WidgetInstallationStruct(
+ InstallerCallbacksTranslate::installFinishedCallback,
+ InstallerCallbacksTranslate::installProgressCallback,
+ new InstallerCallbacksTranslate::StatusCallbackStruct(
+ userdata, status_cb, progress_cb),
+ translateWidgetUpdateMode(update_mode))));
+ }
+ UNHANDLED_EXCEPTION_HANDLER_END
+ }
+
EXPORT_API void wrt_install_plugin(
const char *pluginDir,
void *user_param,
*/
void wrt_installer_shutdown_for_tests();
+/**
+ * @fn void wrt_install_widget_from_web(const char *url,
+ * const char* icon,
+ * void *userdata,
+ * WrtInstallerStatusCallback status_callback,
+ * WrtProgressCallback progress_callback,
+ * wrt_widget_update_mode_t update_mode);
+ *
+ * @brief Installs widget from given url
+ *
+ * This method is used to install widget from a given url.
+ *
+ * @param [in] url Widget url
+ * @param [in] icon Icon url
+ * @param [in] userdata User parameters to be passed to the callback
+ * @param [in] status_cb Call to this one will be done at the end of
+ * operation
+ * The callback is called in the context of the
+ * application's
+ * @param [in] progress_cb Callback function to get data of install
+ * progress
+ * If you don't want to get progress data, this
+ * should be NULL
+ * @param [in] install_mode Installation mode
+ * @return Nothing (status returned in callback).
+ *
+ * Sample code:
+ * @code
+ * wrt_install_widget(url.c_str(),
+ * icon.c_str(),
+ * NULL,
+ * install_cb,
+ * progress_cb,
+ * WRT_WIM_POLICY_WAC);
+ * @endcode
+ *
+ * @see wrt_installer_uninstall_widget
+ */
+void wrt_install_widget_from_browser(const char *url,
+ const char* icon,
+ void* userdata,
+ WrtInstallerStatusCallback status_cb,
+ WrtProgressCallback progress_cb,
+ wrt_widget_update_mode_t update_mode);
+
WrtErrStatus wrt_get_widget_by_pkgname(const std::string pkgname,
int *widget_handle);
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets" id="http://example.org/exampleWidget" version="2.0 Beta" height="640" width="480"/>
\ No newline at end of file
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://example.org/exampleWidget" version="2.0 Beta" height="640" width="480"/>
\ No newline at end of file
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets" id="http://example.org/exampleWidget" version="2.0 Beta" viewmodes="fullscreen"/>
\ No newline at end of file
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://example.org/exampleWidget" viewmodes="fullscreen" version="2.0 Beta"/>
\ No newline at end of file
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<name/>
<name>example</name>
</widget>
\ No newline at end of file
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<description/>
<description>description</description>
</widget>
\ No newline at end of file
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<author/>
<author>Krzysztof Janiak</author>
<author email="k.janiak@samsung.com">Krzysztof Janiak</author>
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<license/>
<license>Public domain.</license>
<license href="www.samsung.com">Apache 2.0</license>
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<icon/>
<icon src="icon.png"/>
</widget>
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<content/>
<content src="index.html"/>
</widget>
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<feature name="http://tizen.org/api/application" required="true">
<param/>
<param name="accuracy"/>
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<preference/>
<preference name="skin"/>
<preference name="skin" value="alien"/>
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<access origin="http://www.wp.pl/*"/>
<access origin="http://onet.pl" subdomains="true"/>
</widget>
<?xml version="1.0"?>
-<widget xmlns="http://www.w3.org/ns/widgets">
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets">
<tizen:setting rotation-lock="portrait"/>
<tizen:setting backbutton-presence="disable"/>
<tizen:setting indicator-presence="disable"/>
-</widget>
+</widget>
\ No newline at end of file