Fix download-fonts-service package for Tizen 3.0 73/91573/6 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 accepted/tizen/3.0.m2/mobile/20170104.141207 accepted/tizen/3.0.m2/tv/20170104.141942 accepted/tizen/3.0.m2/wearable/20170104.142237 accepted/tizen/3.0/common/20161115.184834 accepted/tizen/3.0/ivi/20161117.020827 accepted/tizen/3.0/mobile/20161117.020724 accepted/tizen/3.0/tv/20161117.020743 accepted/tizen/3.0/wearable/20161117.020803 accepted/tizen/common/20161110.153858 accepted/tizen/ivi/20161111.002345 accepted/tizen/mobile/20161111.002248 accepted/tizen/tv/20161111.002305 accepted/tizen/wearable/20161111.002324 submit/tizen/20161110.103439 submit/tizen_3.0.m2/20170104.093751 submit/tizen_3.0/20161108.120451 submit/tizen_3.0/20161110.103350 submit/tizen_3.0/20161115.041433
authorYoungbok Shin <youngb.shin@samsung.com>
Mon, 10 Oct 2016 08:35:37 +0000 (17:35 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Tue, 8 Nov 2016 05:16:20 +0000 (14:16 +0900)
Change-Id: I49354bbab76c71d33ccd2c3b2c82f626664930d4

CMakeLists.txt
download-fonts-service.manifest [deleted file]
packaging/download-fonts-service.manifest [new file with mode: 0644]
packaging/download-fonts-service.spec [changed mode: 0755->0644]
pkgmgr_font/CMakeLists.txt
pkgmgr_font/src/font_service_register.c

index cc300bf..a6faea3 100755 (executable)
@@ -8,7 +8,7 @@ pkg_check_modules(pkg REQUIRED
        capi-system-system-settings
        elementary
        pkgmgr-info
-       security-server
+       pkgmgr-installer
 )
 
 SET(PACKAGE "${PROJECT_NAME}")
diff --git a/download-fonts-service.manifest b/download-fonts-service.manifest
deleted file mode 100755 (executable)
index b6c8305..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<manifest>
-       <!-- Provider master label -->
-       <define>
-               <domain name="download-fonts-service" />
-       </define>
-       <request>
-               <domain name="_" />
-       </request>
-
-       <assign>
-               <!-- Package manager plugin -->
-               <filesystem path="/usr/etc/package-manager/parserlib/metadata/libfont.so" label="_" />
-       </assign>
-</manifest>
diff --git a/packaging/download-fonts-service.manifest b/packaging/download-fonts-service.manifest
new file mode 100644 (file)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
old mode 100755 (executable)
new mode 100644 (file)
index 3e3986e..174fadd
@@ -1,23 +1,25 @@
 Name: download-fonts-service
-Summary: Master Download fonts service.
-Version: 0.0.8
+Summary: Master Download fonts service
+Version: 1.0.0
 Release: 1
-Group: TO_BE / FILLED_IN
+Group: Base/Package Management
 License: Apache-2.0
 Source0: %{name}-%{version}.tar.gz
+Source1001: download-fonts-service.manifest
 BuildRequires: cmake, gettext-tools, smack, coreutils
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(fontconfig)
 BuildRequires: pkgconfig(capi-system-system-settings)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pkgconfig(pkgmgr-info)
-BuildRequires: pkgconfig(security-server)
+BuildRequires: pkgconfig(pkgmgr-installer)
 
 %description
 Master Download fonts service.
 
 %prep
 %setup -q
+cp %{SOURCE1001} .
 
 %build
 %if 0%{?sec_build_binary_debug_enable}
@@ -30,7 +32,7 @@ export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
 export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
 %endif
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPRODUCT=private
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
 
 CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs}
 
@@ -38,9 +40,11 @@ CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%j
 rm -rf %{buildroot}
 %make_install
 
+mkdir -p %{buildroot}%{_tmpfilesdir}
+
 %files -n download-fonts-service
 %manifest download-fonts-service.manifest
 %defattr(-,root,root,-)
-%{_prefix}/etc/package-manager/parserlib/category/*
+/etc/package-manager/parserlib/category/*
 
 # End of a file
index 7086af2..5d6424e 100755 (executable)
@@ -8,14 +8,13 @@ pkg_check_modules(bin_pkgs REQUIRED
        fontconfig
        capi-system-system-settings
        elementary
-       pkgmgr-info
 )
 
 FOREACH(flag ${bin_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Wall -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Wall")
 
 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
 
@@ -25,5 +24,5 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED
 
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${bin_pkgs_LDFLAGS})
 
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION "etc/package-manager/parserlib/category")
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION "/etc/package-manager/parserlib/category")
 # End of a file
index 31e62e7..3147a7d 100755 (executable)
@@ -28,7 +28,7 @@
 #include <fontconfig/fontconfig.h>
 #include <Elementary.h>
 #include <pkgmgr-info.h>
-#include <security-server.h>
+#include <pkgmgr_installer_info.h>
 #include "system_settings.h"
 
 
@@ -49,8 +49,8 @@ static const char *PRELOADED_PATH = "/opt/share/fonts/preloaded";
 
 static const char *ELM_PROFILE_CFG = "/opt/home/app/.elementary/config/profile.cfg";
 #define MAX_FILE_LEN 4096
-#define APP_OWNER_ID 5000
-#define APP_GROUP_ID 5000
+#define APP_OWNER_ID 5001
+#define APP_GROUP_ID 100
 
 static int make_dir(const char *path);
 static int symbolic_link(const char *srcpath, const char *destpath);
@@ -95,7 +95,14 @@ static int make_dir(const char *path)
                        return ret;
                }
 
-               ret = chmod (path, 0755);
+               ret = chown(path, getuid(), APP_GROUP_ID);
+               if (ret < 0)
+               {
+                       DEBUG_ERROR("chown is failed %s\n",path);
+                       return ret;
+               }
+
+               ret = chmod(path, 0755);
                if (ret < 0)
                {
                        DEBUG_ERROR("chmod is failed %s\n",path);
@@ -103,13 +110,6 @@ static int make_dir(const char *path)
                        return ret;
                }
        }
-       ret = security_server_label_access(path, "_");
-
-       if (ret < 0)
-       {
-               DEBUG_ERROR("security_server_label_access is failed %s\n",path);
-               return ret;
-       }
 
        return ret;
 }
@@ -174,14 +174,6 @@ static int symbolic_link(const char *srcpath, const char *destpath)
                                DEBUG_ERROR("symlink is failed \n");
                                goto FAIL;
                        }
-
-                       ret = security_server_label_access(destdir, "_");
-
-                       if (ret < 0)
-                       {
-                               DEBUG_ERROR("security_server_label_access is failed %s\n",destdir);
-                               goto FAIL;
-                       }
                }
        }
        closedir (d);
@@ -247,14 +239,6 @@ static int move_file(const char *srcpath, const char *destpath)
                                DEBUG_ERROR("symlink is failed \n");
                                goto FAIL;
                        }
-
-                       ret = security_server_label_access(destdir, "_");
-
-                       if (ret < 0)
-                       {
-                               DEBUG_ERROR("security_server_label_access is failed %s\n",destdir);
-                               goto FAIL;
-                       }
                }
        }
        closedir (d);
@@ -500,8 +484,11 @@ int COMMON_PKGMGR_PLUGIN_INSTALL(const char *pkgid, const char *appid, GList *li
        pkgmgrinfo_pkginfo_h handle = NULL;
        const char *app_root_path = NULL;
        const char *dest_path = NULL;
+       uid_t uid = 0;
+
+       pkgmgr_installer_info_get_target_uid(&uid);
+       ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle);
 
-       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
        if (ret < 0)
        {
                DEBUG_ERROR("pkgid[%s] handle get fail", pkgid);
@@ -561,8 +548,11 @@ int COMMON_PKGMGR_PLUGIN_UPGRADE(const char *pkgid, const char *appid, GList *li
        pkgmgrinfo_pkginfo_h handle = NULL;
        const char* app_root_path = NULL;
        const char* dest_path = NULL;
+       uid_t uid = 0;
+
+       pkgmgr_installer_info_get_target_uid(&uid);
+       ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle);
 
-       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
        if (ret < 0)
        {
                DEBUG_ERROR("pkgid[%s] handle get fail", pkgid);
@@ -594,7 +584,7 @@ int COMMON_PKGMGR_PLUGIN_UPGRADE(const char *pkgid, const char *appid, GList *li
 
        if (access(deletedir, F_OK) == -1)
        {
-               DEBUG_ERROR("dest directory is not exist \n");
+               DEBUG_ERROR("dest directory(%s) is not exist: %s\n", deletedir, strerror(errno));
                goto FAIL;
        }
 
@@ -606,18 +596,16 @@ int COMMON_PKGMGR_PLUGIN_UPGRADE(const char *pkgid, const char *appid, GList *li
        }
 
        ret = make_dir(PARENT_PATH);
-
        if (ret < 0)
        {
-               DEBUG_ERROR("make current directory is failed \n");
+               DEBUG_ERROR("make current directory(%s) is failed: %s\n", PARENT_PATH, strerror(errno));
                goto FAIL;
        }
 
        ret = make_dir(dest_path);
-
        if (ret < 0)
        {
-               DEBUG_ERROR("make current directory is failed \n");
+               DEBUG_ERROR("make current directory(%s) is failed: %s\n", dest_path, strerror(errno));
                goto FAIL;
        }
 
@@ -644,9 +632,11 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *
        FcObjectSet *os = NULL;
        FcPattern *pat = NULL;
        FcFontSet *fs = NULL;
+       pkgmgrinfo_pkginfo_h handle = NULL;
        const char* app_root_path = NULL;
        const char *dest_path = NULL;
        int ret;
+       uid_t uid = 0;
 
        elm_init(0, NULL);
 
@@ -656,10 +646,9 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *
                return -1;
        }
 
-       pkgmgrinfo_pkginfo_h handle = NULL;
-
+       pkgmgr_installer_info_get_target_uid(&uid);
+       ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle);
 
-       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
        if (ret < 0)
        {
                DEBUG_ERROR("pkgid[%s] handle get fail", pkgid);
@@ -753,12 +742,6 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *
                                                chmod (ELM_PROFILE_CFG, 0777);
                                        }
 
-                                       ret = security_server_label_access(ELM_PROFILE_CFG, "system::homedir");
-                                       if (ret < 0)
-                                       {
-                                               chmod (ELM_PROFILE_CFG, 0777);
-                                       }
-
                                        DIR *d = NULL;
                                        struct dirent *e;
 
@@ -781,13 +764,6 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *
                                                                        DEBUG_LOG("chown is failed %s", file_full_path);
                                                                        chmod (file_full_path, 0777);
                                                                }
-
-                                                               ret = security_server_label_access(file_full_path, "system::homedir");
-                                                               if (ret < 0)
-                                                               {
-                                                                       DEBUG_LOG("chsmack is failed %s", file_full_path);
-                                                                       chmod (file_full_path, 0777);
-                                                               }
                                                        }
                                                }
 
@@ -805,7 +781,7 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *
 
        if (access(deletedir, F_OK) == -1)
        {
-               DEBUG_ERROR("dest directory(%s) is not exist \n", deletedir);
+               DEBUG_ERROR("dest directory(%s) is not exist: %s\n", deletedir, strerror(errno));
                goto FAIL;
        }