apply extended concept of package's attribute. 16/99116/5
authorjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 22 Nov 2016 02:40:52 +0000 (11:40 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 24 Nov 2016 12:18:29 +0000 (21:18 +0900)
Requires :
https://review.tizen.org/gerrit/#/c/99039/

Change-Id: I56153446d3a277b5342cebb24422800247cbfd10
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/tpk/step/filesystem/step_tpk_patch_icons.cc
src/tpk/step/pkgmgr/step_convert_xml.cc
src/tpk/step/pkgmgr/step_manifest_adjustment.cc
src/tpk/tpk_installer.cc

index 0084f7b5ed2e8dde469f5423facd0782657e3773..17dcef3af03cf519df556e172d4c90e86630cd9b 100644 (file)
@@ -21,10 +21,10 @@ namespace {
 
 // This function checks for alternative locations of icon file of tpk package
 bf::path LocateIcon(const bf::path& filename, const std::string& pkgid,
-                    const bf::path& root_path, uid_t uid, bool is_preload) {
+                    const bf::path& root_path, uid_t uid, bool is_readonly) {
   std::vector<bf::path> locations;
-  // FIXME: icons for preloaded apps should also be moved to "shared/res"
-  const char* extra_icon_path = getIconPath(uid, is_preload);
+  // FIXME: icons for readonly apps should also be moved to "shared/res"
+  const char* extra_icon_path = getIconPath(uid, is_readonly);
   if (extra_icon_path) {
     bf::path system_location = bf::path(extra_icon_path) / filename;
     bf::path small_system_location =
@@ -75,7 +75,7 @@ common_installer::Step::Status StepTpkPatchIcons::FixIconLocation(
                                context_->pkgid.get(),
                                context_->root_application_path.get(),
                                context_->uid.get(),
-                               context_->is_preload_request.get());
+                               context_->is_readonly_package.get());
   if (!source.empty()) {
     LOG(DEBUG) << "Fix location of icon: " << source << " to: " << icon_text;
     if (!common_installer::CopyFile(source, icon_text)) {
@@ -103,8 +103,8 @@ common_installer::Step::Status StepTpkPatchIcons::process() {
                                                   icon_text, app, icon);
 
         if (status != Status::OK) {
-          // ignore copying result in offline for preload apps
-          if (strcmp(context_->manifest_data.get()->preload, "true") == 0) {
+          // ignore copying result in offline for readonly apps
+          if (strcmp(context_->manifest_data.get()->readonly, "true") == 0) {
             // FIXME: there is no destructor of icon_x exposed but we need to
             // remove it. Removing whole list as no valid copy made of any icon.
             g_list_free_full(app->icon, [](gpointer data) {
index cf4ab56e8b8243146aaef6d7e38d273ae8cf9915..15298bcbc9f1cf867c9821e4fb14926df238d606 100644 (file)
@@ -92,7 +92,7 @@ common_installer::Step::Status StepConvertXml::process() {
 
   bf::path new_path =
       bf::path(getUserManifestPath(context_->uid.get(),
-         context_->is_preload_request.get()))
+         context_->is_readonly_package.get()))
       / bf::path(context_->pkgid.get());
   new_path += ".xml";
   if (!bf::exists(new_path.parent_path())) {
index 3d2ff13feef3947885e92d991d577295069a89cd..2c2a1a416b9743d710f07d2c830235cbc5dfb640 100644 (file)
@@ -54,6 +54,17 @@ common_installer::Step::Status StepManifestAdjustment::process() {
     return Step::Status::ERROR;
   }
 
+  std::string readonly_attrib = "readonly";
+  attrib = xmlSetProp(node,
+      reinterpret_cast<libxml_char>(readonly_attrib.c_str()),
+      reinterpret_cast<libxml_char>(context_->manifest_data.get()->readonly));
+
+  if (attrib == nullptr) {
+    LOG(ERROR) << "Failed to set attribute readonly";
+    xmlFreeDoc(doc);
+    return Step::Status::ERROR;
+  }
+
   std::string preload_attrib = "preload";
   attrib = xmlSetProp(node,
       reinterpret_cast<libxml_char>(preload_attrib.c_str()),
@@ -65,6 +76,17 @@ common_installer::Step::Status StepManifestAdjustment::process() {
     return Step::Status::ERROR;
   }
 
+  std::string removable_attrib = "removable";
+  attrib = xmlSetProp(node,
+      reinterpret_cast<libxml_char>(removable_attrib.c_str()),
+      reinterpret_cast<libxml_char>(context_->manifest_data.get()->removable));
+
+  if (attrib == nullptr) {
+    LOG(ERROR) << "Failed to set attribute removable";
+    xmlFreeDoc(doc);
+    return Step::Status::ERROR;
+  }
+
   if (xmlSaveFile(xml_path_.c_str(), doc) == -1) {
     LOG(ERROR) << "Failed to modify xml file";
     xmlFreeDoc(doc);
index 4c658cc90dc36e261f2328f70a34af49d0bc2faa..114d9bc909c3b8fa58f15e9ef7bde341d1d3bcfb 100644 (file)
@@ -304,6 +304,7 @@ void TpkInstaller::DeltaSteps() {
   AddStep<ci::configuration::StepParseManifest>(
       ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
       ci::configuration::StepParseManifest::StoreLocation::BACKUP);
+  AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
   AddStep<ci::filesystem::StepEnableExternalMount>();
   AddStep<ci::filesystem::StepDeltaPatch>();