|
@@ -215,7 +215,9 @@ namespace Task
|
|
|
|
|
|
}else if(m_fsm->m_currentTask.cPendingState=="T"){
|
|
|
if (m_fsm->m_currentTask.task_type.Compare("U") == 0) {
|
|
|
- if (m_fsm->m_currentTask.NewVersion == m_fsm->m_currentVersion.ToString() || m_fsm->m_currentTask.NewVersion == "") {
|
|
|
+ if (m_fsm->m_currentTask.NewVersion == m_fsm->m_currentVersion.ToString() ||
|
|
|
+ m_fsm->m_currentTask.depNewVersion == m_fsm->m_currentDepVersion ||
|
|
|
+ (m_fsm->m_currentTask.NewVersion == "" && m_fsm->m_currentTask.depNewVersion == "")) {
|
|
|
//升级成功
|
|
|
rootReq["upgrade_status"] = "S";//成功
|
|
|
}
|
|
@@ -225,7 +227,8 @@ namespace Task
|
|
|
}
|
|
|
}
|
|
|
else if (m_fsm->m_currentTask.task_type.Compare("R") == 0) {
|
|
|
- if (m_fsm->m_currentTask.NewVersion == m_fsm->m_currentVersion.ToString()) {
|
|
|
+ if (m_fsm->m_currentTask.NewVersion == m_fsm->m_currentVersion.ToString()||
|
|
|
+ m_fsm->m_currentTask.depNewVersion == m_fsm->m_currentDepVersion) {
|
|
|
//升级成功
|
|
|
rootReq["upgrade_status"] = "S";//成功
|
|
|
}
|
|
@@ -336,6 +339,8 @@ namespace Task
|
|
|
CSimpleStringA strMachineVersion = CSimpleStringA::Format("%d.%d",info.MachineVersion.GetMajor(),info.MachineVersion.GetMinor());
|
|
|
//框架版本
|
|
|
CSimpleStringA strInstallVersion = m_fsm->m_currentVersion.ToString();
|
|
|
+ //适配器版本
|
|
|
+ CSimpleStringA strDepVersion = m_fsm->m_currentDepVersion;
|
|
|
// OS版本
|
|
|
#ifdef RVC_OS_WIN
|
|
|
OSVERSIONINFO osvi;
|
|
@@ -363,6 +368,7 @@ namespace Task
|
|
|
rootReq["software_version"] = strInstallVersion.GetData();
|
|
|
rootReq["os_version"] = strOSVersion.GetData();
|
|
|
rootReq["machine_version"] = strMachineVersion.GetData();
|
|
|
+ rootReq["dep_version"] = strDepVersion.GetData();//适配器版本
|
|
|
|
|
|
string jsonReq = writer.write(rootReq);
|
|
|
qTempReq.m_reqStr = jsonReq;//请求参数
|
|
@@ -685,6 +691,8 @@ namespace Task
|
|
|
CSimpleStringA strMachineVersion = CSimpleStringA::Format("%d.%d",info.MachineVersion.GetMajor(),info.MachineVersion.GetMinor());
|
|
|
//框架版本
|
|
|
CSimpleStringA strInstallVersion = m_fsm->m_currentVersion.ToString();
|
|
|
+ //适配器版本
|
|
|
+ CSimpleStringA strDepVersion = m_fsm->m_currentDepVersion;
|
|
|
// OS版本
|
|
|
#ifdef RVC_OS_WIN
|
|
|
OSVERSIONINFO osvi;
|
|
@@ -713,6 +721,7 @@ namespace Task
|
|
|
rootReq["software_version"] = strInstallVersion.GetData();
|
|
|
rootReq["os_version"] = strOSVersion.GetData();
|
|
|
rootReq["machine_version"] = strMachineVersion.GetData();
|
|
|
+ rootReq["dep_version"] = strDepVersion.GetData();//适配器版本
|
|
|
//预查询判断加入查询何种任务。
|
|
|
if (m_fsm->isTerminalInstall()) {
|
|
|
rootReq["task_type"] = "I";//安装任务
|
|
@@ -818,6 +827,9 @@ namespace Task
|
|
|
CSimpleStringA strMachineVersion = CSimpleStringA::Format("%d.%d",info.MachineVersion.GetMajor(),info.MachineVersion.GetMinor());
|
|
|
//框架版本
|
|
|
CSimpleStringA strInstallVersion = m_fsm->m_currentVersion.ToString();
|
|
|
+ //适配器版本
|
|
|
+ CSimpleStringA strDepVersion = m_fsm->m_currentDepVersion;
|
|
|
+
|
|
|
// OS版本
|
|
|
#ifdef RVC_OS_WIN
|
|
|
OSVERSIONINFO osvi;
|
|
@@ -845,6 +857,7 @@ namespace Task
|
|
|
rootReq["software_version"] = strInstallVersion.GetData();
|
|
|
rootReq["os_version"] = strOSVersion.GetData();
|
|
|
rootReq["machine_version"] = strMachineVersion.GetData();
|
|
|
+ rootReq["dep_version"] = strDepVersion.GetData();//适配器版本
|
|
|
#ifdef RVC_OS_WIN
|
|
|
rootReq["system_type"] = "W";//表示是windows类型的机器
|
|
|
#else
|
|
@@ -1017,16 +1030,16 @@ namespace Task
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- CSimpleStringA packVersionStr = rootRet["data"]["pack_version"].asString().c_str();
|
|
|
- if(!packVersionStr.IsNullOrEmpty()){
|
|
|
- int rebootType = rootRet["data"]["reboot_type"].asInt();
|
|
|
- if(rebootType == 1 || rebootType == 2){
|
|
|
- return true;
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("ParamCheck")("QueryNewContinueTask paramCheck [pack_version] is not null ,[reboot_type] is not equal 1 or 2");
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+ //CSimpleStringA packVersionStr = rootRet["data"]["pack_version"].asString().c_str();
|
|
|
+ //if(!packVersionStr.IsNullOrEmpty()){
|
|
|
+ // int rebootType = rootRet["data"]["reboot_type"].asInt();
|
|
|
+ // if(rebootType == 1 || rebootType == 2){
|
|
|
+ // return true;
|
|
|
+ // }else{
|
|
|
+ // DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("ParamCheck")("QueryNewContinueTask paramCheck [pack_version] is not null ,[reboot_type] is not equal 1 or 2");
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -1605,8 +1618,12 @@ namespace Task
|
|
|
string packName = m_fsm->m_currentTask.pack_name.GetData();
|
|
|
CSimpleStringA errMsg ="";
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("InstallPackTask")("======begin ExecInstall======");
|
|
|
- failStatus = m_fsm->ExecInstall(errMsg);
|
|
|
-
|
|
|
+ if (!m_fsm->m_TempDepUpgradeFlag) {
|
|
|
+ failStatus = m_fsm->ExecInstall(errMsg);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ failStatus = m_fsm->ExecDepInstall(errMsg);
|
|
|
+ }
|
|
|
if(failStatus == 1){
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("InstallPackTask")("======end ExecInstall:succ======");
|
|
|
isInstallSucc =true;
|
|
@@ -1889,7 +1906,6 @@ bool CUpgradeTaskFSM::GetSysUpgradeResult(const char *pszResultLog, CSimpleStrin
|
|
|
|
|
|
int CUpgradeTaskFSM::ExecInstall(CSimpleStringA &strErrMsg)
|
|
|
{
|
|
|
-
|
|
|
//判断是否需要生成新版本
|
|
|
if(!m_currentTask.pack_version.IsNullOrEmpty()){
|
|
|
|
|
@@ -2440,77 +2456,183 @@ bool CUpgradeTaskFSM::ExecCpoyCmd(CSimpleStringA &strErrMsg,CInstallStep* ins)
|
|
|
|
|
|
bool CUpgradeTaskFSM::GetRootTypePath(int rootType,CSimpleStringA &Path)
|
|
|
{
|
|
|
- CSimpleStringA tempPath;
|
|
|
- if(rootType == 1){
|
|
|
|
|
|
- ErrorCodeEnum Error =m_pEntity->GetFunction()->GetPath("Root",tempPath);//例如:C:\Run /opt/Run
|
|
|
- if(Error_Succeed == Error){
|
|
|
- if(!tempPath.IsNullOrEmpty()){
|
|
|
- string runPathStr = tempPath.GetData();
|
|
|
- int pos = runPathStr.find_last_of(SPLIT_SLASH);
|
|
|
- Path = runPathStr.substr(0,pos).c_str();
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get Root path is null");
|
|
|
+ if (!m_TempDepUpgradeFlag) {
|
|
|
+ //升级
|
|
|
+ CSimpleStringA tempPath;
|
|
|
+ if (rootType == 1) {
|
|
|
+
|
|
|
+ ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("Root", tempPath);//例如:C:\Run /opt/Run
|
|
|
+ if (Error_Succeed == Error) {
|
|
|
+ if (!tempPath.IsNullOrEmpty()) {
|
|
|
+ string runPathStr = tempPath.GetData();
|
|
|
+ int pos = runPathStr.find_last_of(SPLIT_SLASH);
|
|
|
+ Path = runPathStr.substr(0, pos).c_str();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get Root path is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get Root path is error");
|
|
|
return false;
|
|
|
}
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get Root path is error");
|
|
|
- return false;
|
|
|
+
|
|
|
}
|
|
|
+ else if (rootType == 2) {
|
|
|
+
|
|
|
+ ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("Base", tempPath);//例如:C:\Run\version\4.8.1.1 /opt/Run/version/4.8.1.1
|
|
|
+ if (Error_Succeed == Error) {
|
|
|
+ if (!tempPath.IsNullOrEmpty()) {
|
|
|
+ Path = tempPath;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get currVer path is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get currVer path is error");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- }else if(rootType == 2){
|
|
|
+ }
|
|
|
+ else if (rootType == 3) {
|
|
|
|
|
|
- ErrorCodeEnum Error =m_pEntity->GetFunction()->GetPath("Base",tempPath);//例如:C:\Run\version\4.8.1.1 /opt/Run/version/4.8.1.1
|
|
|
- if(Error_Succeed == Error){
|
|
|
- if(!tempPath.IsNullOrEmpty()){
|
|
|
- Path = tempPath;
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get currVer path is null");
|
|
|
+ ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("RootVer", tempPath);//例如:C:\Run\version\4.9.1.1 /opt/Run/version/4.9.1.1
|
|
|
+ if (Error_Succeed == Error) {
|
|
|
+ if (!tempPath.IsNullOrEmpty()) {
|
|
|
+ Path = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", tempPath.GetData(), m_currentTask.pack_version.GetData());
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get currVer path is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get upgradeVer path is error");
|
|
|
return false;
|
|
|
}
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get currVer path is error");
|
|
|
- return false;
|
|
|
}
|
|
|
+ else if (rootType == 4) {
|
|
|
|
|
|
- }else if(rootType == 3){
|
|
|
+ ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("Downloads", tempPath);//例如:C:\rvc\Downloads\4.8.1.1 /opt/rvc/Downloads/4.8.1.1
|
|
|
+ if (Error_Succeed == Error) {
|
|
|
+ if (!tempPath.IsNullOrEmpty()) {
|
|
|
+ CSimpleStringA strUnzipDir;
|
|
|
+ strUnzipDir = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", tempPath.GetData(), m_currentTask.pack_name.GetData());
|
|
|
+ //解压去除了.zip后缀
|
|
|
+ if (strUnzipDir.IsEndWith(".zip")) {
|
|
|
+ Path = strUnzipDir.SubString(0, strUnzipDir.GetLength() - 4);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Path = strUnzipDir;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get upgradePack path is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get upgradePack path is error");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //适配器
|
|
|
+ CSimpleStringA tempPath;
|
|
|
+ if (rootType == 1) {
|
|
|
|
|
|
- ErrorCodeEnum Error =m_pEntity->GetFunction()->GetPath("RootVer",tempPath);//例如:C:\Run\version\4.9.1.1 /opt/Run/version/4.9.1.1
|
|
|
- if(Error_Succeed == Error){
|
|
|
- if(!tempPath.IsNullOrEmpty()){
|
|
|
- Path = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", tempPath.GetData(), m_currentTask.pack_version.GetData());
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get currVer path is null");
|
|
|
+ ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("Root", tempPath);//例如:C:\Run /opt/Run
|
|
|
+ if (Error_Succeed == Error) {
|
|
|
+ if (!tempPath.IsNullOrEmpty()) {
|
|
|
+ string runPathStr = tempPath.GetData();
|
|
|
+ int pos = runPathStr.find_last_of(SPLIT_SLASH);
|
|
|
+ Path = runPathStr.substr(0, pos).c_str();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get Root path is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get Root path is error");
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get upgradeVer path is error");
|
|
|
- return false;
|
|
|
+
|
|
|
}
|
|
|
- }else if(rootType == 4){
|
|
|
+ else if (rootType == 2) {
|
|
|
|
|
|
- ErrorCodeEnum Error =m_pEntity->GetFunction()->GetPath("Downloads",tempPath);//例如:C:\rvc\Downloads\4.8.1.1 /opt/rvc/Downloads/4.8.1.1
|
|
|
- if(Error_Succeed == Error){
|
|
|
- if(!tempPath.IsNullOrEmpty()){
|
|
|
- CSimpleStringA strUnzipDir;
|
|
|
- strUnzipDir = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", tempPath.GetData(), m_currentTask.pack_name.GetData());
|
|
|
- //解压去除了.zip后缀
|
|
|
- if (strUnzipDir.IsEndWith(".zip")){
|
|
|
- Path = strUnzipDir.SubString(0, strUnzipDir.GetLength()-4);
|
|
|
- }else{
|
|
|
- Path = strUnzipDir;
|
|
|
+ ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("Dep", tempPath);//例如:C:\Run\dep\4.8.1.1 /opt/Run/dep/4.8.1.1
|
|
|
+ if (Error_Succeed == Error) {
|
|
|
+ if (!tempPath.IsNullOrEmpty()) {
|
|
|
+ Path = tempPath;
|
|
|
}
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get upgradePack path is null");
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get currDepVer path is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get currDepVer path is error");
|
|
|
return false;
|
|
|
}
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get upgradePack path is error");
|
|
|
- return false;
|
|
|
+
|
|
|
}
|
|
|
+ else if (rootType == 3) {
|
|
|
+
|
|
|
+ ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("DepBase", tempPath);//例如:C:\Run\dep\4.9.1.1 /opt/Run/dep/4.9.1.1
|
|
|
+ if (Error_Succeed == Error) {
|
|
|
+ if (!tempPath.IsNullOrEmpty()) {
|
|
|
+ if (!m_currentTask.pack_version.IsNullOrEmpty()) {
|
|
|
+ Path = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", tempPath.GetData(), m_currentTask.pack_version.GetData());
|
|
|
+ }
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("m_currentTask.pack_version is null ,get currDepVer path is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get currDepVer path is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get upgradeVer path is error");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (rootType == 4) {
|
|
|
+
|
|
|
+ ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("Downloads", tempPath);//例如:C:\rvc\Downloads\4.8.1.1 /opt/rvc/Downloads/4.8.1.1
|
|
|
+ if (Error_Succeed == Error) {
|
|
|
+ if (!tempPath.IsNullOrEmpty()) {
|
|
|
+ CSimpleStringA strUnzipDir;
|
|
|
+ strUnzipDir = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", tempPath.GetData(), m_currentTask.pack_name.GetData());
|
|
|
+ //解压去除了.zip后缀
|
|
|
+ if (strUnzipDir.IsEndWith(".zip")) {
|
|
|
+ Path = strUnzipDir.SubString(0, strUnzipDir.GetLength() - 4);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Path = strUnzipDir;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get upgradePack path is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetRootTypePath")("get upgradePack path is error");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum CUpgradeTaskFSM::CopyFileOperate(const char* srcPath, const char* destPath, int nCopyMode, CSimpleStringA &strErrMsg)
|
|
@@ -3513,7 +3635,6 @@ ErrorCodeEnum CUpgradeTaskFSM::UnzipPack(const char* unZipPackName)
|
|
|
}
|
|
|
return Error_Succeed;
|
|
|
#endif
|
|
|
-
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum CUpgradeTaskFSM::DeleteUnzipDir()
|
|
@@ -3641,6 +3762,9 @@ bool CUpgradeTaskFSM::ClearCurrTaskInfo()
|
|
|
if (SetRunConfigStrValue("upgradeTask", "TaskType", "") != Error_Succeed) {
|
|
|
return false;
|
|
|
}
|
|
|
+ if (SetRunConfigStrValue("upgradeTask", "depNewVersion", "") != Error_Succeed) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
//试着删除可能临时下载的升级包文件
|
|
|
CSimpleStringA strPath;
|
|
@@ -3664,6 +3788,7 @@ bool CUpgradeTaskFSM::ClearCurrTaskInfo()
|
|
|
m_currentTask.cPendingState = "";
|
|
|
m_currentTask.NewVersion="";
|
|
|
m_currentTask.task_type = "";
|
|
|
+ m_currentTask.depNewVersion = "";
|
|
|
|
|
|
m_currentTask.pack_version = "";
|
|
|
m_currentTask.stop_media_play =false;
|
|
@@ -3673,13 +3798,6 @@ bool CUpgradeTaskFSM::ClearCurrTaskInfo()
|
|
|
m_currentTask.pack_hash = "";
|
|
|
m_currentTask.pack_length = 0;
|
|
|
|
|
|
- //清理安装步骤
|
|
|
- //int iCount = m_currentTask.install_step.size();
|
|
|
- //for (int j = 0; j < iCount; j++){
|
|
|
- // CInstallStep* tmp = m_currentTask.install_step.front();
|
|
|
- // m_currentTask.install_step.pop();
|
|
|
- // delete tmp;//删除对象
|
|
|
- //}
|
|
|
ClearInstallStep();
|
|
|
|
|
|
return true;
|
|
@@ -3747,6 +3865,13 @@ ErrorCodeEnum CUpgradeTaskFSM::LoadPersistTaskInfo()
|
|
|
}
|
|
|
taskInfo.task_type = strValue;
|
|
|
|
|
|
+ rc = GetRunConfigStrValue("upgradeTask", "depNewVersion", strValue);
|
|
|
+ if (rc != Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("LoadPersistTaskInfo")("recover upgrade state from run config, read [upgradeTask][depNewVersion] fail ,err=%d", (int)rc);
|
|
|
+ return rc;
|
|
|
+ }
|
|
|
+ taskInfo.depNewVersion = strValue;
|
|
|
+
|
|
|
//初始化其他变量
|
|
|
//CSimpleStringA pack_version; //升级包指定的版本号
|
|
|
//CSimpleStringA to_copy; //拷贝文件列表
|
|
@@ -3772,7 +3897,7 @@ ErrorCodeEnum CUpgradeTaskFSM::LoadPersistTaskInfo()
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("LoadPersistTaskInfo")("recover upgrade state from run config, PendingState=%s",taskInfo.cPendingState.GetData());
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("LoadPersistTaskInfo")("recover upgrade state from run config, NewVersion=%s",taskInfo.NewVersion.GetData());
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("LoadPersistTaskInfo")("recover upgrade state from run config, TaskType=%s", taskInfo.task_type.GetData());
|
|
|
-
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("LoadPersistTaskInfo")("recover upgrade state from run config, depNewVersion=%s", taskInfo.depNewVersion.GetData());
|
|
|
|
|
|
m_currentTask = taskInfo;
|
|
|
|
|
@@ -4338,6 +4463,287 @@ ErrorCodeEnum CUpgradeTaskFSM::RollBackVersionCheck(string& failReason, CSimpleS
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
|
+void CUpgradeTaskFSM::judgeTaskClass()
|
|
|
+{
|
|
|
+ //临时方案判定是适配器升级还是应用升级
|
|
|
+ if (isTerminalInstall()) {
|
|
|
+ //安装时判断
|
|
|
+ if (m_currentTask.pack_name.IndexOf("adapter") != -1) {
|
|
|
+ m_TempDepUpgradeFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //非安装时判断:判断只有一条拷贝dep路径的策略
|
|
|
+ if (!m_currentTask.install_step.empty()) {
|
|
|
+ int iCount = m_currentTask.install_step.size();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("judgeTaskClass")("install cmd size = %d", iCount);
|
|
|
+ if (iCount == 1) {
|
|
|
+ CInstallStep* tmp = m_currentTask.install_step.front();
|
|
|
+ if (tmp->cmdType == "Copy") {
|
|
|
+ if (tmp->srcPathType == "3") {
|
|
|
+ CSimpleStringA depStr = "";
|
|
|
+ depStr.Append(SPLIT_SLASH_STR).Append("dep").Append(SPLIT_SLASH_STR); //win :\dep\ uos: /dep/
|
|
|
+ if (tmp->srcPath.IndexOf(depStr.GetData()) != -1) {
|
|
|
+ m_TempDepUpgradeFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+int CUpgradeTaskFSM::ExecDepInstall(CSimpleStringA& strErrMsg)
|
|
|
+{
|
|
|
+ if (!isTerminalInstall()) {
|
|
|
+ //升级
|
|
|
+ if (!m_currentTask.pack_version.IsNullOrEmpty()) {
|
|
|
+
|
|
|
+ CSimpleStringA strUpgradeDepVersion = m_currentTask.pack_version;
|
|
|
+ CSimpleStringA latterDepVersion;//要更新到的版本号
|
|
|
+ CSimpleStringA curVer = m_currentDepVersion;//当前版本号
|
|
|
+ // 指定版本
|
|
|
+ latterDepVersion = strUpgradeDepVersion.GetData();
|
|
|
+ if (curVer == strUpgradeDepVersion) {
|
|
|
+ //版本号相同
|
|
|
+ strErrMsg = CSimpleStringA::Format("指定升级适配器版本号与当前版本相同,无效(配置:%s, 当前:%s)", strUpgradeDepVersion.GetData(), curVer.GetData());
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ CSimpleStringA strErrInfo = "";
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ExecDepInstall")("begin CreateNewDepVersion,version[%s],pack[%s]", strUpgradeDepVersion.GetData(), m_currentTask.pack_name.GetData());
|
|
|
+ ErrorCodeEnum rc = CreateNewDepVersion(latterDepVersion, strErrInfo);
|
|
|
+ if (rc != Error_Succeed)
|
|
|
+ {
|
|
|
+ strErrMsg = CSimpleStringA::Format("CreateNewDepVersion fail:%s", strErrInfo.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ExecDepInstall")("CreateNewDepVersion,version[%s] fail:%s", strUpgradeDepVersion.GetData(), strErrInfo.GetData());
|
|
|
+ //清理临时版本文件夹
|
|
|
+ ClearUpgradeFailDepVersion(latterDepVersion);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ m_currentTask.depNewVersion = strUpgradeDepVersion;//赋值升级适配器版本号给内存变量
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ExecDepInstall")("CreateNewDepVersion,version[%s] succ", strUpgradeDepVersion.GetData());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI("ExecDepInstall")("ExecDepInstall fail ,pack_version is null");
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (m_currentTask.pack_version.IsNullOrEmpty()) {
|
|
|
+ m_currentTask.pack_version = "0.0.0.1";//新安装,默认初始适配器版本
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //循环执行安装命令
|
|
|
+ int iRet = 1;//默认是成功
|
|
|
+ if (!m_currentTask.install_step.empty()) {
|
|
|
+
|
|
|
+ int iCount = m_currentTask.install_step.size();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ExecInstall")("install cmd size = %d", iCount);
|
|
|
+ for (int j = 0; j < iCount; j++) {
|
|
|
+ CInstallStep* tmp = m_currentTask.install_step.front();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ExecInstall")("=====begin cmd=[%s]=====", tmp->cmdType.GetData());
|
|
|
+ //开始处理具体命令
|
|
|
+ if (tmp->cmdType == "Delete") {
|
|
|
+ bool ret = ExecDeleteCmd(strErrMsg, tmp);
|
|
|
+ if (!ret) {
|
|
|
+ //报错才判断
|
|
|
+ if (tmp->cmdFail == 0) {
|
|
|
+ iRet = 0;
|
|
|
+ break;//出错直接退出
|
|
|
+ }
|
|
|
+ else if (tmp->cmdFail == 1) {
|
|
|
+ //继续
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ iRet = 0;
|
|
|
+ break;//其他值也退出
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (tmp->cmdType == "Copy") {
|
|
|
+
|
|
|
+ bool ret = ExecCpoyCmd(strErrMsg, tmp);
|
|
|
+ if (!ret) {
|
|
|
+ //报错才判断
|
|
|
+ if (tmp->cmdFail == 0) {
|
|
|
+ iRet = 0;
|
|
|
+ break;//出错直接退出
|
|
|
+ }
|
|
|
+ else if (tmp->cmdFail == 1) {
|
|
|
+ //继续
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ iRet = 0;
|
|
|
+ break;//其他值也退出
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (tmp->cmdType == "Run") {
|
|
|
+ int retInt = ExecRunCmd(strErrMsg, tmp);
|
|
|
+ if (retInt == 0 || retInt == -1) {
|
|
|
+ //报错才判断
|
|
|
+ if (tmp->cmdFail == 0) {
|
|
|
+ iRet = retInt;//会有0,-1值
|
|
|
+ break;//出错直接退出,并返回体系外结果
|
|
|
+ }
|
|
|
+ else if (tmp->cmdFail == 1) {
|
|
|
+ //继续
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ iRet = 0;
|
|
|
+ break;//其他值也退出
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ExecInstall")("cmd=[%s] is invalid", tmp->cmdType.GetData());
|
|
|
+ iRet = 0;
|
|
|
+ break;//命令无效直接退出
|
|
|
+ }
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ExecInstall")("=====end cmd=[%s]=====", tmp->cmdType.GetData());
|
|
|
+ m_currentTask.install_step.pop();//去除元素
|
|
|
+ delete tmp;//删除内存
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return iRet;//返回处理结果
|
|
|
+}
|
|
|
+
|
|
|
+ErrorCodeEnum CUpgradeTaskFSM::CreateNewDepVersion(CSimpleStringA NewSoftwareVersion, CSimpleStringA& strErrInfo)
|
|
|
+{
|
|
|
+ // 创建新适配器版本
|
|
|
+
|
|
|
+ CSimpleStringA rootDepPath;
|
|
|
+ ErrorCodeEnum rc = GetEntityBase()->GetFunction()->GetPath("DepBase", rootDepPath);//适配器根路径
|
|
|
+ if (rc != Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("Create new dep version fail , get DepBase path is fail");
|
|
|
+ strErrInfo = CSimpleStringA::Format("Create new dep version fail , get DepBase path is fail");
|
|
|
+ return Error_Bug;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSimpleStringA strCurDepPath;
|
|
|
+ rc = m_pEntity->GetFunction()->GetPath("Dep", strCurDepPath);//获取当前适配器根路径
|
|
|
+ if (rc != Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("Create new dep version fail , get Dep path is fail");
|
|
|
+ strErrInfo = CSimpleStringA::Format("Create new dep version fail , get Dep path is fail");
|
|
|
+ return Error_Bug;
|
|
|
+ }
|
|
|
+
|
|
|
+ //新路径
|
|
|
+ CSimpleStringA strNewVerPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR, rootDepPath.GetData(), NewSoftwareVersion.GetData());
|
|
|
+
|
|
|
+ if (m_currentDepVersion == NewSoftwareVersion)
|
|
|
+ {
|
|
|
+ LogWarn(Severity_Low, Error_Bug, ERR_TASK_INSTALL_VERSION_FAIL, CSimpleStringA::Format("new ver [%s] equals current ver [%s]", NewSoftwareVersion.GetData(), m_currentDepVersion.GetData()).GetData());
|
|
|
+ strErrInfo = CSimpleStringA::Format("new ver [%s] equals current ver [%s]", NewSoftwareVersion.GetData(), m_currentDepVersion.GetData());
|
|
|
+ return Error_Bug;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ExistsDirA(strNewVerPath.GetData()))
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("new version dir [%s] already exist, delete it", strNewVerPath.GetData());
|
|
|
+ if (!RemoveDirRecursiveA(strNewVerPath.GetData())) {
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("Create new dep version fail, delete already exist new dep version is fail:%d", GetLastError());
|
|
|
+ strErrInfo = CSimpleStringA::Format("Create new dep version fail, delete already exist new dep version is fail:%d", (int)GetLastError());
|
|
|
+#else
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("Create new dep version fail, delete already exist new dep version is fail:%d", errno);
|
|
|
+ strErrInfo = CSimpleStringA::Format("Create new dep version fail, delete already exist new dep version is fail:%d", errno);
|
|
|
+#endif
|
|
|
+ return Error_Bug;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!CreateDirA(strNewVerPath.GetData(), TRUE))
|
|
|
+ {
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("Create new dep version dir fail: %d", GetLastError());
|
|
|
+ strErrInfo = CSimpleStringA::Format("create new dep version dir fail: %d", (int)GetLastError());
|
|
|
+#else
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("Create new dep version dir fail: %d", errno);
|
|
|
+ strErrInfo = CSimpleStringA::Format("create new dep version dir fail: %d", errno);
|
|
|
+#endif
|
|
|
+ return Error_Unexpect;
|
|
|
+ }
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("create new dep version dir succ, dir = %s", strNewVerPath.GetData());
|
|
|
+ //增加错误信息字段,回传给上层应用
|
|
|
+ CSimpleStringA strErrMsg = "";
|
|
|
+
|
|
|
+ CSimpleStringA strSource = CSimpleStringA::Format("%s", strCurDepPath.GetData());
|
|
|
+ CSimpleStringA strDest = CSimpleStringA::Format("%s", strNewVerPath.GetData());
|
|
|
+
|
|
|
+ if (!RecursiveCopyDir(strSource, strDest, strErrMsg))
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("copy dep dir fail");
|
|
|
+ strErrInfo = CSimpleStringA::Format("copy dep dir fail: %s", strErrMsg.GetData());
|
|
|
+ return Error_Unexpect;
|
|
|
+ }
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CreateNewDepVersion")("copy dep dir succ");
|
|
|
+
|
|
|
+ return Error_Succeed;
|
|
|
+}
|
|
|
+
|
|
|
+ErrorCodeEnum CUpgradeTaskFSM::ClearUpgradeFailDepVersion(CSimpleStringA NewSoftwareVersion)
|
|
|
+{
|
|
|
+
|
|
|
+ CSimpleStringA rootDepPath;
|
|
|
+ ErrorCodeEnum rc = m_pEntity->GetFunction()->GetPath("DepBase", rootDepPath);//适配器根路径
|
|
|
+ if (rc != Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ClearUpgradeFailDepVersion")("ClearUpgradeFailDepVersion fail , get DepBase path is fail");
|
|
|
+ return Error_Bug;
|
|
|
+ }
|
|
|
+ //新路径
|
|
|
+ CSimpleStringA strNewVerPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR, rootDepPath.GetData(), NewSoftwareVersion.GetData());
|
|
|
+ if (ExistsDirA(strNewVerPath.GetData()))
|
|
|
+ {
|
|
|
+ if (!RemoveDirRecursiveA(strNewVerPath.GetData())) {
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ClearUpgradeFailDepVersion")("ClearUpgradeFailDepVersion fail, delete temp Version [%s] is fail:%d", strNewVerPath.GetData(), (int)GetLastError());
|
|
|
+#else
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ClearUpgradeFailDepVersion")("ClearUpgradeFailDepVersion fail, delete temp Version [%s] is fail:%d", strNewVerPath.GetData(), errno);
|
|
|
+#endif
|
|
|
+ return Error_Bug;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ClearUpgradeFailDepVersion")("ClearUpgradeFailDepVersion succ, delete temp Version [%s] ", strNewVerPath.GetData());
|
|
|
+ return Error_Succeed;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("ClearUpgradeFailDepVersion")("ClearUpgradeFailDepVersion succ, delete temp Version [%s] is not exist ", strNewVerPath.GetData());
|
|
|
+ return Error_Succeed;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+ErrorCodeEnum CUpgradeTaskFSM::UpgradeDepToNewVersion()
|
|
|
+{
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpgradeDepToNewVersion")("begin UpgradeToDepNewVersion");
|
|
|
+ //获取新版本号
|
|
|
+ if (m_currentTask.depNewVersion.IsNullOrEmpty()) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpgradeDepToNewVersion")("NewDepVersion is null, pack_version=[%s] is not null,UpgradeToNewDepVersion fail, taskID=[%s]", m_currentTask.pack_version.GetData(), m_currentTask.upgradeTaskId.GetData());
|
|
|
+ LogWarn(Severity_Middle, Error_Exception, ERR_TASK_UPDATE_ACTIVE_FAIL, CSimpleStringA::Format("UpgradeToNewDepVersion fail, NewDepVersion is null, pack_version [%s] is not null,fail", m_currentTask.pack_version.GetData()).GetData());
|
|
|
+ return Error_Unexpect;//这种情况有问题,需要清除此任务
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ ErrorCodeEnum ec = GetEntityBase()->GetFunction()->GetPrivilegeFunction()->RewriteDepVersion(m_currentTask.depNewVersion, false);
|
|
|
+ if (ec != Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpgradeDepToNewVersion")("UpgradeDepToNewVersion fail, RewriteDepVersion version %s return %s", m_currentTask.depNewVersion.GetData(),SpStrError(ec));
|
|
|
+ LogWarn(Severity_Middle, Error_Exception, ERR_TASK_UPDATE_ACTIVE_FAIL, CSimpleStringA::Format("UpgradeToNewVersion: get RootVer path is fail", m_currentTask.depNewVersion.GetData(), SpStrError(ec)));
|
|
|
+ }
|
|
|
+ return ec;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
ErrorCodeEnum CUpgradeTaskFSM::SM3FileToStr(CSimpleStringA strFilePath, CSimpleStringA &strSM3,bool isSub)
|
|
|
{
|
|
|
if(strFilePath.IsNullOrEmpty()){
|
|
@@ -4601,43 +5007,73 @@ ErrorCodeEnum CUpgradeTaskFSM::SwitchUpgradeNow()
|
|
|
|
|
|
}else if(m_currentTask.reboot_type == 1){
|
|
|
|
|
|
- if(m_currentTask.NewVersion.IsNullOrEmpty()){
|
|
|
- //非版本升级
|
|
|
- LogEvent(Severity_Middle, Event_Req_Framework_No_Upgrade_Restart,
|
|
|
- CSimpleStringA::Format("upgrade to new version [%s] succeed, request to no upgrade restart framework , taskID=[%s]", m_currentVersion.ToString().GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
- PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
- }else{
|
|
|
+ if (m_TempDepUpgradeFlag) {
|
|
|
+ if (m_currentTask.NewVersion.IsNullOrEmpty()) {
|
|
|
+ //非版本升级
|
|
|
+ LogEvent(Severity_Middle, Event_Req_Framework_No_Upgrade_Restart,
|
|
|
+ CSimpleStringA::Format("upgrade to new version [%s] succeed, request to no upgrade restart framework , taskID=[%s]", m_currentVersion.ToString().GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (m_currentTask.task_type.Compare("U") == 0) {
|
|
|
+ //版本升级,健康有后续回退处理
|
|
|
+ LogEvent(Severity_Middle, Event_Req_Framework_Restart,
|
|
|
+ CSimpleStringA::Format("upgrade to new version [%s] succeed, request to restart framework , taskID=[%s]", m_currentTask.NewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
+ }
|
|
|
+ else if (m_currentTask.task_type.Compare("R") == 0) {
|
|
|
+ //版本回退,健康无后续回滚处理
|
|
|
+ LogEvent(Severity_Middle, Event_Req_Framework_Rollback_Restart,
|
|
|
+ CSimpleStringA::Format("rollback to old version [%s] succeed, request to restart framework , taskID=[%s]", m_currentTask.NewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
if (m_currentTask.task_type.Compare("U") == 0) {
|
|
|
//版本升级,健康有后续回退处理
|
|
|
- LogEvent(Severity_Middle, Event_Req_Framework_Restart,
|
|
|
- CSimpleStringA::Format("upgrade to new version [%s] succeed, request to restart framework , taskID=[%s]", m_currentTask.NewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ LogEvent(Severity_Middle, Event_DeviceAdapterUpgrade_Framework_Restart,
|
|
|
+ CSimpleStringA::Format("upgrade to new Dep version [%s] succeed, request to restart framework , taskID=[%s]", m_currentTask.depNewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
}
|
|
|
else if (m_currentTask.task_type.Compare("R") == 0) {
|
|
|
//版本回退,健康无后续回滚处理
|
|
|
LogEvent(Severity_Middle, Event_Req_Framework_Rollback_Restart,
|
|
|
- CSimpleStringA::Format("rollback to old version [%s] succeed, request to restart framework , taskID=[%s]", m_currentTask.NewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ CSimpleStringA::Format("rollback to old Dep version [%s] succeed, request to restart framework , taskID=[%s]", m_currentTask.depNewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}else if(m_currentTask.reboot_type == 2){
|
|
|
- if (m_currentTask.NewVersion.IsNullOrEmpty()) {
|
|
|
- //非版本升级
|
|
|
- LogEvent(Severity_Middle, Event_Req_OS_Restart,
|
|
|
- CSimpleStringA::Format("SysPackInstall upgrade to new version [%s] succeed, request to restart OS, taskID=[%s]", m_currentVersion.ToString().GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
- PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
+
|
|
|
+ if (!m_TempDepUpgradeFlag) {
|
|
|
+ if (m_currentTask.NewVersion.IsNullOrEmpty()) {
|
|
|
+ //非版本升级
|
|
|
+ LogEvent(Severity_Middle, Event_Req_OS_Restart,
|
|
|
+ CSimpleStringA::Format("SysPackInstall upgrade to new version [%s] succeed, request to restart OS, taskID=[%s]", m_currentVersion.ToString().GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (m_currentTask.task_type.Compare("U") == 0) {
|
|
|
+ LogEvent(Severity_Middle, Event_Req_OS_Upgrade_Restart,
|
|
|
+ CSimpleStringA::Format("upgrade to new version [%s] succeed, request to restart OS, taskID=[%s]", m_currentTask.NewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ LogEvent(Severity_Middle, Event_Req_OS_Restart,
|
|
|
+ CSimpleStringA::Format("rollback to old version [%s] succeed, request to restart OS, taskID=[%s]", m_currentTask.NewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
if (m_currentTask.task_type.Compare("U") == 0) {
|
|
|
LogEvent(Severity_Middle, Event_Req_OS_Upgrade_Restart,
|
|
|
- CSimpleStringA::Format("upgrade to new version [%s] succeed, request to restart OS, taskID=[%s]", m_currentTask.NewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ CSimpleStringA::Format("upgrade to new dep version [%s] succeed, request to restart OS, taskID=[%s]", m_currentTask.depNewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
}
|
|
|
else {
|
|
|
LogEvent(Severity_Middle, Event_Req_OS_Restart,
|
|
|
- CSimpleStringA::Format("rollback to old version [%s] succeed, request to restart OS, taskID=[%s]", m_currentTask.NewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
+ CSimpleStringA::Format("rollback to old dep version [%s] succeed, request to restart OS, taskID=[%s]", m_currentTask.depNewVersion.GetData(), m_currentTask.upgradeTaskId.GetData()));
|
|
|
PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_PreRestart));//进入S7
|
|
|
}
|
|
|
}
|
|
@@ -4766,6 +5202,11 @@ bool CUpgradeTaskFSM::isWork()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //适配器任务
|
|
|
+ if ((!m_currentTask.depNewVersion.IsNullOrEmpty()) && (m_currentTask.cPendingState == "T" || m_currentTask.cPendingState == "C" || m_currentTask.cPendingState == "X")) {
|
|
|
+ return true;//适配器无升级监护
|
|
|
+ }
|
|
|
+
|
|
|
//非升级任务和无任务
|
|
|
CSimpleStringA strValue;
|
|
|
if(m_pEntity->GetFunction()->GetSysVar("TerminalStage", strValue) == Error_Succeed){
|
|
@@ -4926,7 +5367,9 @@ ErrorCodeEnum CUpgradeTaskFSM::OnInit()
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("OnInit")("load GetSystemStaticInfo fail ");
|
|
|
return rc;
|
|
|
}else{
|
|
|
- m_currentVersion = info.InstallVersion;//当前版本号赋值
|
|
|
+ m_currentVersion = info.InstallVersion;//当前版本号赋值
|
|
|
+ m_currentDepVersion = info.CurrDepVersion;//当前适配器版本号,有可能为空
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("App version:%s , Dep version:%s", m_currentVersion.ToString(),m_currentDepVersion.GetData());
|
|
|
}
|
|
|
//注册callstate变量监控
|
|
|
rc = m_pEntity->GetFunction()->RegistSysVarEvent("CallState", this);
|
|
@@ -5081,7 +5524,6 @@ unsigned int CUpgradeTaskFSM::s2_on_event(FSMEvent* event)
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- //有任务时,则3个字段不能为空,否则任务有问题
|
|
|
CSimpleStringA errStr = CSimpleStringA::Format("current Task param task_type=[%s], param is Not Supported, clear this task",m_currentTask.task_type.GetData());
|
|
|
LogWarn(Severity_Middle, Error_Exception, ERR_TASK_INVALID_RUNINFO_TASK, errStr.GetData());
|
|
|
|
|
@@ -5094,6 +5536,7 @@ unsigned int CUpgradeTaskFSM::s2_on_event(FSMEvent* event)
|
|
|
PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_DealCurrTask));//继续处理上个任务
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//任务已到最终状态
|
|
|
if(m_currentTask.cPendingState=="T"||m_currentTask.cPendingState=="C"||m_currentTask.cPendingState=="X"){
|
|
|
//取消任务C和切换任务T时,更新任务状态
|
|
@@ -5144,12 +5587,6 @@ unsigned int CUpgradeTaskFSM::s2_on_event(FSMEvent* event)
|
|
|
up.strInstallComment = "启动成功";
|
|
|
if (m_currentTask.task_type.Compare("U")==0) {
|
|
|
SendUpgradeTaskProgress(up, UpgradeMgr_START_ID);
|
|
|
- if (m_currentTask.NewVersion.IsNullOrEmpty()) {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_OUTSIDE_SYSTEM_START_ID)("体系外升级启动成功");
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_VERSION_START_ID)("终端版本升级启动成功");
|
|
|
- }
|
|
|
}
|
|
|
else {
|
|
|
SendUpgradeTaskProgress(up, UpgradeMgr_ROLLBACK_START_ID);
|
|
@@ -5166,12 +5603,6 @@ unsigned int CUpgradeTaskFSM::s2_on_event(FSMEvent* event)
|
|
|
upRoll.strInstallComment = "自动倒回";
|
|
|
if (m_currentTask.task_type.Compare("U")==0) {
|
|
|
SendUpgradeTaskProgress(upRoll, UpgradeMgr_START_ID, " RTA5667");
|
|
|
- if (m_currentTask.NewVersion.IsNullOrEmpty()) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(UpgradeMgr_OUTSIDE_SYSTEM_START_ID).setResultCode("RTA5632")("升级启动失败,回滚上一个版本");
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(UpgradeMgr_VERSION_START_ID).setResultCode("RTA5631")("升级启动失败,回滚上一个版本");
|
|
|
- }
|
|
|
}
|
|
|
else {
|
|
|
SendUpgradeTaskProgress(upRoll, UpgradeMgr_ROLLBACK_START_ID, " RTA5672");
|
|
@@ -5592,13 +6023,6 @@ unsigned int CUpgradeTaskFSM::s4_on_event(FSMEvent* event)
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("upgradeTask download is fail ,prepare to s2");
|
|
|
m_currentTask.cPendingState = "C";//改变内存变量C
|
|
|
|
|
|
- if (m_currentTask.pack_version.IsNullOrEmpty()) {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_OUTSIDE_SYSTEM_DOWNLOAD_ID).setResultCode("RTA5636")("体系外下载失败:%s", pEvent->errMsg.c_str());
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_VERSION_DOWNLOAD_ID).setResultCode("RTA5635")("终端版本下载失败:%s", pEvent->errMsg.c_str());
|
|
|
- }
|
|
|
-
|
|
|
PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_StartDealTask));//进入S2
|
|
|
}else{
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("Event_Download_Fail write runinfo is fail,retry in 5's");
|
|
@@ -5760,7 +6184,7 @@ unsigned int CUpgradeTaskFSM::s5_on_event(FSMEvent* event)
|
|
|
{
|
|
|
CSimpleStringA strState;
|
|
|
ErrorCodeEnum err = m_pEntity->GetFunction()->GetSysVar("UIState", strState);
|
|
|
- if (/*TRUE ||*/ err == Error_Succeed && strState != CSimpleStringA("M")) //非主界面不安装
|
|
|
+ if (err == Error_Succeed && strState != CSimpleStringA("M")) //非主界面不安装
|
|
|
{
|
|
|
doInstall = false;
|
|
|
}
|
|
@@ -5774,6 +6198,8 @@ unsigned int CUpgradeTaskFSM::s5_on_event(FSMEvent* event)
|
|
|
|
|
|
if (doInstall)
|
|
|
{
|
|
|
+ //解压后判断是什么类型升级
|
|
|
+ judgeTaskClass();
|
|
|
Task::InstallPackTask* iTask = new Task::InstallPackTask(this);
|
|
|
ErrorCodeEnum rc = m_pEntity->GetFunction()->PostThreadPoolTask(iTask);
|
|
|
if (rc != Error_Succeed) {
|
|
@@ -5836,8 +6262,15 @@ unsigned int CUpgradeTaskFSM::s5_on_event(FSMEvent* event)
|
|
|
//写入运行时文件
|
|
|
bool isWriteOk=false;
|
|
|
while(true){
|
|
|
- if(SetRunConfigStrValue("upgradeTask","NewVersion",m_currentTask.NewVersion.GetData())!=Error_Succeed){
|
|
|
- break;
|
|
|
+ if (!m_TempDepUpgradeFlag) {
|
|
|
+ if (SetRunConfigStrValue("upgradeTask", "NewVersion", m_currentTask.NewVersion.GetData()) != Error_Succeed) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (SetRunConfigStrValue("upgradeTask", "depNewVersion", m_currentTask.depNewVersion.GetData()) != Error_Succeed) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
if(SetRunConfigStrValue("upgradeTask","PendingState","S")!=Error_Succeed){
|
|
|
break;
|
|
@@ -5861,11 +6294,6 @@ unsigned int CUpgradeTaskFSM::s5_on_event(FSMEvent* event)
|
|
|
SendUpgradeTaskProgress(up,UpgradeMgr_INSTALL_ID);
|
|
|
|
|
|
m_currentTask.cPendingState = "S";//改变内存变量S
|
|
|
- if(m_currentTask.pack_version.IsNullOrEmpty()){
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_OUTSIDE_SYSTEM_INSTALL_ID)("体系外安装成功");
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_VERSION_INSTALL_ID)("终端版本安装成功");
|
|
|
- }
|
|
|
//modify by lwt 修改为非兜底升级时等待一段时间再进入切换状态。
|
|
|
if (m_startFlag) {
|
|
|
PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_StartSwitch));//进入S6
|
|
@@ -5899,12 +6327,6 @@ unsigned int CUpgradeTaskFSM::s5_on_event(FSMEvent* event)
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("install pack is fail ,prepare to s2");
|
|
|
m_currentTask.cPendingState = "C";//改变内存变量C
|
|
|
|
|
|
- if (m_currentTask.pack_version.IsNullOrEmpty()) {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_OUTSIDE_SYSTEM_INSTALL_ID).setResultCode("RTA5638")("体系外安装失败");
|
|
|
- }else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_VERSION_INSTALL_ID).setResultCode("RTA5637")("终端版本安装失败");
|
|
|
- }
|
|
|
-
|
|
|
PostEventFIFO(new FSMEvent(CUpgradeTaskFSM::Event_StartDealTask));//进入S2
|
|
|
}else{
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("Event_EndInstallPackTask write runinfo is fail,retry int 5's");
|
|
@@ -6076,12 +6498,6 @@ unsigned int CUpgradeTaskFSM::s6_on_event(FSMEvent* event)
|
|
|
up.strInstallComment = "已设为启动版本";
|
|
|
if (m_currentTask.task_type.Compare("U")==0) {
|
|
|
SendUpgradeTaskProgress(up,UpgradeMgr_SWTICH_ID);
|
|
|
- if (m_currentTask.pack_version.IsNullOrEmpty()) {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_OUTSIDE_SYSTEM_SWTICH_ID)("体系外切换成功");
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_VERSION_SWTICH_ID)("终端版本切换成功");
|
|
|
- }
|
|
|
}
|
|
|
else{
|
|
|
SendUpgradeTaskProgress(up,UpgradeMgr_ROLLBACK_SWTICH_ID);
|
|
@@ -6110,13 +6526,26 @@ unsigned int CUpgradeTaskFSM::s6_on_event(FSMEvent* event)
|
|
|
}else if(event->param1==4){
|
|
|
|
|
|
//修改active文件
|
|
|
- if(UpgradeToNewVersion()==Error_Succeed){
|
|
|
+ if (!m_TempDepUpgradeFlag) {
|
|
|
+ if (UpgradeToNewVersion() == Error_Succeed) {
|
|
|
|
|
|
- SwitchUpgradeNow();//切换版本
|
|
|
+ SwitchUpgradeNow();//切换版本
|
|
|
|
|
|
- }else{
|
|
|
+ }
|
|
|
+ else {
|
|
|
|
|
|
- ScheduleTimer(5,3*1000);//UpgradeToNewVersion执行失败后写运行时计时器
|
|
|
+ ScheduleTimer(5, 3 * 1000);//UpgradeToNewVersion执行失败后写运行时计时器
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (UpgradeDepToNewVersion() == Error_Succeed) {
|
|
|
+
|
|
|
+ SwitchUpgradeNow();//切换版本
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ ScheduleTimer(5, 3 * 1000);//UpgradeToDepNewVersion执行失败后写运行时计时器
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}else if(event->param1==5){
|