Add multi-user support 10/16610/2
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Tue, 21 Jan 2014 16:15:09 +0000 (17:15 +0100)
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Fri, 28 Mar 2014 13:50:39 +0000 (14:50 +0100)
Also:
+ set correct license in spec file.
+ add %lang tag to language files

Bug-Tizen: PTREL-362
Change-Id: I7884f2c1e19c4bcefe30d01d684a1cc0a0a1329c
Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
backend-lib/CMakeLists.txt
backend-lib/src/librpm.c
backend/src/core/rpm-installer-core.c
frontend/CMakeLists.txt
packaging/rpm-installer.spec

index caf9db3..9a8c35f 100755 (executable)
@@ -10,7 +10,7 @@ set(CMAKE_SKIP_BUILD_RPATH true)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc ${CMAKE_CURRENT_SOURCE_DIR}/inc )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED dbus-glib-1 pkgmgr-types vconf)
+pkg_check_modules(pkgs REQUIRED dbus-glib-1 pkgmgr-types vconf libtzplatform-config)
 #pkg_check_modules(pkgs REQUIRED pkgmgr-installer-status-broadcast-server security-server vconf sqlite3 dbus-glib-1 glib-2.0 db-util )
 
 FOREACH(flag ${pkgs_CFLAGS})
index 8810422..fd12ac6 100755 (executable)
 #include <rpmdb.h>
 #include <vconf.h>
 
+/* For multi-user support */
+#include <tzplatform_config.h>
+
 #include "librpminternals.h"
 
-#define BASEDIR                                                "/opt/share"
+#define BASEDIR                                                tzplatform_getenv(TZ_SYS_SHARE)
+#define USER_APP_FOLDER                                tzplatform_getenv(TZ_USER_APP)
 #define BUFFSIZE                                               256
 
 void pkg_native_plugin_on_unload(void)
@@ -103,7 +107,7 @@ int pkg_plugin_get_app_detail_info(const char *pkgid,
        }
 
        /*get data_size*/
-       snprintf(dirname, BUFFSIZE-1, "/opt/usr/apps/%s/data", pkgid);
+       snprintf(dirname, BUFFSIZE-1, "%s/%s/data", USER_APP_FOLDER, pkgid);
        data_size = _librpm_calculate_dir_size(dirname);
        if (data_size < 0) {
                _librpm_print(DEBUG_ERR,
@@ -172,8 +176,8 @@ int pkg_plugin_get_app_detail_info_from_package(const char *pkg_path,
        }
 
        /*get data_size. If pkg is not installed it will be 0*/
-       snprintf(dirname, BUFFSIZE-1, "/opt/usr/apps/%s/data",
-                               pkg_detail_info->pkgid);
+       snprintf(dirname, BUFFSIZE-1, "%s/%s/data",
+                               USER_APP_FOLDER, pkg_detail_info->pkgid);
 
         data_size = _librpm_calculate_dir_size(dirname);
         if (data_size < 0) {
index 455b82a..d70a684 100755 (executable)
@@ -41,6 +41,9 @@
 #include <rpmts.h>
 #include <rpmdb.h>
 
+/* For multi-user support */
+#include <tzplatform_config.h>
+
 /* SLP include files */
 #include "rpm-installer.h"
 #include "rpm-installer-util.h"
@@ -48,6 +51,7 @@
 
 #define QUERY_PACKAGE          "/usr/bin/query_rpm_package.sh"
 #define RPM_PKG_INFO           "/var/rpmpkg.info"
+#define USER_APP_FOLDER                tzplatform_getenv(TZ_USER_APP)
 
 struct pkgfile_info_t {
        char *pkg_filename;
@@ -562,9 +566,12 @@ int _rpm_installer_clear_private_data(char *pkgid)
 {
        if (pkgid == NULL)
                return RPM_INSTALLER_ERR_WRONG_PARAM;
+
        char dir_path[256] = { '\0' };
        int ret = -1;
-       snprintf(dir_path, 255, "/opt/usr/apps/%s/data/", pkgid);
+
+       snprintf(dir_path, 255, "%s/%s/data/", USER_APP_FOLDER, pkgid);
        ret = __ri_recursive_delete_dir(dir_path);
+
        return ret;
 }
index 883a849..54f4ed7 100755 (executable)
@@ -22,7 +22,7 @@ FOREACH(flag ${libpkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-pkg_check_modules(STATUS pkgmgr-installer-status-broadcast-server pkgmgr pkgmgr-installer pkgmgr-parser libxml-2.0 app2sd pkgmgr-info)
+pkg_check_modules(STATUS pkgmgr-installer-status-broadcast-server pkgmgr pkgmgr-installer pkgmgr-parser libxml-2.0 app2sd pkgmgr-info libtzplatform-config)
 link_directories (${STATUS_LIBRARY_DIRS})
 include_directories (${STATUS_INCLUDE_DIRS})
 
index b08cb43..8ddb381 100755 (executable)
@@ -5,7 +5,7 @@ Summary:    Native rpm installer
 Version:    0.1.25
 Release:    0
 Group:      System/Libraries
-License:    Apache License, Version 2.0
+License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 Source1001: rpm-installer.manifest
 Requires(post): /sbin/ldconfig
@@ -33,6 +33,7 @@ BuildRequires:  pkgconfig(appcore-efl)
 BuildRequires:  pkgconfig(evas)
 BuildRequires:  pkgconfig(ecore)
 BuildRequires:  pkgconfig(edje)
+BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  gettext-tools
 %if %{with x}
 BuildRequires: pkgconfig(ecore-x)
@@ -61,10 +62,10 @@ rm -rf %{buildroot}
 %post
 mkdir -p /usr/etc/package-manager/backend
 mkdir -p /usr/etc/package-manager/backendlib
-ln -sf /usr/bin/rpm-backend /usr/etc/package-manager/backend/rpm
+ln -sf %{_bindir}/rpm-backend /usr/etc/package-manager/backend/rpm
 ln -sf /usr/lib/libnativerpm.so /usr/etc/package-manager/backendlib/librpm.so
 
-chmod 700 /usr/bin/rpm-backend
+chmod 700 %{_bindir}/rpm-backend
 
 vconftool set -t int db/private/rpm-installer/state "0"
 vconftool set -t int db/private/rpm-installer/stateinfo "0"
@@ -74,14 +75,14 @@ vconftool set -t int db/private/rpm-installer/requestinfo/options "0"
 
 %files
 %manifest %{name}.manifest
-%attr(0700,-,-) /usr/bin/rpm-backend
-%attr(0700,-,-) /usr/bin/install_rpm_package.sh
-%attr(0755,-,-) /usr/bin/query_rpm_package.sh
-%attr(0700,-,-) /usr/bin/uninstall_rpm_package.sh
-%attr(0700,-,-) /usr/bin/upgrade_rpm_package.sh
-%attr(0644,-,-) /usr/share/locale/en_GB/LC_MESSAGES/rpm-installer.mo
-%attr(0644,-,-) /usr/share/locale/ja_JP/LC_MESSAGES/rpm-installer.mo
-%attr(0644,-,-) /usr/share/locale/zh_CN/LC_MESSAGES/rpm-installer.mo
-%attr(0644,-,-) /usr/share/locale/en_US/LC_MESSAGES/rpm-installer.mo
-%attr(0644,-,-) /usr/share/locale/ko_KR/LC_MESSAGES/rpm-installer.mo
+%attr(0700,-,-) %{_bindir}/rpm-backend
+%attr(0700,-,-) %{_bindir}/install_rpm_package.sh
+%attr(0755,-,-) %{_bindir}/query_rpm_package.sh
+%attr(0700,-,-) %{_bindir}/uninstall_rpm_package.sh
+%attr(0700,-,-) %{_bindir}/upgrade_rpm_package.sh
+%attr(0644,-,-) %lang(en_GB) /usr/share/locale/en_GB/LC_MESSAGES/rpm-installer.mo
+%attr(0644,-,-) %lang(ja) /usr/share/locale/ja_JP/LC_MESSAGES/rpm-installer.mo
+%attr(0644,-,-) %lang(zh) /usr/share/locale/zh_CN/LC_MESSAGES/rpm-installer.mo
+%attr(0644,-,-) %lang(en_US) /usr/share/locale/en_US/LC_MESSAGES/rpm-installer.mo
+%attr(0644,-,-) %lang(ko) /usr/share/locale/ko_KR/LC_MESSAGES/rpm-installer.mo
 %attr(0644,-,-) /usr/lib/libnativerpm.so