сборка сапфора через гит. если версия собралась с ошибками, больше не будет попыток ее автоматической сборки.( но возможна ручная)
This commit is contained in:
@@ -576,9 +576,9 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Utils.startScript(Global.TempDirectory,
|
||||
Global.TempDirectory,
|
||||
"get_version",
|
||||
"wget --user dvmhuser --password dvmh2013 -P " +
|
||||
"wget -P " +
|
||||
Utils_.DQuotes(Global.TempDirectory.getAbsolutePath()) +
|
||||
" http://svn.dvm-system.org/svn/dvmhrepo/sapfor/experts/Sapfor_2017/_src/Utils/version.h"
|
||||
" " + Utils_.DQuotes(Constants.SAPFOR_VERSION_URL)
|
||||
).waitFor();
|
||||
if (!versionFile.exists())
|
||||
throw new RepositoryRefuseException("Не удалось загрузить текущую версию SAPFOR из репозитория!");
|
||||
@@ -592,11 +592,14 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
int max_version = db.getInstalledSapforMaxVersion();
|
||||
int current_version = getSapforActualVersion();
|
||||
if (current_version > max_version) {
|
||||
serverSapfor = new ServerSapfor();
|
||||
serverSapfor.sender_name = "server";
|
||||
serverSapfor.sender_address = Constants.MailAddress;
|
||||
serverSapfor.state = ServerSapforState.Queued;
|
||||
db.Insert(serverSapfor);
|
||||
ServerSapfor versionSapfor = db.getSapforForVersion(String.valueOf(current_version));
|
||||
if (versionSapfor == null || !versionSapfor.state.equals(ServerSapforState.DoneWithErrors)) {
|
||||
serverSapfor = new ServerSapfor();
|
||||
serverSapfor.sender_name = "server";
|
||||
serverSapfor.sender_address = Constants.MailAddress;
|
||||
serverSapfor.state = ServerSapforState.Queued;
|
||||
db.Insert(serverSapfor);
|
||||
}
|
||||
}
|
||||
}
|
||||
response.object = serverSapfor;
|
||||
|
||||
@@ -282,6 +282,13 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public ServerSapfor getSapforForVersion(String version_in){
|
||||
for (ServerSapfor serverSapfor: serverSapfors.Data.values()){
|
||||
if (serverSapfor.version.equals(version_in))
|
||||
return serverSapfor;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public Integer getInstalledSapforMaxVersion() {
|
||||
int max_version = CommonConstants.Nan;
|
||||
for (ServerSapfor sapfor : serverSapfors.Data.values()) {
|
||||
|
||||
@@ -30,20 +30,23 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
|
||||
ServerSapfor sapfor;
|
||||
//--
|
||||
File repo;
|
||||
File repoSapforHome;
|
||||
File repo_sapfor;
|
||||
File repo_sapfor_installation_directory;
|
||||
int max_version;
|
||||
int current_version;
|
||||
//--
|
||||
File repo_bin;
|
||||
File repo_sapfor_assembly; //бинарник собранный в репозитории.
|
||||
File repo_out;
|
||||
File repo_err;
|
||||
//--
|
||||
public SapforTestingPlanner() {
|
||||
repo = new File(Utils_.getHomeDirectory(), "Repo");
|
||||
repoSapforHome = Paths.get(Utils_.getHomePath(), "Repo", Constants.SAPFOR_REPOSITORY_BIN).toFile();
|
||||
repo_bin = new File(repoSapforHome, "Sapfor_F");
|
||||
repo_out = new File(repoSapforHome, Constants.out_file);
|
||||
repo_err = new File(repoSapforHome, Constants.err_file);
|
||||
repo_sapfor = new File(repo, "SAPFOR");
|
||||
//-
|
||||
repo_sapfor_installation_directory =new File(repo_sapfor, "install");
|
||||
repo_out = new File(repo_sapfor_installation_directory, Constants.out_file);
|
||||
repo_err = new File(repo_sapfor_installation_directory, Constants.err_file);
|
||||
repo_sapfor_assembly = new File(repo_sapfor_installation_directory, "Sapfor_F");
|
||||
}
|
||||
@Override
|
||||
public String packageDescription() {
|
||||
@@ -231,32 +234,20 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
|
||||
ServerCommand(ServerCode.EditObject, sapfor);
|
||||
}
|
||||
void SyncronizeRepository() throws Exception {
|
||||
UpdateSapforState(ServerSapforState.DVMRepositorySynchronization);
|
||||
Utils.startScript(repo, repo, "dvm_checkout",
|
||||
"svn checkout " +
|
||||
Constants.REPOSITORY_AUTHENTICATION +
|
||||
" " + Constants.DVM_REPOSITORY + " 1>dvm_out.txt 2>dvm_err.txt\n").waitFor();
|
||||
UpdateSapforState(ServerSapforState.SAPFORRepositorySynchronization);
|
||||
Utils.startScript(repo, repo, "spf_checkout",
|
||||
"svn checkout " +
|
||||
Constants.REPOSITORY_AUTHENTICATION +
|
||||
" " + Constants.SAPFOR_REPOSITORY + " 1>spf_out.txt 2>spf_err.txt\n").waitFor();
|
||||
Utils.CleanDirectory(repo);
|
||||
Utils.startScript(repo, repo, "git_clone",
|
||||
"git clone " + Constants.SAPFOR_REPOSITORY + " " +
|
||||
Utils_.DQuotes(repo_sapfor)+
|
||||
" 1>spf_out.txt 2>spf_err.txt\n").waitFor();
|
||||
}
|
||||
void CompileSapfor() throws Exception {
|
||||
UpdateSapforState(ServerSapforState.Compilation);
|
||||
//-
|
||||
if (repo_bin.exists())
|
||||
FileUtils.forceDelete(repo_bin);
|
||||
if (repo_out.exists())
|
||||
FileUtils.forceDelete(repo_out);
|
||||
if (repo_err.exists())
|
||||
FileUtils.forceDelete(repo_err);
|
||||
Utils_.CheckAndCleanDirectory(repo_sapfor_installation_directory);
|
||||
//--
|
||||
Utils.startScript(repoSapforHome, repoSapforHome, "build_sapfor",
|
||||
"cmake ../ 1>" +
|
||||
Constants.out_file +
|
||||
" 2>" +
|
||||
Constants.err_file +
|
||||
Utils.startScript(repo_sapfor_installation_directory, repo_sapfor_installation_directory, "build_sapfor",
|
||||
"cmake .. 1>" + Constants.out_file + " 2>" + Constants.err_file +
|
||||
"\nmake -j 14 1>>" +
|
||||
Constants.out_file +
|
||||
" 2>>" +
|
||||
@@ -274,7 +265,8 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
|
||||
//--
|
||||
SyncronizeRepository();
|
||||
max_version = (int) ServerCommand(ServerCode.GetMaxSapforVersion);
|
||||
current_version = Sapfor.readVersionFromCode(Paths.get(repo.getAbsolutePath(), "/sapfor/experts/Sapfor_2017/_src/Utils/version.h").toFile());
|
||||
current_version = Sapfor.readVersionFromCode(Paths.get(repo.getAbsolutePath(),
|
||||
"/SAPFOR/src/Utils/version.h").toFile());
|
||||
if (current_version == max_version) {
|
||||
ServerCommand(ServerCode.DeleteObjectByPK, new Pair(ServerSapfor.class, sapfor.id));
|
||||
return;
|
||||
@@ -284,6 +276,7 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
|
||||
//--
|
||||
sapfor.home_path = sapforHome.getAbsolutePath();
|
||||
sapfor.languageName = LanguageName.fortran;
|
||||
sapfor.version = String.valueOf(current_version);
|
||||
//--
|
||||
File sapforBin = new File(sapforHome, "Sapfor_F");
|
||||
File sapforOut = new File(sapforHome, Constants.out_file);
|
||||
@@ -296,11 +289,11 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
|
||||
FileUtils.copyFile(repo_out, sapforOut);
|
||||
if (repo_err.exists())
|
||||
FileUtils.copyFile(repo_err, sapforErr);
|
||||
if (repo_bin.exists()) {
|
||||
FileUtils.copyFile(repo_bin, sapforBin);
|
||||
if (repo_sapfor_assembly.exists()) {
|
||||
FileUtils.copyFile(repo_sapfor_assembly, sapforBin);
|
||||
sapforBin.setExecutable(true, false);
|
||||
//--
|
||||
sapfor.version = String.valueOf(current_version);
|
||||
|
||||
sapfor.call_command = sapforBin.getAbsolutePath();
|
||||
sapfor.buildDate = new Date().getTime();
|
||||
//--
|
||||
|
||||
Reference in New Issue
Block a user