Add old_manifest_data property to context for update 12/38512/1
authorTomasz Iwanek <t.iwanek@samsung.com>
Tue, 24 Mar 2015 15:22:00 +0000 (16:22 +0100)
committerTomasz Iwanek <t.iwanek@samsung.com>
Tue, 21 Apr 2015 13:30:43 +0000 (15:30 +0200)
Update installation will use this value to
restore security context if needed on rollback
operation.

For now, I'm leaving one context per all installation
types.

Tizen-JIRA: TC-2482

Change-Id: If0143e9036bd2149a0a1ba1d2aa359441785540e

src/common/context_installer.cc
src/common/context_installer.h

index 6767991..17b2e2b 100644 (file)
@@ -15,6 +15,7 @@ namespace fs = boost::filesystem;
 
 ContextInstaller::ContextInstaller()
     : manifest_data(static_cast<manifest_x*>(calloc(1, sizeof(manifest_x)))),
+      old_manifest_data(nullptr),
       uid(getuid()) {
 
     std::string root_app_path =
@@ -28,6 +29,8 @@ ContextInstaller::ContextInstaller()
 ContextInstaller::~ContextInstaller() {
   if (manifest_data.get())
     pkgmgr_parser_free_manifest_xml(manifest_data.get());
+  if (old_manifest_data.get())
+    pkgmgr_parser_free_manifest_xml(old_manifest_data.get());
 }
 
 }  // namespace common_installer
index 9872e54..d82742c 100644 (file)
@@ -60,6 +60,9 @@ class ContextInstaller {
   //  manifest information used to generate xml file
   Property<manifest_x*> manifest_data;
 
+  //  manifest information used to revert an update
+  Property<manifest_x*> old_manifest_data;
+
   // path to manifest xml file used to register data in databases
   Property<boost::filesystem::path> xml_path;