Version of widget (defined in w3c spec) is less strict than tizen
package number. This commit fixes GetPackageVersion() to set
default version if conversion of version number is not possible.
To verify, install/update wgt package which version is "1.2.3 Beta".
"Beta" keyword should be trucated so that manifest contains valid
version of tizen package -> "1.2.3".
Change-Id: Iab5eed29f8cb7c8a0a52cb515c16ce0ab5d1ac91
#include <common/installer_context.h>
#include <common/step/step.h>
#include <common/utils/glist_range.h>
#include <common/installer_context.h>
#include <common/step/step.h>
#include <common/utils/glist_range.h>
+#include <manifest_parser/utils/version_number.h>
#include <wgt_manifest_handlers/account_handler.h>
#include <wgt_manifest_handlers/app_control_handler.h>
#include <wgt_manifest_handlers/application_icons_handler.h>
#include <wgt_manifest_handlers/account_handler.h>
#include <wgt_manifest_handlers/app_control_handler.h>
#include <wgt_manifest_handlers/application_icons_handler.h>
return perm_info->GetAPIPermissions();
}
return perm_info->GetAPIPermissions();
}
-const std::string& StepParse::GetPackageVersion(
+std::string StepParse::GetPackageVersion(
const std::string& manifest_version) {
const std::string& manifest_version) {
- if (!manifest_version.empty())
- return manifest_version;
- return kManifestVersion;
+ if (manifest_version.empty()) {
+ return kManifestVersion;
+ }
+ std::string version = manifest_version.substr(0,
+ manifest_version.find_first_not_of("1234567890."));
+
+ utils::VersionNumber version_number(version);
+
+ if (!version_number.IsValidTizenPackageVersion()) {
+ LOG(WARNING) << "Version number: " << manifest_version
+ << " is not valid version number for tizen package. "
+ << "Default value will be used.";
+ return kManifestVersion;
+ }
+
+ return version_number.ToString();
}
bool StepParse::FillInstallationInfo(manifest_x* manifest) {
}
bool StepParse::FillInstallationInfo(manifest_x* manifest) {
std::set<std::string> ExtractPrivileges(
std::shared_ptr<const PermissionsInfo> perm_info) const;
std::set<std::string> ExtractPrivileges(
std::shared_ptr<const PermissionsInfo> perm_info) const;
- const std::string& GetPackageVersion(const std::string& manifest_version);
+ std::string GetPackageVersion(const std::string& manifest_version);
bool FillInstallationInfo(manifest_x* manifest);
bool FillIconPaths(manifest_x* manifest);
bool FillInstallationInfo(manifest_x* manifest);
bool FillIconPaths(manifest_x* manifest);