[Release] wrt-installer_0.1.114
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_manifest_file.cpp
old mode 100755 (executable)
new mode 100644 (file)
index b4eb7db..37d856e
@@ -117,7 +117,6 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
         AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
         AddStep(&TaskManifestFile::stepCreateExecFile);
         AddStep(&TaskManifestFile::stepGenerateManifest);
-        AddStep(&TaskManifestFile::stepParseManifest);
 
         AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
     } else {
@@ -125,9 +124,6 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
         AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
         AddStep(&TaskManifestFile::stepCreateExecFile);
         AddStep(&TaskManifestFile::stepGenerateManifest);
-        AddStep(&TaskManifestFile::stepParseManifest);
-
-        AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
     }
 }
 
@@ -179,7 +175,7 @@ void TaskManifestFile::stepCreateExecFile()
     }
 #else
     //default widget
-    LogInfo("link -s " << clientExeStr << " " << exec);
+    LogDebug("link -s " << clientExeStr << " " << exec);
     errno = 0;
     if (symlink(clientExeStr.c_str(), exec.c_str()) != 0)
     {
@@ -210,21 +206,30 @@ void TaskManifestFile::stepCopyIconFiles()
     WrtDB::WidgetRegisterInfo::LocalizedIconList & icons =
         m_context.widgetConfig.localizationData.icons;
 
-    //reversed: last <icon> has highest priority to be copied if it has given
-    // locale (TODO: why was that working that way?)
-    for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
-         icon = icons.rbegin();
-         icon != icons.rend();
+    for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_iterator
+         icon = icons.begin();
+         icon != icons.end();
          ++icon)
     {
+        DPL::String src = icon->src;
         FOREACH(locale, icon->availableLocales)
         {
-            DPL::String src = icon->src;
-            LogDebug("Icon for locale: " << *locale << "is : " << src);
+            LogDebug("Icon for locale: " << *locale << "is: " << src);
 
             if (std::find(generatedLocales.begin(), generatedLocales.end(),
-                          *locale) != generatedLocales.end())
+                    *locale) != generatedLocales.end())
             {
+                if (icon->src == L"icon.jpg") {
+                    generatedLocales.push_back(*locale);
+                } else if (icon->src == L"icon.gif") {
+                    generatedLocales.push_back(*locale);
+                } else if (icon->src == L"icon.png") {
+                    generatedLocales.push_back(*locale);
+                } else if (icon->src == L"icon.ico") {
+                    generatedLocales.push_back(*locale);
+                } else if (icon->src == L"icon.svg") {
+                    generatedLocales.push_back(*locale);
+                }
                 LogDebug("Skipping - has that locale");
                 continue;
             } else {
@@ -480,7 +485,7 @@ void TaskManifestFile::saveLocalizedKey(std::ofstream &file,
 
 void TaskManifestFile::backupIconFiles()
 {
-    LogInfo("Backup Icon Files");
+    LogDebug("Backup Icon Files");
 
     std::ostringstream b_icon_dir;
     b_icon_dir << backup_dir.str() << "icons";
@@ -590,53 +595,11 @@ void TaskManifestFile::stepGenerateManifest()
     commit_manifest = destFile.str();
     LogDebug("Commiting manifest file : " << commit_manifest);
 
-    m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_CREATE_MANIFEST,
-        "Widget Manifest Creation Finished");
-}
-
-void TaskManifestFile::stepParseManifest()
-{
-    int code = 0;
-    char* updateTags[3] = {NULL, };
-
-    if (!m_context.mode.removable) {
-        updateTags[0] = "preload=false";
-        updateTags[1] = "removable=false";
-        updateTags[2] = NULL;
-
-    }
-
     commitManifest();
 
-    if (m_context.isUpdateMode || (
-                m_context.mode.rootPath == InstallMode::RootPath::RO
-                && m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
-                && m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
-
-        if (m_context.widgetConfig.packagingType != PKG_TYPE_HYBRID_WEB_APP) {
-            code = pkgmgr_parser_parse_manifest_for_upgrade(
-                    commit_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
-
-            if (code != 0) {
-                LogError("Manifest parser error: " << code);
-                ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
-            }
-        }
-    } else {
-        code = pkgmgr_parser_parse_manifest_for_installation(
-                commit_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
-
-        if (code != 0) {
-            LogError("Manifest parser error: " << code);
-            ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
-        }
-    }
-
     m_context.job->UpdateProgress(
-            InstallerContext::INSTALL_CREATE_MANIFEST,
-            "Widget Manifest Parsing Finished");
-    LogDebug("Manifest parsed");
+        InstallerContext::INSTALL_CREATE_MANIFEST,
+        "Widget Manifest Creation Finished");
 }
 
 void TaskManifestFile::commitManifest()
@@ -645,7 +608,7 @@ void TaskManifestFile::commitManifest()
     if (!(m_context.mode.rootPath == InstallMode::RootPath::RO &&
                 m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
                 && m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
-        LogInfo("cp " << manifest_file << " " << commit_manifest);
+        LogDebug("cp " << manifest_file << " " << commit_manifest);
 
         DPL::FileInput input(DPL::ToUTF8String(manifest_file));
         DPL::FileOutput output(commit_manifest);
@@ -946,6 +909,10 @@ void TaskManifestFile::setWidgetManifest(Manifest & manifest)
     DPL::String name = (!!m_context.widgetConfig.configInfo.authorName ?
                         *m_context.widgetConfig.configInfo.authorName : L"");
     manifest.addAuthor(Author(email, href, L"", name));
+
+    if (!m_context.callerPkgId.empty()) {
+        manifest.setStoreClientId(m_context.callerPkgId);
+    }
 }
 
 void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp)
@@ -976,7 +943,7 @@ void TaskManifestFile::setAppControlsInfo(UiApplication & uiApp)
         m_context.widgetConfig.configInfo.appControlList;
 
     if (appControlList.empty()) {
-        LogInfo("Widget doesn't contain app control");
+        LogDebug("Widget doesn't contain app control");
         return;
     }
 
@@ -1013,7 +980,7 @@ void TaskManifestFile::setAppCategory(UiApplication &uiApp)
         m_context.widgetConfig.configInfo.categoryList;
 
     if (categoryList.empty()) {
-        LogInfo("Widget doesn't contain application category");
+        LogDebug("Widget doesn't contain application category");
         return;
     }
     FOREACH(it, categoryList) {
@@ -1029,7 +996,7 @@ void TaskManifestFile::setMetadata(UiApplication &uiApp)
         m_context.widgetConfig.configInfo.metadataList;
 
     if (metadataList.empty()) {
-        LogInfo("Web application doesn't contain metadata");
+        LogDebug("Web application doesn't contain metadata");
         return;
     }
     FOREACH(it, metadataList) {
@@ -1038,27 +1005,10 @@ void TaskManifestFile::setMetadata(UiApplication &uiApp)
     }
 }
 
-void TaskManifestFile::stepAbortParseManifest()
-{
-    LogError("[Parse Manifest] Abroting....");
-
-    int code = pkgmgr_parser_parse_manifest_for_uninstallation(
-            DPL::ToUTF8String(manifest_file).c_str(), NULL);
-
-    if (0 != code) {
-        LogWarning("Manifest parser error: " << code);
-        ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
-    }
-    int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
-    if (0 != ret) {
-        LogWarning("No manifest file found: " << manifest_file);
-    }
-}
-
 void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
 {
     FOREACH(it, m_context.widgetConfig.configInfo.m_livebox) {
-        LogInfo("setLiveBoxInfo");
+        LogDebug("setLiveBoxInfo");
         LiveBoxInfo liveBox;
         DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
         DPL::String appid = m_context.widgetConfig.tzAppid;
@@ -1120,7 +1070,7 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
         if (ConfigInfo->m_boxInfo.m_boxSrc.empty() ||
             ConfigInfo->m_boxInfo.m_boxSize.empty())
         {
-            LogInfo("Widget doesn't contain box");
+            LogDebug("Widget doesn't contain box");
             return;
         } else {
             BoxInfoType box;
@@ -1203,11 +1153,11 @@ void TaskManifestFile::setAccount(Manifest& manifest)
     AccountProviderType provider;
 
     if (account.m_iconSet.empty()) {
-        LogInfo("Widget doesn't contain Account");
+        LogDebug("Widget doesn't contain Account");
         return;
     }
     if (account.m_multiAccountSupport) {
-        provider.multiAccount = L"ture";
+        provider.multiAccount = L"true";
     } else {
         provider.multiAccount = L"false";
     }
@@ -1254,5 +1204,14 @@ void TaskManifestFile::setPrivilege(Manifest& manifest)
     manifest.addPrivileges(privilege);
 }
 
+void TaskManifestFile::StartStep()
+{
+
+}
+
+void TaskManifestFile::EndStep()
+{
+
+}
 } //namespace WidgetInstall
 } //namespace Jobs