#include <manifest_parser/utils/version_number.h>
#include <pkgmgrinfo_basic.h>
-#include <vconf.h>
#include <cstring>
#include <string>
#include "common/installer_context.h"
-#include "common/utils/glist_range.h"
namespace {
const char kPlatformVersion[] = TIZEN_FULL_VERSION;
-const char kDotnetAppType[] = "dotnet";
-const char kDotnetAPILevelVconfKey[] = "db/dotnet/tizen_api_version";
int CompareVersion(const std::string& a, const std::string& b) {
utils::VersionNumber a_ver(a);
Step::Status StepCheckTizenVersion::process() {
const char* version = context_->manifest_data.get()->api_version;
- if (IsDotnetAppExist()) {
- if (!CompareDotnetVersion(version))
- return Status::OPERATION_NOT_ALLOWED;
- } else {
- if (!ComparePlatformVersion(version))
- return Status::OPERATION_NOT_ALLOWED;
- }
+ if (!ComparePlatformVersion(version))
+ return Status::OPERATION_NOT_ALLOWED;
+
return Status::OK;
}
}
bool StepCheckTizenVersion::IsDotnetAppExist() {
- GList* applications = context_->manifest_data.get()->application;
- for (const auto& app : GListRange<application_x*>(applications)) {
- if (!strcmp(app->type, kDotnetAppType))
- return true;
- }
-
+ // Does nothing. Don't delete this until someone overrides this delete it.
return false;
}
return true;
}
-bool StepCheckTizenVersion::CompareDotnetVersion(const std::string& version) {
- int dotnet_api_level;
- if (vconf_get_int(kDotnetAPILevelVconfKey, &dotnet_api_level)) {
- if (!context_->is_readonly_package.get() &&
- !context_->is_preload_rw_package.get()) {
- LOG(ERROR) << "Failed to get platform dotnet API level";
- return false;
- } else {
- // During platform image creation stage, vconf API does not work and
- // version check fails. This is workaround for this case.
- return true;
- }
- }
- if (CompareVersion(std::to_string(dotnet_api_level), version) < 0) {
- LOG(ERROR) << "Package's dotnet API level(" << version << ") is higher "
- << "than platform dotnet API level(" << dotnet_api_level << ")";
- return false;
- }
- return true;
-}
-
} // namespace configuration
} // namespace common_installer