сборка сапфора через гит. если версия собралась с ошибками, больше не будет попыток ее автоматической сборки.( но возможна ручная)

This commit is contained in:
2025-03-12 21:04:22 +03:00
parent b1740da1f1
commit 8aea85a009
9 changed files with 66 additions and 62 deletions

View File

@@ -26,11 +26,9 @@ public class Constants {
public static final String PerformanceAnalyzerDirectoryName = "PerformanceAnalyzer";
public static final String KeyDirectoryName = "Keys";
//--
//SVN vmk-post@yandex.ru
public static final String REPOSITORY_AUTHENTICATION = "--username dvmhuser --password dvmh2013 --non-interactive";
public static final String DVM_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/dvm";
public static final String SAPFOR_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/sapfor";
public static final String SAPFOR_REPOSITORY_BIN = "/sapfor/experts/Sapfor_2017/_bin";
//GIT
public static final String SAPFOR_REPOSITORY = "http://dvmh-server.ddns.net:3000/Alexander_KS/SAPFOR.git";
public static final String SAPFOR_VERSION_URL= "http://dvmh-server.ddns.net:3000/Alexander_KS/SAPFOR/raw/branch/master/src/Utils/version.h";
//-вывод задач
public final static String parse_out_file = "parse_out.txt";
public final static String parse_err_file = "parse_err.txt";
@@ -49,7 +47,7 @@ public class Constants {
//
//7998 отладочный порт. теперь.
public static final int ComponentsServerPort = 7995; //7795
public static final int TestingServerPort = 7996; //7996
public static final int TestingServerPort = 7998; //7996
public static final int SocketTimeout = 0;
//-
public static final String ServerAddress = "alex-freenas.ddns.net";
@@ -469,8 +467,8 @@ public class Constants {
//</editor-fold>
};
public static Vector<String> admins_mails = new Vector_<>(
"sapfor.tracker@internet.ru",
"vmk-post@yandex.ru",
"79854210702@ya.ru"
// "sapfor.tracker@internet.ru",
"vmk-post@yandex.ru"
// "79854210702@ya.ru"
);
}

View File

@@ -9,7 +9,6 @@ import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.file.Paths;
public class DownloadRepository extends ProcessPass {
File dvmHome;
File sapforHome;
@Override
public String getDescription() {
@@ -17,10 +16,8 @@ public class DownloadRepository extends ProcessPass {
}
@Override
protected boolean canStart(Object... args) throws Exception {
dvmHome = Paths.get(Global.RepoDirectory.getAbsolutePath(),
"dvm").toFile();
sapforHome = Paths.get(Global.RepoDirectory.getAbsolutePath(),
"sapfor").toFile();
"SAPFOR").toFile();
return true;
}
private void synchronize(String src, File dst) throws Exception {
@@ -28,19 +25,17 @@ public class DownloadRepository extends ProcessPass {
if (loadedFile.exists()) {
PerformScript("cd " +
dst.getAbsolutePath() +
"\nsvn update " + Constants.REPOSITORY_AUTHENTICATION + "\n");
"\ngit pull ");
} else {
Utils.CleanDirectory(dst);
PerformScript("cd Repo\nsvn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + src + "\n"); //export
PerformScript("cd Repo\ngit clone " + src + "\n"); //export
FileUtils.write(loadedFile, "");
}
}
@Override
protected void body() throws Exception {
ShowProgress(2, 0, true);
synchronize(Constants.DVM_REPOSITORY, dvmHome);
ShowProgress(2, 1, true);
ShowProgress(1, 0, true);
synchronize(Constants.SAPFOR_REPOSITORY, sapforHome);
ShowProgress(2, 2, true);
ShowProgress(1, 1, true);
}
}

View File

@@ -37,6 +37,7 @@ public class SPF_GetGraphLoops extends SapforAnalysis {
}
@Override
protected void unpack(String packed) throws Exception {
System.out.println(Utils_.Brackets(packed));
Vector<String> done_programs = new Vector<>();
String[] splitedPackedGraph = packed.split("\\|");
for (int i = 0; i < splitedPackedGraph.length; i += 2) {

View File

@@ -70,9 +70,12 @@ public enum ServerCode {
DeleteUserAccount,
GetDVMPackageCredentials,
CreateBackUp,
GetFirstEmailToSend;
GetFirstEmailToSend,
SynchronizeSapforRepoitory;
public String getDescription(){
switch (this){
case SynchronizeSapforRepoitory:
return "Синхронизация репозитория SAPFOR на сервере";
case Email:
return "Создать сообщение электронной почты на сервере";
case GetFirstEmailToSend:

View File

@@ -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;

View File

@@ -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()) {

View File

@@ -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();
//--