2023-10-03 15:07:17 +03:00
|
|
|
|
package Visual_DVM_2021.Passes.All;
|
2023-10-04 22:01:09 +03:00
|
|
|
|
import Common.Constants;
|
2023-11-14 00:56:05 +03:00
|
|
|
|
import Common.Current;
|
2023-10-03 15:07:17 +03:00
|
|
|
|
import Common.Global;
|
|
|
|
|
|
import Common.Utils.Utils;
|
|
|
|
|
|
import GlobalData.RemoteFile.RemoteFile;
|
|
|
|
|
|
import ProjectData.LanguageName;
|
|
|
|
|
|
import Repository.Server.ServerCode;
|
|
|
|
|
|
import Repository.Server.ServerExchangeUnit_2021;
|
|
|
|
|
|
import SapforTestingSystem.ServerSapfor.ServerSapfor;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.SSH.ConnectionPass;
|
2023-11-16 16:20:20 +03:00
|
|
|
|
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
2023-10-03 15:07:17 +03:00
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
2023-11-14 00:56:05 +03:00
|
|
|
|
import java.util.Vector;
|
2023-10-03 15:07:17 +03:00
|
|
|
|
public class InstallServerSapfor extends ConnectionPass<Object> {
|
|
|
|
|
|
boolean result;
|
|
|
|
|
|
ServerSapfor serverSapfor;
|
|
|
|
|
|
String version_text;
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
|
return "/icons/DownloadAll.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void Connect() throws Exception {
|
|
|
|
|
|
machine = Constants.repository_machine;
|
|
|
|
|
|
user = Constants.repository_user;
|
|
|
|
|
|
super.Connect();
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) {
|
|
|
|
|
|
result = false;
|
|
|
|
|
|
version_text = "";
|
|
|
|
|
|
serverSapfor = null;
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean needsInitialize() {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2023-10-10 16:53:29 +03:00
|
|
|
|
protected boolean needsAnimation() {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2023-10-03 15:07:17 +03:00
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
|
RemoteFile testingSystemHome = new RemoteFile(sftpChannel.pwd(), "testing_system", true);
|
|
|
|
|
|
RemoteFile repo = new RemoteFile(testingSystemHome.full_name, "Repo", true);
|
2023-11-14 00:56:05 +03:00
|
|
|
|
RemoteFile repoSapforHome = new RemoteFile(repo.full_name + Constants.SAPFOR_REPOSITORY_BIN, true);
|
2023-11-13 23:16:36 +03:00
|
|
|
|
//--
|
2023-10-03 15:07:17 +03:00
|
|
|
|
ShowMessage1("Синхронизация ветви DVM...");
|
|
|
|
|
|
ShellCommand("cd " + Utils.DQuotes(repo.full_name), "svn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + Constants.DVM_REPOSITORY + "\n");
|
|
|
|
|
|
ShowMessage1("Синхронизация ветви SAPFOR...");
|
|
|
|
|
|
ShellCommand("cd " + Utils.DQuotes(repo.full_name), "svn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + Constants.SAPFOR_REPOSITORY + "\n");
|
|
|
|
|
|
ShowMessage1("Сборка SAPFOR...");
|
2023-11-13 23:16:36 +03:00
|
|
|
|
//-
|
|
|
|
|
|
RemoteFile repo_bin = new RemoteFile(repoSapforHome.full_name, "Sapfor_F");
|
|
|
|
|
|
if (Exists(repoSapforHome.full_name, repo_bin.name))
|
|
|
|
|
|
sftpChannel.rm(repo_bin.full_name);
|
|
|
|
|
|
//--
|
2023-11-14 00:56:05 +03:00
|
|
|
|
performScript(repoSapforHome, "cmake ../", "make -j 4");
|
2023-10-03 15:07:17 +03:00
|
|
|
|
result = Exists(repoSapforHome.full_name, "Sapfor_F");
|
|
|
|
|
|
if (result) {
|
|
|
|
|
|
RemoteFile sapforsDirectory = new RemoteFile(testingSystemHome.full_name, "Sapfors", true);
|
|
|
|
|
|
//создать папку. Для того чтобы скопировать из репозитория.
|
|
|
|
|
|
RemoteFile sapforHome = new RemoteFile(sapforsDirectory.full_name, Utils.getDateName("sapfor"));
|
|
|
|
|
|
tryMKDir(sapforHome);
|
|
|
|
|
|
RemoteFile sapforBin = new RemoteFile(sapforHome, "Sapfor_F");
|
2023-11-13 23:16:36 +03:00
|
|
|
|
copy(repo_bin, sapforBin);
|
2023-10-03 15:07:17 +03:00
|
|
|
|
//-->>>
|
|
|
|
|
|
serverSapfor = new ServerSapfor();
|
|
|
|
|
|
serverSapfor.home_path = sapforHome.full_name;
|
|
|
|
|
|
serverSapfor.call_command = sapforBin.full_name;
|
|
|
|
|
|
serverSapfor.languageName = LanguageName.fortran;
|
|
|
|
|
|
serverSapfor.buildDate = new Date().getTime();
|
|
|
|
|
|
///--->>
|
|
|
|
|
|
String raw = ShellCommand(serverSapfor.getVersionCommand());
|
|
|
|
|
|
String[] data = raw.split(" ");
|
|
|
|
|
|
if (data.length >= 4) serverSapfor.version = data[3].replace(",", "");
|
|
|
|
|
|
//---
|
|
|
|
|
|
result = new TestingSystemPass() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
|
|
return "Публикация тестовой версии";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, "", serverSapfor));
|
|
|
|
|
|
}
|
|
|
|
|
|
}.Do();
|
|
|
|
|
|
}
|
2023-11-14 00:56:05 +03:00
|
|
|
|
new TestingSystemPass() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
|
|
return "Рассылка выходных файлов сборки SAPFOR";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
|
Vector<String> info = new Vector<>();
|
|
|
|
|
|
info.add(result ? serverSapfor.version : "?");
|
|
|
|
|
|
info.add(result ? "Успешно" : "С ошибками");
|
|
|
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.EmailSapforAssembly,
|
|
|
|
|
|
Current.getAccount().email,
|
|
|
|
|
|
info
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
}.Do();
|
2023-10-03 15:07:17 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean validate() {
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2023-10-27 21:23:53 +03:00
|
|
|
|
protected void performDone() throws Exception {
|
|
|
|
|
|
super.performDone();
|
2023-10-03 15:07:17 +03:00
|
|
|
|
passes.get(PassCode_2021.SynchronizeTests).Do();
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2023-10-27 21:23:53 +03:00
|
|
|
|
protected void showFail() throws Exception {
|
|
|
|
|
|
Log.Writeln_("Файл [SAPFOR_F] не найден!");
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2023-10-03 15:07:17 +03:00
|
|
|
|
protected void showDone() throws Exception {
|
|
|
|
|
|
super.showDone();
|
|
|
|
|
|
Global.testingServer.db.serverSapfors.ui_.Show(serverSapfor.getPK());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-10-27 21:23:53 +03:00
|
|
|
|
|