Change to use pkgmgr-info instead of package-manager
authorSunwook Bae <sunwook45.bae@samsung.com>
Thu, 29 Aug 2013 05:47:24 +0000 (14:47 +0900)
committerSunwook Bae <sunwook45.bae@samsung.com>
Thu, 29 Aug 2013 05:47:24 +0000 (14:47 +0900)
Change-Id: I45e8fc4002a8a2e6b3011554afd61fd94c795eb5
Signed-off-by: Sunwook Bae <sunwook45.bae@samsung.com>
CMakeLists.txt
packaging/osp-channel-service.spec
src/FIo_MessagePortService.cpp

index 1c9d2e6..4ed2421 100644 (file)
@@ -63,7 +63,7 @@ TARGET_LINK_LIBRARIES(${this_target} "-lpthread" )
 TARGET_LINK_LIBRARIES(${this_target} "-lcrypto" )
 TARGET_LINK_LIBRARIES(${this_target} "-lsoup-2.4" )
 TARGET_LINK_LIBRARIES(${this_target} "-laul" )
-TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-package-manager" )
+TARGET_LINK_LIBRARIES(${this_target} "-lpkgmgr-info" )
 TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp-server -losp-appfw-server")
 
 ## Cory additional info
index 64ba06c..2522f97 100755 (executable)
@@ -17,7 +17,7 @@ BuildRequires:        pkgconfig(libsmack)
 BuildRequires: pkgconfig(message-port)
 BuildRequires: pkgconfig(openssl)
 BuildRequires:  pkgconfig(aul)
-BuildRequires:  pkgconfig(capi-appfw-package-manager)
+BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  osp-appfw-internal-devel
 BuildRequires:  hash-signer
 
index 5aaa6ae..6f6253f 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <bundle.h>
 #include <message-port.h>
-#include <package_manager.h>
+#include <pkgmgr-info.h>
 
 #include <FBaseStringComparer.h>
 #include <FBaseSysLog.h>
@@ -295,25 +295,38 @@ _MessagePortService::IsPreloaded(const String& localAppId, const String& remoteA
        unique_ptr<char[]> pLocalAppId(_StringConverter::CopyToCharArrayN(localAppId));
        unique_ptr<char[]> pRemoteAppId(_StringConverter::CopyToCharArrayN(remoteAppId));
 
-       int ret = package_manager_is_preload_package_by_app_id(pLocalAppId.get(), &preload_local);
-       if (ret == 0)
+       pkgmgrinfo_appinfo_h handle = null;
+       int ret = pkgmgrinfo_appinfo_get_appinfo(pLocalAppId.get(), &handle);
+       if (ret != PMINFO_R_OK)
        {
-               ret = package_manager_is_preload_package_by_app_id(pRemoteAppId.get(), &preload_remote);
-               if (ret == 0)
-               {
-                       if (preload_local && preload_remote)
-                       {
-                               return true;
-                       }
-               }
-               else
-               {
-                       SysLog(NID_IO, "Failed to check the preloaded application. %d", ret);
-               }
+               SysLog(NID_IO, "Failed to get the appinfo. %d", ret);
+               return false;
        }
-       else
+       ret = pkgmgrinfo_appinfo_is_preload(handle, &preload_local);
+       if (ret != PMINFO_R_OK)
        {
                SysLog(NID_IO, "Failed to check the preloaded application. %d", ret);
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return false;
+       }
+
+       ret = pkgmgrinfo_appinfo_get_appinfo(pRemoteAppId.get(), &handle);
+       if (ret != PMINFO_R_OK)
+       {
+               SysLog(NID_IO, "Failed to get the appinfo. %d", ret);
+               return false;
+       }
+       ret = pkgmgrinfo_appinfo_is_preload(handle, &preload_remote);
+       if (ret != PMINFO_R_OK)
+       {
+               SysLog(NID_IO, "Failed to check the preloaded application. %d", ret);
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return false;
+       }
+
+       if (preload_local && preload_remote)
+       {
+               return true;
        }
 
        return false;
@@ -322,16 +335,15 @@ _MessagePortService::IsPreloaded(const String& localAppId, const String& remoteA
 int
 _MessagePortService::CheckCertificate(const String& localAppId, const String& remoteAppId) const
 {
-       package_manager_compare_result_type_e res;
-
        unique_ptr<char[]> pLocalAppId(_StringConverter::CopyToCharArrayN(localAppId));
        unique_ptr<char[]> pRemoteAppId(_StringConverter::CopyToCharArrayN(remoteAppId));
 
-       int ret = package_manager_compare_app_cert_info(pLocalAppId.get(), pRemoteAppId.get(), &res);
+       pkgmgrinfo_cert_compare_result_type_e res;
+       int ret = pkgmgrinfo_pkginfo_compare_app_cert_info(pLocalAppId.get(), pRemoteAppId.get(), &res);
        SysTryReturn(NID_IO, ret == 0, MESSAGEPORT_ERROR_IO_ERROR, E_SYSTEM,
                                "[E_SYSTEM] Failed to check the certificate: %d", ret);
 
-       SysTryReturn(NID_IO, res == PACAKGE_MANAGER_COMPARE_MATCH, MESSAGEPORT_ERROR_CERTIFICATE_NOT_MATCH, E_CERTIFICATE_VERIFICATION_FAILED,
+       SysTryReturn(NID_IO, res == PMINFO_CERT_COMPARE_MATCH, MESSAGEPORT_ERROR_CERTIFICATE_NOT_MATCH, E_CERTIFICATE_VERIFICATION_FAILED,
                                "[E_CERTIFICATE_VERIFICATION_FAILED] Both applications are not signed with the same certificate: %d", res);
 
        return 0;