промежуточный. проверка версии сапфора при асинхроноой сборке, из репозитория. Завтра доделаю и закоммичу
This commit is contained in:
@@ -5,6 +5,7 @@ import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Account.Account;
|
||||
import ProjectData.LanguageName;
|
||||
import Repository.Component.Sapfor.Sapfor;
|
||||
import Repository.EmailMessage;
|
||||
import Repository.RepositoryRefuseException;
|
||||
import Repository.RepositoryServer;
|
||||
@@ -107,6 +108,28 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
}
|
||||
//-->>>
|
||||
@Override
|
||||
protected void beforePublishAction(DBObject object) throws Exception {
|
||||
if (object instanceof ServerSapfor){
|
||||
File versionFile = new File(Global.TempDirectory,"version.h");
|
||||
if (versionFile.exists())
|
||||
FileUtils.forceDelete(versionFile);
|
||||
//1. Получить версию из репозитория.
|
||||
Utils.startScript(Global.TempDirectory,
|
||||
Global.TempDirectory,
|
||||
"get_version",
|
||||
"wget --user dvmhuser --password dvmh2013 -P " +
|
||||
Utils.DQuotes(Global.TempDirectory.getAbsolutePath()) +
|
||||
" http://svn.dvm-system.org/svn/dvmhrepo/sapfor/experts/Sapfor_2017/_src/Utils/version.h"
|
||||
).waitFor();
|
||||
if (!versionFile.exists())
|
||||
throw new RepositoryRefuseException("Не удалось загрузить текущую версию SAPFOR из репозитория!");
|
||||
int current_version = Sapfor.readVersionFromCode(versionFile);
|
||||
int max_installed_version = db.getInstalledSapforMaxVersion();
|
||||
if (max_installed_version==current_version)
|
||||
throw new RepositoryRefuseException("Актуальная версия SAPFOR "+max_installed_version+" уже установлена");
|
||||
}
|
||||
}
|
||||
public TestingServer() {
|
||||
super(TestsDatabase.class);
|
||||
name = Utils.getDateName("testingServer");
|
||||
@@ -333,11 +356,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
response.object = db.getFirstActiveSapforPackagesCopies();
|
||||
}
|
||||
//---
|
||||
void GetSapforForCompilation() throws Exception{
|
||||
void GetSapforForCompilation() throws Exception {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = db.getSapforCopyForCompilation();
|
||||
}
|
||||
void GetSapforMaxVersion() throws Exception{
|
||||
void GetSapforMaxVersion() throws Exception {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = db.getInstalledSapforMaxVersion();
|
||||
}
|
||||
@@ -539,7 +562,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
response.object = serverSapfor;
|
||||
serverSapfor.version = String.valueOf(current_version);
|
||||
//---
|
||||
// EmailSapforAssembly(current_version, true);
|
||||
// EmailSapforAssembly(current_version, true);
|
||||
//---
|
||||
} else {
|
||||
//---
|
||||
@@ -662,5 +685,25 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
void GetSapforActualVersion() throws Exception {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
File versionFile = new File(Global.TempDirectory,"version.h");
|
||||
if (versionFile.exists())
|
||||
FileUtils.forceDelete(versionFile);
|
||||
//1. Получить версию из репозитория.
|
||||
Utils.startScript(Global.TempDirectory,
|
||||
Global.TempDirectory,
|
||||
"get_version",
|
||||
"wget --user dvmhuser --password dvmh2013 -P " +
|
||||
Utils.DQuotes(Global.TempDirectory.getAbsolutePath()) +
|
||||
" http://svn.dvm-system.org/svn/dvmhrepo/sapfor/experts/Sapfor_2017/_src/Utils/version.h"
|
||||
).waitFor();
|
||||
if (!versionFile.exists())
|
||||
throw new RepositoryRefuseException("Не удалось загрузить текущую версию SAPFOR из репозитория!");
|
||||
int current_version = Sapfor.readVersionFromCode(versionFile);
|
||||
int max_installed_version = db.getInstalledSapforMaxVersion();
|
||||
if (max_installed_version==current_version)
|
||||
throw new RepositoryRefuseException("Версия "+max_installed_version+" уже установлена");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user