[FEAT] use Maven a build system root tool

This commit is contained in:
Edouard DUPIN 2024-06-07 09:28:33 +02:00
parent 0376dfacab
commit e1a043a34a
30 changed files with 399 additions and 399 deletions

View File

@ -92,10 +92,10 @@ public class Commands {
return Commands.getCurrentTrackingBranch(git); return Commands.getCurrentTrackingBranch(git);
} }
List<String> list_branch_remote = Commands.getListBranchRemote(git); List<String> list_branch_remote = Commands.getListBranchRemote(git);
Log.verbose("check if exist " + remote_name + "/" + select_branch + " in " + list_branch_remote); LOGGER.trace("check if exist " + remote_name + "/" + select_branch + " in " + list_branch_remote);
String tmpBranchName = remote_name + "/" + select_branch; String tmpBranchName = remote_name + "/" + select_branch;
if (!list_branch_remote.contains("refs/remotes/" + tmpBranchName)) { if (!list_branch_remote.contains("refs/remotes/" + tmpBranchName)) {
Log.debug(" ==> can not get remote branch"); LOGGER.debug(" ==> can not get remote branch");
return null; return null;
} }
return remote_name + "/" + select_branch; return remote_name + "/" + select_branch;
@ -160,63 +160,63 @@ public class Commands {
try { try {
Status status = git.status().call(); Status status = git.status().call();
if (status.getAdded().size() != 0) { if (status.getAdded().size() != 0) {
Log.print(" * Added: (" + status.getAdded().size() + ")"); LOGGER.print(" * Added: (" + status.getAdded().size() + ")");
for (String elem : status.getAdded()) { for (String elem : status.getAdded()) {
Log.print(" - " + elem); LOGGER.print(" - " + elem);
} }
} }
if (status.getChanged().size() != 0) { if (status.getChanged().size() != 0) {
Log.print(" * Changed: (" + status.getChanged().size() + ")"); LOGGER.print(" * Changed: (" + status.getChanged().size() + ")");
for (String elem : status.getChanged()) { for (String elem : status.getChanged()) {
Log.print(" - " + elem); LOGGER.print(" - " + elem);
} }
} }
if (status.getConflicting().size() != 0) { if (status.getConflicting().size() != 0) {
Log.print(" * Conflicting: (" + status.getConflicting().size() + ")"); LOGGER.print(" * Conflicting: (" + status.getConflicting().size() + ")");
for (String elem : status.getConflicting()) { for (String elem : status.getConflicting()) {
Log.print(" - " + elem); LOGGER.print(" - " + elem);
} }
} }
/* /*
if (status.getIgnoredNotInIndex().size() != 0) { if (status.getIgnoredNotInIndex().size() != 0) {
Log.print(" * Ignored not in index: (" + status.getIgnoredNotInIndex().size() + ")"); LOGGER.print(" * Ignored not in index: (" + status.getIgnoredNotInIndex().size() + ")");
for (String elem : status.getIgnoredNotInIndex()) { for (String elem : status.getIgnoredNotInIndex()) {
Log.print(" - " + elem); LOGGER.print(" - " + elem);
} }
} }
*/ */
if (status.getMissing().size() != 0) { if (status.getMissing().size() != 0) {
Log.print(" * Missing: (" + status.getMissing().size() + ")"); LOGGER.print(" * Missing: (" + status.getMissing().size() + ")");
for (String elem : status.getMissing()) { for (String elem : status.getMissing()) {
Log.print(" - " + elem); LOGGER.print(" - " + elem);
} }
} }
if (status.getModified().size() != 0) { if (status.getModified().size() != 0) {
Log.print(" * Modified: (" + status.getModified().size() + ")"); LOGGER.print(" * Modified: (" + status.getModified().size() + ")");
for (String elem : status.getModified()) { for (String elem : status.getModified()) {
Log.print(" - " + elem); LOGGER.print(" - " + elem);
} }
} }
if (status.getRemoved().size() != 0) { if (status.getRemoved().size() != 0) {
Log.print(" * Removed: (" + status.getRemoved().size() + ")"); LOGGER.print(" * Removed: (" + status.getRemoved().size() + ")");
for (String elem : status.getRemoved()) { for (String elem : status.getRemoved()) {
Log.print(" - " + elem); LOGGER.print(" - " + elem);
} }
} }
if (status.getUntracked().size() != 0) { if (status.getUntracked().size() != 0) {
Log.print(" * Untracked: (" + status.getUntracked().size() + ")"); LOGGER.print(" * Untracked: (" + status.getUntracked().size() + ")");
for (String elem : status.getUntracked()) { for (String elem : status.getUntracked()) {
Log.print(" - " + elem); LOGGER.print(" - " + elem);
} }
} }
if (status.getUntrackedFolders().size() != 0) { if (status.getUntrackedFolders().size() != 0) {
Log.print(" * Untracked Folders: (" + status.getUntrackedFolders().size() + ")"); LOGGER.print(" * Untracked Folders: (" + status.getUntrackedFolders().size() + ")");
for (String elem : status.getUntrackedFolders()) { for (String elem : status.getUntrackedFolders()) {
Log.print(" - " + elem); LOGGER.print(" - " + elem);
} }
} }
} catch (NoWorkTreeException | GitAPIException e) { } catch (NoWorkTreeException | GitAPIException e) {
Log.error("can not retrive the satus of the repository ... " + e.getMessage()); LOGGER.error("can not retrive the satus of the repository ... " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -228,12 +228,12 @@ public class Commands {
public static boolean isGitRepository(final String path) { public static boolean isGitRepository(final String path) {
Path git_repo_path = Env.getIslandRootPath().resolve(path); Path git_repo_path = Env.getIslandRootPath().resolve(path);
if (!Files.exists(git_repo_path)) { if (!Files.exists(git_repo_path)) {
Log.warning("Path Does not Exist ... " + git_repo_path + " ==> skip"); LOGGER.warn("Path Does not Exist ... " + git_repo_path + " ==> skip");
return false; return false;
} }
if (!Files.exists(git_repo_path.resolve(".git"))) { if (!Files.exists(git_repo_path.resolve(".git"))) {
// path already exist but it is not used to as a git repo ==> this is an error // path already exist but it is not used to as a git repo ==> this is an error
Log.warning("path '" + git_repo_path + "' Not a git repository ==> skip"); LOGGER.warn("path '" + git_repo_path + "' Not a git repository ==> skip");
return false; return false;
} }
return true; return true;
@ -279,7 +279,7 @@ public class Commands {
try { try {
git.checkout().setCreateBranch(false).setName("refs/heads/" + destination_branch).call(); git.checkout().setCreateBranch(false).setName("refs/heads/" + destination_branch).call();
} catch (GitAPIException e) { } catch (GitAPIException e) {
Log.error("can not checkout branch:" + destination_branch); LOGGER.error("can not checkout branch:" + destination_branch);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -310,29 +310,29 @@ public class Commands {
boolean add_in_version_management = false; boolean add_in_version_management = false;
String[] version_description = null; String[] version_description = null;
if (!Files.exists(version_path_file)) { if (!Files.exists(version_path_file)) {
Log.info("deliver: ==> No 'version.txt' file ==> not manage release version...."); LOGGER.info("deliver: ==> No 'version.txt' file ==> not manage release version....");
// Action to do: // Action to do:
boolean valid = false; boolean valid = false;
String input1 = null; String input1 = null;
while (!valid) { while (!valid) {
Log.print("Create a new version: (0.0.0)"); LOGGER.print("Create a new version: (0.0.0)");
Log.print(" (1) Add in managing version"); LOGGER.print(" (1) Add in managing version");
Log.print(" (2) Do NOTHING & continue"); LOGGER.print(" (2) Do NOTHING & continue");
input1 = Commands.input(); input1 = Commands.input();
if (Commands.stringInList(new String[]{"1", "2"}, input1)) { if (Commands.stringInList(new String[]{"1", "2"}, input1)) {
valid = true; valid = true;
} else { } else {
Log.print("!!! Must select in range [1..2]"); LOGGER.print("!!! Must select in range [1..2]");
} }
} }
if (input1.equals("1")) { if (input1.equals("1")) {
version_description = new String[]{"0", "0", "0"}; version_description = new String[]{"0", "0", "0"};
add_in_version_management = true; add_in_version_management = true;
} else if (input1.equals("1")) { } else if (input1.equals("1")) {
Log.info("Continue Not managing for this repository"); LOGGER.info("Continue Not managing for this repository");
return null; return null;
} else { } else {
Log.warning("An error occured for this repository"); LOGGER.warn("An error occured for this repository");
return null; return null;
} }
} else { } else {
@ -360,23 +360,23 @@ public class Commands {
} catch (NoHeadException e) { } catch (NoHeadException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
Log.critical("dfghdsfghdfgh"); LOGGER.critical("dfghdsfghdfgh");
} catch (GitAPIException e) { } catch (GitAPIException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
Log.critical("sdgfhdgfhsdfhsdf"); LOGGER.critical("sdgfhdgfhsdfhsdf");
} }
// remove all identical sha1 ==> not needed for this // remove all identical sha1 ==> not needed for this
boolean have_forward = false; boolean have_forward = false;
for (ObjectId elem_sha1 : ret_destination_branch_sha1) { for (ObjectId elem_sha1 : ret_destination_branch_sha1) {
if (!Commands.historyContains(ret_source_branch_sha1, elem_sha1)) { if (!Commands.historyContains(ret_source_branch_sha1, elem_sha1)) {
RevCommit message = Commands.get_specific_commit_message(git, elem_sha1); RevCommit message = Commands.get_specific_commit_message(git, elem_sha1);
Log.warning("deliver: Forward commit: '" + message.getFullMessage() + "'"); LOGGER.warn("deliver: Forward commit: '" + message.getFullMessage() + "'");
have_forward = true; have_forward = true;
} }
} }
if (have_forward == true) { if (have_forward == true) {
Log.error("'" + destination_branch + "' branch must not be forward '" + source_branch + "' branch"); LOGGER.error("'" + destination_branch + "' branch must not be forward '" + source_branch + "' branch");
return null; return null;
} }
String behind_message = ""; String behind_message = "";
@ -389,30 +389,30 @@ public class Commands {
} }
} }
if (behind_count == 0 && add_in_version_management == false) { if (behind_count == 0 && add_in_version_management == false) {
Log.info("deliver: ==> Nothing to do (1)."); LOGGER.info("deliver: ==> Nothing to do (1).");
return null; return null;
} }
if (behind_count == 1 && ( behind_message.equals(Commands.default_behind_message) || behind_message.equals(Commands.default_update_message))) { if (behind_count == 1 && ( behind_message.equals(Commands.default_behind_message) || behind_message.equals(Commands.default_update_message))) {
Log.info("deliver: ==> Nothing to do (2)."); LOGGER.info("deliver: ==> Nothing to do (2).");
return null; return null;
} }
for (ObjectId elem_sha1 : ret_source_branch_sha1) { for (ObjectId elem_sha1 : ret_source_branch_sha1) {
if (!Commands.historyContains(ret_destination_branch_sha1, elem_sha1)) { if (!Commands.historyContains(ret_destination_branch_sha1, elem_sha1)) {
RevCommit message = Commands.get_specific_commit_message(git, elem_sha1); RevCommit message = Commands.get_specific_commit_message(git, elem_sha1);
Log.print("deliver: Behind commit: '" + message.getFullMessage() + "'"); LOGGER.print("deliver: Behind commit: '" + message.getFullMessage() + "'");
} }
} }
// Choice of the new version: // Choice of the new version:
String input1 = null; String input1 = null;
while (input1 == null) { while (input1 == null) {
Log.print("update version: curent: " + Arrays.toString(version_description)); LOGGER.print("update version: curent: " + Arrays.toString(version_description));
Log.print(" (1) Major version (change API)"); LOGGER.print(" (1) Major version (change API)");
Log.print(" (2) Medium version (add feature)"); LOGGER.print(" (2) Medium version (add feature)");
Log.print(" (3) Minor version (Bug fix & doc)"); LOGGER.print(" (3) Minor version (Bug fix & doc)");
Log.print(" (4) Do not release & continue"); LOGGER.print(" (4) Do not release & continue");
input1 = Commands.input(); input1 = Commands.input();
if (!Commands.stringInList(new String[]{"1", "2", "3", "4"}, input1)) { if (!Commands.stringInList(new String[]{"1", "2", "3", "4"}, input1)) {
Log.info("!!! Must select in range [1..4]"); LOGGER.info("!!! Must select in range [1..4]");
input1 = null; input1 = null;
} }
} }
@ -439,7 +439,7 @@ public class Commands {
} else { } else {
new_version_descrtiption[2] = 0; new_version_descrtiption[2] = 0;
} }
Log.info("update version: curent: " + Arrays.toString(new_version_descrtiption)); LOGGER.info("update version: curent: " + Arrays.toString(new_version_descrtiption));
// increment the version // increment the version
if (input1.equals("1")) { if (input1.equals("1")) {
new_version_descrtiption[0] += 1; new_version_descrtiption[0] += 1;
@ -451,13 +451,13 @@ public class Commands {
} else if (input1.equals("3")) { } else if (input1.equals("3")) {
version_description[2] += 1; version_description[2] += 1;
} else if (input1.equals("4")) { } else if (input1.equals("4")) {
Log.info("No release for this repository"); LOGGER.info("No release for this repository");
return null; return null;
} else { } else {
Log.warning("An error occured for this repository"); LOGGER.warn("An error occured for this repository");
return null; return null;
} }
Log.info("update version: curent: " + Arrays.toString(new_version_descrtiption)); LOGGER.info("update version: curent: " + Arrays.toString(new_version_descrtiption));
return new_version_descrtiption; return new_version_descrtiption;
} }
@ -487,7 +487,7 @@ public class Commands {
} catch (RevisionSyntaxException | IOException e1) { } catch (RevisionSyntaxException | IOException e1) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
Log.error("Merge error: can not retrive the source branch"); LOGGER.error("Merge error: can not retrive the source branch");
return; return;
} }
Commands.checkout(git, to); Commands.checkout(git, to);
@ -504,7 +504,7 @@ public class Commands {
} }
if (res == null || !res.getMergeStatus().isSuccessful()) { if (res == null || !res.getMergeStatus().isSuccessful()) {
Log.error("Merge error:" + res.getConflicts().toString()); LOGGER.error("Merge error:" + res.getConflicts().toString());
// inform the user he has to handle the conflicts // inform the user he has to handle the conflicts
} }
} }

View File

@ -51,12 +51,12 @@ public class Env {
//String tmp = island_root_path.toAbsolutePath().toString(); //String tmp = island_root_path.toAbsolutePath().toString();
Env.islandRootPath = Paths.get(""); Env.islandRootPath = Paths.get("");
Path tmpPath = Env.islandRootPath.toAbsolutePath(); Path tmpPath = Env.islandRootPath.toAbsolutePath();
Log.debug("Current absolute path is: " + tmpPath); LOGGER.debug("Current absolute path is: " + tmpPath);
while (!Files.isDirectory(tmpPath.resolve("." + Env.getSystemBaseName()))) { while (!Files.isDirectory(tmpPath.resolve("." + Env.getSystemBaseName()))) {
tmpPath = tmpPath.getParent(); tmpPath = tmpPath.getParent();
Log.debug("test upper path: " + tmpPath); LOGGER.debug("test upper path: " + tmpPath);
if (tmpPath == null) { if (tmpPath == null) {
Log.debug("the root path of " + Env.getSystemBaseName() + " must not be upper parent paths of (" + Env.islandRootPath.toAbsolutePath() + ")"); LOGGER.debug("the root path of " + Env.getSystemBaseName() + " must not be upper parent paths of (" + Env.islandRootPath.toAbsolutePath() + ")");
tmpPath = Env.islandRootPath.toAbsolutePath(); tmpPath = Env.islandRootPath.toAbsolutePath();
break; break;
} }
@ -127,13 +127,13 @@ public class Env {
} }
public static void main(final String[] args) { public static void main(final String[] args) {
Log.error("islandRootPath = {}", Env.islandRootPath.toAbsolutePath()); LOGGER.error("islandRootPath = {}", Env.islandRootPath.toAbsolutePath());
Log.error("islandPathUserConfig = {}", Env.islandPathUserConfig.toAbsolutePath()); LOGGER.error("islandPathUserConfig = {}", Env.islandPathUserConfig.toAbsolutePath());
Log.error("islandPath = {}", Env.islandPath.toAbsolutePath()); LOGGER.error("islandPath = {}", Env.islandPath.toAbsolutePath());
Log.error("islandPathConfig = {}", Env.islandPathConfig.toAbsolutePath()); LOGGER.error("islandPathConfig = {}", Env.islandPathConfig.toAbsolutePath());
Log.error("islandPathManifest = {}", Env.islandPathManifest.toAbsolutePath()); LOGGER.error("islandPathManifest = {}", Env.islandPathManifest.toAbsolutePath());
Log.error("islandPathArtifactory = {}", Env.islandPathArtifactory.toAbsolutePath()); LOGGER.error("islandPathArtifactory = {}", Env.islandPathArtifactory.toAbsolutePath());
Log.error("islandPathArtifactoryLink = {}", Env.islandPathArtifactoryLink.toAbsolutePath()); LOGGER.error("islandPathArtifactoryLink = {}", Env.islandPathArtifactoryLink.toAbsolutePath());
} }
public static boolean needProcessWithFilter(final String data) { public static boolean needProcessWithFilter(final String data) {

View File

@ -120,12 +120,12 @@ public class MainIsland {
System.exit(0); System.exit(0);
} }
if (!parser.hasDetectedAction()) { if (!parser.hasDetectedAction()) {
Log.error("Call The application without require an action..."); LOGGER.error("Call The application without require an action...");
parser.showHelp(); parser.showHelp();
System.exit(-1); System.exit(-1);
} }
if (parser.hasArgumentDetected()) { if (parser.hasArgumentDetected()) {
Log.error("Detected armument unavaillable :" + parser.getArgumentDetected().toString()); LOGGER.error("Detected armument unavaillable :" + parser.getArgumentDetected().toString());
parser.showHelp(); parser.showHelp();
System.exit(-1); System.exit(-1);
} }

View File

@ -28,22 +28,22 @@ public class Manifest {
public static void checkIsInit() { public static void checkIsInit() {
// check if .XXX exist (create it if needed) // check if .XXX exist (create it if needed)
if (!Manifest.isInit()) { if (!Manifest.isInit()) {
Log.error("System not init: missing config: '" + Env.getIslandPath() + "'. Call <island init> first"); LOGGER.error("System not init: missing config: '" + Env.getIslandPath() + "'. Call <island init> first");
System.exit(-1); System.exit(-1);
} }
} }
public static boolean isInit() { public static boolean isInit() {
if (!Files.exists(Env.getIslandPath())) { if (!Files.exists(Env.getIslandPath())) {
Log.verbose("Lutin is not init: path does not exist: '" + Env.getIslandPath() + "'"); LOGGER.trace("Lutin is not init: path does not exist: '" + Env.getIslandPath() + "'");
return false; return false;
} }
if (!Files.exists(Env.getIslandPathConfig())) { if (!Files.exists(Env.getIslandPathConfig())) {
Log.verbose("Lutin is not init: config does not exist: '" + Env.getIslandPathConfig() + "'"); LOGGER.trace("Lutin is not init: config does not exist: '" + Env.getIslandPathConfig() + "'");
return false; return false;
} }
if (!Files.exists(Env.getIslandPathManifest())) { if (!Files.exists(Env.getIslandPathManifest())) {
Log.verbose("Lutin is not init: Manifest does not exist: '" + Env.getIslandPathManifest() + "'"); LOGGER.trace("Lutin is not init: Manifest does not exist: '" + Env.getIslandPathManifest() + "'");
return false; return false;
} }
return true; return true;
@ -96,45 +96,45 @@ public class Manifest {
defaultPlouf = this.defaultBase.clone(); defaultPlouf = this.defaultBase.clone();
} }
} }
// Log.error(" this.default=" + str(this.default)) // LOGGER.error(" this.default=" + str(this.default))
// add all local project // add all local project
for (final ProjectConfig elem : mani.getProjects()) { for (final ProjectConfig elem : mani.getProjects()) {
Log.verbose("parse element " + elem); LOGGER.trace("parse element " + elem);
if (!Env.needProcessWithFilter(elem.getName())) { if (!Env.needProcessWithFilter(elem.getName())) {
Log.info("Filter repository: " + elem.getName()); LOGGER.info("Filter repository: " + elem.getName());
continue; continue;
} }
final ProjectConfig conf = new ProjectConfig(elem.getName(), createPathWithElem(elem), elem.getTag()); final ProjectConfig conf = new ProjectConfig(elem.getName(), createPathWithElem(elem), elem.getTag());
// add default remote for the project (search in herited element) // add default remote for the project (search in herited element)
for (final RemoteConfig remote : mani.getRemotes()) { for (final RemoteConfig remote : mani.getRemotes()) {
Log.verbose(" Local Remote: " + remote); LOGGER.trace(" Local Remote: " + remote);
if (remote.getName().equals(defaultPlouf.getDefaultRemote())) { if (remote.getName().equals(defaultPlouf.getDefaultRemote())) {
conf.getRemotes().add(remote); conf.getRemotes().add(remote);
} }
} }
if (conf.getRemotes().size() == 0) { if (conf.getRemotes().size() == 0) {
for (final RemoteConfig remote : upper_remotes) { for (final RemoteConfig remote : upper_remotes) {
Log.verbose(" upper Remote: " + remote); LOGGER.trace(" upper Remote: " + remote);
if (remote.getName() != null && remote.getName().equals(defaultPlouf.getDefaultRemote())) { if (remote.getName() != null && remote.getName().equals(defaultPlouf.getDefaultRemote())) {
conf.getRemotes().add(remote); conf.getRemotes().add(remote);
} }
} }
} }
if (conf.getRemotes().size() == 0) { if (conf.getRemotes().size() == 0) {
Log.error(" No remote detected: " + conf.getRemotes().size() + " for " + conf.getName() + " with default remote name : " + defaultPlouf.getDefaultRemote() + " this remote: " LOGGER.error(" No remote detected: " + conf.getRemotes().size() + " for " + conf.getName() + " with default remote name : " + defaultPlouf.getDefaultRemote() + " this remote: "
+ mani.getRemotes()); + mani.getRemotes());
} }
// select default remote: // select default remote:
Log.debug(" remotes count: " + conf.getRemotes().size()); LOGGER.debug(" remotes count: " + conf.getRemotes().size());
for (final RemoteConfig remote : conf.getRemotes()) { for (final RemoteConfig remote : conf.getRemotes()) {
Log.debug(" remote=" + remote); LOGGER.debug(" remote=" + remote);
Log.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getDefaultRemote()); LOGGER.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getDefaultRemote());
Log.verbose(" remote=" + remote); LOGGER.trace(" remote=" + remote);
Log.verbose(" default=" + defaultPlouf); LOGGER.trace(" default=" + defaultPlouf);
if (remote.getName().equals(defaultPlouf.getDefaultRemote())) { if (remote.getName().equals(defaultPlouf.getDefaultRemote())) {
conf.setSelectRemotes(remote.clone()); conf.setSelectRemotes(remote.clone());
Log.debug(" copy select=" + conf.getSelectRemotes()); LOGGER.debug(" copy select=" + conf.getSelectRemotes());
// copy the submodule synchronisation // copy the submodule synchronisation
// TODO: ????? conf.getSelectRemotes().setSync(defaultPlouf.isSync()); // TODO: ????? conf.getSelectRemotes().setSync(defaultPlouf.isSync());
@ -142,7 +142,7 @@ public class Manifest {
} }
} }
if (conf.getSelectRemotes() == null) { if (conf.getSelectRemotes() == null) {
Log.error("missing remote for project: " + conf.getName()); LOGGER.error("missing remote for project: " + conf.getName());
} }
conf.setBranch(defaultPlouf.getDefaultBranch()); conf.setBranch(defaultPlouf.getDefaultBranch());
out.add(conf); out.add(conf);
@ -165,7 +165,7 @@ public class Manifest {
//# ------------------------------------------------------------- //# -------------------------------------------------------------
//# -- add Volatile ... //# -- add Volatile ...
//# ------------------------------------------------------------- //# -------------------------------------------------------------
Log.verbose("include volatile config"); LOGGER.trace("include volatile config");
// TODO: maybe find a better way to do this... // TODO: maybe find a better way to do this...
/* /*
conf_global = config.get_unique_config() conf_global = config.get_unique_config()
@ -192,13 +192,13 @@ public class Manifest {
out.append(conf) out.append(conf)
//# ------------------------------------------------------------- //# -------------------------------------------------------------
if false: if false:
Log.info("list of all repo:") LOGGER.info("list of all repo:")
for elem in out: for elem in out:
Log.info(" '" + elem.name + "'") LOGGER.info(" '" + elem.name + "'")
Log.info(" path: " + elem.path) LOGGER.info(" path: " + elem.path)
Log.info(" remotes: " + str(elem.remotes)) LOGGER.info(" remotes: " + str(elem.remotes))
Log.info(" select_remote: " + str(elem.select_remote)) LOGGER.info(" select_remote: " + str(elem.select_remote))
Log.info(" branch: " + elem.branch) LOGGER.info(" branch: " + elem.branch)
*/ */
return out; return out;
} }
@ -212,7 +212,7 @@ public class Manifest {
final List<Artifactory> out = new ArrayList<>(); final List<Artifactory> out = new ArrayList<>();
// add all local project // add all local project
for (final Artifactory elem : mani.getArtefactories()) { for (final Artifactory elem : mani.getArtefactories()) {
Log.verbose("parse a " + elem); LOGGER.trace("parse a " + elem);
final Artifactory conf = elem.clone(); final Artifactory conf = elem.clone();
out.add(conf); out.add(conf);
} }
@ -281,7 +281,7 @@ public class Manifest {
this.rootManifest = rootDirectory.getFileName().toString(); this.rootManifest = rootDirectory.getFileName().toString();
rootDirectory = rootDirectory.getParent(); rootDirectory = rootDirectory.getParent();
Log.debug("PArse main XML config " + rootDirectory); LOGGER.debug("PArse main XML config " + rootDirectory);
ManifestFile parsedElements = null; ManifestFile parsedElements = null;
final XmlMapper mapper = new XmlMapper(); final XmlMapper mapper = new XmlMapper();
try { try {
@ -294,7 +294,7 @@ public class Manifest {
this.manifests.put(this.rootManifest, parsedElements); this.manifests.put(this.rootManifest, parsedElements);
for (final String includeElem : parsedElements.getIncludes()) { for (final String includeElem : parsedElements.getIncludes()) {
final Path maniPath = rootDirectory.resolve(includeElem); final Path maniPath = rootDirectory.resolve(includeElem);
Log.debug("PArse <<SUB>> XML config " + maniPath); LOGGER.debug("PArse <<SUB>> XML config " + maniPath);
ManifestFile tmpManifest = null; ManifestFile tmpManifest = null;
try { try {
tmpManifest = mapper.parse(maniPath, ManifestFile.class); tmpManifest = mapper.parse(maniPath, ManifestFile.class);

View File

@ -22,15 +22,15 @@ public class Tools {
try { try {
Files.createDirectory(absPath); Files.createDirectory(absPath);
} catch (IOException e) { } catch (IOException e) {
Log.error("Errro while creating path ... " + e.getMessage()); LOGGER.error("Errro while creating path ... " + e.getMessage());
Log.error("Path ... " + absPath); LOGGER.error("Path ... " + absPath);
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
public static void createSymbolicLink(Path link, Path target) throws IOException { public static void createSymbolicLink(Path link, Path target) throws IOException {
Log.warning("create Link {} -> {}", link, target); LOGGER.warn("create Link {} -> {}", link, target);
createDirectory(link.getParent()); createDirectory(link.getParent());
if (Files.exists(link)) { if (Files.exists(link)) {
Files.delete(link); Files.delete(link);
@ -44,7 +44,7 @@ public class Tools {
if (!Files.exists(path.getParent())) { if (!Files.exists(path.getParent())) {
File file = path.getParent().toFile(); File file = path.getParent().toFile();
if (!file.mkdirs()) { if (!file.mkdirs()) {
Log.critical("Can not create the path:" + path.getParent()); LOGGER.critical("Can not create the path:" + path.getParent());
} }
} }
try { try {
@ -93,14 +93,14 @@ public class Tools {
* @return list of element : {"1", "5", "2", "dev"} * @return list of element : {"1", "5", "2", "dev"}
*/ */
public static String[] versionStringToList(final String version) { public static String[] versionStringToList(final String version) {
Log.verbose("parse version string '" + version + "'"); LOGGER.trace("parse version string '" + version + "'");
List<String> out = new ArrayList<>(); List<String> out = new ArrayList<>();
if (version == null || version.isEmpty()) { if (version == null || version.isEmpty()) {
return new String[] { "0", "0", "0" }; return new String[] { "0", "0", "0" };
} }
String[] elems = version.split("-"); String[] elems = version.split("-");
if (elems[0].split(".").length <= 1) { if (elems[0].split(".").length <= 1) {
Log.critical("Can not parde a version with wrong version model '" + version + "'"); LOGGER.critical("Can not parde a version with wrong version model '" + version + "'");
} }
List<String> values = Arrays.asList(elems[0].split(".")); List<String> values = Arrays.asList(elems[0].split("."));
for (String elem : values) { for (String elem : values) {
@ -129,7 +129,7 @@ public class Tools {
public static void waitForServerIfNeeded() { public static void waitForServerIfNeeded() {
int waitTime = Env.getWaitBetweenSeverCommand(); int waitTime = Env.getWaitBetweenSeverCommand();
if (waitTime > 0) { if (waitTime > 0) {
Log.info("Waiting between commands: " + waitTime + "s"); LOGGER.info("Waiting between commands: " + waitTime + "s");
try { try {
Thread.sleep(waitTime * 1000); Thread.sleep(waitTime * 1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {

View File

@ -48,12 +48,12 @@ public class BaseCheckout {
Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName());
if (!Files.exists(file_source_manifest)) { if (!Files.exists(file_source_manifest)) {
Log.critical("Missing manifest file { '" + file_source_manifest.toAbsolutePath() + "'"); LOGGER.critical("Missing manifest file { '" + file_source_manifest.toAbsolutePath() + "'");
} }
Manifest mani = new Manifest(file_source_manifest); Manifest mani = new Manifest(file_source_manifest);
List<ProjectConfig> all_project = mani.get_all_configs(); List<ProjectConfig> all_project = mani.get_all_configs();
Log.info("checkout of{ " + all_project.size() + " projects"); LOGGER.info("checkout of{ " + all_project.size() + " projects");
int id_element = 0; int id_element = 0;
boolean have_error = false; boolean have_error = false;
for (ProjectConfig elem : all_project) { for (ProjectConfig elem : all_project) {
@ -64,7 +64,7 @@ public class BaseCheckout {
} }
} }
if (have_error == true) { if (have_error == true) {
Log.error("Checkout have fail !!! "); LOGGER.error("Checkout have fail !!! ");
} }
} }

View File

@ -50,18 +50,18 @@ public class BaseCommit {
// load the manifest after pulling it (if possible) // load the manifest after pulling it (if possible)
Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName());
if (!Files.exists(file_source_manifest)) { if (!Files.exists(file_source_manifest)) {
Log.critical("Missing manifest file : '" + file_source_manifest + "'"); LOGGER.critical("Missing manifest file : '" + file_source_manifest + "'");
} }
Manifest mani = new Manifest(file_source_manifest); Manifest mani = new Manifest(file_source_manifest);
List<ProjectConfig> all_project = mani.get_all_configs(); List<ProjectConfig> all_project = mani.get_all_configs();
Log.print("Commit of: " + all_project.size() + " projects"); LOGGER.print("Commit of: " + all_project.size() + " projects");
int id_element = 0; int id_element = 0;
for (ProjectConfig elem : all_project) { for (ProjectConfig elem : all_project) {
id_element++; id_element++;
String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem); String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem);
Log.info("commit : " + base_display); LOGGER.info("commit : " + base_display);
Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath());
if ( !Commands.isGitRepository(git_repo_path.toString())) { if ( !Commands.isGitRepository(git_repo_path.toString())) {
continue; continue;
@ -69,7 +69,7 @@ public class BaseCommit {
Git git = Git.open(git_repo_path.toFile()); Git git = Git.open(git_repo_path.toFile());
boolean is_modify = git.status().call().hasUncommittedChanges(); boolean is_modify = git.status().call().hasUncommittedChanges();
if (!is_modify) { if (!is_modify) {
Log.info("Not modify skip !! "); LOGGER.info("Not modify skip !! ");
continue; continue;
} }
// simply update the repository ... // simply update the repository ...
@ -78,7 +78,7 @@ public class BaseCommit {
.setAmend(this.amend) .setAmend(this.amend)
.setMessage(this.message) .setMessage(this.message)
.call(); .call();
Log.print("[" + elem.getName() + "] commit done"); LOGGER.print("[" + elem.getName() + "] commit done");
} }
} }
} }

View File

@ -49,36 +49,36 @@ public class BaseFetch {
// load the manifest after pulling it (if possible) // load the manifest after pulling it (if possible)
Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName());
if (!Files.exists(file_source_manifest)) { if (!Files.exists(file_source_manifest)) {
Log.critical("Missing manifest file : '" + file_source_manifest + "'"); LOGGER.critical("Missing manifest file : '" + file_source_manifest + "'");
} }
Manifest mani = new Manifest(file_source_manifest); Manifest mani = new Manifest(file_source_manifest);
List<ProjectConfig> all_project = mani.get_all_configs(); List<ProjectConfig> all_project = mani.get_all_configs();
Log.info("Synchronize of: " + all_project.size() + " projects"); LOGGER.info("Synchronize of: " + all_project.size() + " projects");
int id_element = 0; int id_element = 0;
for (ProjectConfig elem : all_project) { for (ProjectConfig elem : all_project) {
id_element++; id_element++;
String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem); String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem);
Log.print("fetch : " + base_display); LOGGER.print("fetch : " + base_display);
Tools.waitForServerIfNeeded(); Tools.waitForServerIfNeeded();
Log.debug("elem : " + elem); LOGGER.debug("elem : " + elem);
Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath());
if (elem.getTag() != null) { if (elem.getTag() != null) {
Log.todo("Need to select a specific tag version ... " + elem.getTag()); LOGGER.info("[TODO] Need to select a specific tag version ... " + elem.getTag());
} }
if (!Commands.isGitRepository(elem.getPath())) { if (!Commands.isGitRepository(elem.getPath())) {
continue; continue;
} }
// simply update the repository ... // simply update the repository ...
Log.verbose("Fetching project: "); LOGGER.trace("Fetching project: ");
{ {
Git git = Git.open(git_repo_path.toFile()); Git git = Git.open(git_repo_path.toFile());
git.fetch() git.fetch()
.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)))
.setRemote(elem.getSelectRemotes().getName()) .setRemote(elem.getSelectRemotes().getName())
.call(); .call();
Log.info("[" + elem.getName() + "] fetch done"); LOGGER.info("[" + elem.getName() + "] fetch done");
} }
} }
// Update the links: // Update the links:

View File

@ -40,11 +40,11 @@ public class BaseInit {
@ArgParams("Manifest Address") @ArgParams("Manifest Address")
public void execute(final String addressManifest) throws ActionException, Exception { public void execute(final String addressManifest) throws ActionException, Exception {
if (addressManifest.isEmpty()) { if (addressManifest.isEmpty()) {
Log.critical("Init: Missing manifest name"); LOGGER.critical("Init: Missing manifest name");
} }
Log.info("Init with: '" + addressManifest + "' branch='" + this.branch + "' name of manifest='" + this.manifestFile + "'"); LOGGER.info("Init with: '" + addressManifest + "' branch='" + this.branch + "' name of manifest='" + this.manifestFile + "'");
if (Manifest.isInit()) { if (Manifest.isInit()) {
Log.critical("System already init: path already exist: '" + Env.getIslandPath() + "'"); LOGGER.critical("System already init: path already exist: '" + Env.getIslandPath() + "'");
} }
Tools.createDirectory(Env.getIslandPath()); Tools.createDirectory(Env.getIslandPath());
@ -56,10 +56,10 @@ public class BaseInit {
configuration.store(); configuration.store();
Tools.createDirectory(Env.getIslandPathManifest()); Tools.createDirectory(Env.getIslandPathManifest());
Log.info("Clone the manifest"); LOGGER.info("Clone the manifest");
// init session on apache ssh: // init session on apache ssh:
SshdSessionFactory factory = new SshdSessionFactory(new JGitKeyCache(), new DefaultProxyDataFactory()); SshdSessionFactory factory = new SshdSessionFactory(new JGitKeyCache(), new DefaultProxyDataFactory());
//Log.error("iiii " + factory.getSshDirectory()); //LOGGER.error("iiii " + factory.getSshDirectory());
Runtime.getRuntime().addShutdownHook(new Thread(factory::close)); Runtime.getRuntime().addShutdownHook(new Thread(factory::close));
SshSessionFactory.setInstance(factory); SshSessionFactory.setInstance(factory);

View File

@ -52,21 +52,21 @@ public class BasePush {
Manifest mani = new Manifest(file_source_manifest); Manifest mani = new Manifest(file_source_manifest);
List<ProjectConfig> all_project = mani.get_all_configs(); List<ProjectConfig> all_project = mani.get_all_configs();
Log.info("Synchronize of: " + all_project.size() + " projects"); LOGGER.info("Synchronize of: " + all_project.size() + " projects");
int id_element = 0; int id_element = 0;
for (ProjectConfig elem : all_project) { for (ProjectConfig elem : all_project) {
id_element++; id_element++;
String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem); String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem);
Log.print("push : " + base_display + dryRunComment); LOGGER.print("push : " + base_display + dryRunComment);
Tools.waitForServerIfNeeded(); Tools.waitForServerIfNeeded();
Log.debug("elem : " + elem); LOGGER.debug("elem : " + elem);
Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath());
if (!Commands.isGitRepository(elem.getPath())) { if (!Commands.isGitRepository(elem.getPath())) {
continue; continue;
} }
// simply update the repository ... // simply update the repository ...
Log.verbose("push project: "); LOGGER.trace("push project: ");
{ {
Git git = Git.open(git_repo_path.toFile()); Git git = Git.open(git_repo_path.toFile());
String select_branch = git.getRepository().getBranch(); String select_branch = git.getRepository().getBranch();
@ -78,8 +78,8 @@ public class BasePush {
.add(select_branch) // .add(select_branch) //
.setDryRun(this.dryRun) // .setDryRun(this.dryRun) //
.call(); .call();
Log.verbose("plop " + plo.hashCode()); LOGGER.trace("plop " + plo.hashCode());
Log.info("[" + elem.getName() + "] fetch done " + dryRunComment); LOGGER.info("[" + elem.getName() + "] fetch done " + dryRunComment);
} }
} }
// Update the links: // Update the links:

View File

@ -44,17 +44,17 @@ public class BaseStatus {
Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName());
if (!Files.exists(file_source_manifest)) { if (!Files.exists(file_source_manifest)) {
Log.critical("Missing manifest file : '" + file_source_manifest + "'"); LOGGER.critical("Missing manifest file : '" + file_source_manifest + "'");
} }
Manifest mani = new Manifest(file_source_manifest); Manifest mani = new Manifest(file_source_manifest);
Git git = Git.open(Env.getIslandPathManifest().toFile()); Git git = Git.open(Env.getIslandPathManifest().toFile());
boolean is_modify_manifest = git.status().call().hasUncommittedChanges(); boolean is_modify_manifest = git.status().call().hasUncommittedChanges();
if (is_modify_manifest) { if (is_modify_manifest) {
Log.info("!!!!!!!!!!!! MANIFEST is modify !!!!!!!!"); LOGGER.info("!!!!!!!!!!!! MANIFEST is modify !!!!!!!!");
} }
List<ProjectConfig> all_project = mani.get_all_configs(); List<ProjectConfig> all_project = mani.get_all_configs();
Log.info("status of: " + all_project.size() + " projects"); LOGGER.info("status of: " + all_project.size() + " projects");
int id_element = 0; int id_element = 0;
/* Display status of manifest ==> todo later ... /* Display status of manifest ==> todo later ...

View File

@ -62,30 +62,30 @@ public class BaseSync {
// load the manifest after pulling it (if possible) // load the manifest after pulling it (if possible)
Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName());
if (!Files.exists(file_source_manifest)) { if (!Files.exists(file_source_manifest)) {
Log.critical("Missing manifest file : '" + file_source_manifest + "'"); LOGGER.critical("Missing manifest file : '" + file_source_manifest + "'");
} }
Manifest mani = new Manifest(file_source_manifest); Manifest mani = new Manifest(file_source_manifest);
List<ProjectConfig> all_project = mani.get_all_configs(); List<ProjectConfig> all_project = mani.get_all_configs();
Log.info("Synchronize of: " + all_project.size() + " projects"); LOGGER.info("Synchronize of: " + all_project.size() + " projects");
int id_element = 0; int id_element = 0;
for (ProjectConfig elem : all_project) { for (ProjectConfig elem : all_project) {
id_element++; id_element++;
String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem); String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem);
Log.info("sync : " + base_display); LOGGER.info("sync : " + base_display);
Tools.waitForServerIfNeeded(); Tools.waitForServerIfNeeded();
Log.debug("elem : " + elem); LOGGER.debug("elem : " + elem);
Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath());
if (elem.getTag() != null) { if (elem.getTag() != null) {
Log.todo("Need to select a specific tag version ... " + elem.getTag()); LOGGER.info("[TODO] Need to select a specific tag version ... " + elem.getTag());
} }
if (!Files.exists(git_repo_path)) { if (!Files.exists(git_repo_path)) {
// this is a new clone ==> this is easy ... // this is a new clone ==> this is easy ...
Log.warning("Path Does not Exist ... " + git_repo_path); LOGGER.warn("Path Does not Exist ... " + git_repo_path);
String addressManifest = configuration.createAdressGitRepo(elem.getSelectRemotes().getFetch(), elem.getName()); String addressManifest = configuration.createAdressGitRepo(elem.getSelectRemotes().getFetch(), elem.getName());
Log.info("clone the repo : " + addressManifest); LOGGER.info("clone the repo : " + addressManifest);
Git git = Git.cloneRepository() Git git = Git.cloneRepository()
.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)))
@ -95,7 +95,7 @@ public class BaseSync {
.call(); .call();
// add global mirror list // add global mirror list
for (MirrorConfig mirror : elem.getSelectRemotes().getMirror()) { for (MirrorConfig mirror : elem.getSelectRemotes().getMirror()) {
Log.verbose("Add global mirror: " + mirror); LOGGER.trace("Add global mirror: " + mirror);
String addressManifestMiror = configuration.createAdressGitRepo(mirror.getFetch(), elem.getName()); String addressManifestMiror = configuration.createAdressGitRepo(mirror.getFetch(), elem.getName());
StoredConfig config = git.getRepository().getConfig(); StoredConfig config = git.getRepository().getConfig();
config.setString("remote", mirror.getName(), "url", addressManifestMiror); config.setString("remote", mirror.getName(), "url", addressManifestMiror);
@ -104,9 +104,9 @@ public class BaseSync {
// check submodule if requested: // check submodule if requested:
if (elem.getSelectRemotes().isSync() if (elem.getSelectRemotes().isSync()
&& Files.exists(git_repo_path.resolve(".gitmodules"))) { && Files.exists(git_repo_path.resolve(".gitmodules"))) {
Log.info(" ==> update submodule (init)"); LOGGER.info(" ==> update submodule (init)");
git.submoduleInit().call(); git.submoduleInit().call();
Log.info(" ==> update submodule (update)"); LOGGER.info(" ==> update submodule (update)");
git.submoduleUpdate() git.submoduleUpdate()
.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)))
.call(); .call();
@ -115,15 +115,15 @@ public class BaseSync {
} }
if (!Files.exists(git_repo_path.resolve(".git"))) { if (!Files.exists(git_repo_path.resolve(".git"))) {
// path already exist but it is not used to as a git repo ==> this is an error // path already exist but it is not used to as a git repo ==> this is an error
Log.error("path '" + git_repo_path + "' is already existing but not used for a git repository. Clean it and restart"); LOGGER.error("path '" + git_repo_path + "' is already existing but not used for a git repository. Clean it and restart");
} }
if (this.downloadOnly == true) { if (this.downloadOnly == true) {
Log.info("SYNC: Already downloaded"); LOGGER.info("SYNC: Already downloaded");
continue; continue;
} }
// simply update the repository ... // simply update the repository ...
Log.verbose("Fetching project: "); LOGGER.trace("Fetching project: ");
{ {
Git git = Git.open(git_repo_path.toFile()); Git git = Git.open(git_repo_path.toFile());
Repository repo = git.getRepository(); Repository repo = git.getRepository();
@ -138,18 +138,18 @@ public class BaseSync {
.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)))
.setRemote(elem.getSelectRemotes().getName()) .setRemote(elem.getSelectRemotes().getName())
.call(); .call();
Log.warning("[" + elem.getName() + "] Not update ==> the repository is modified (just fetch)"); LOGGER.warn("[" + elem.getName() + "] Not update ==> the repository is modified (just fetch)");
continue; continue;
} }
git.pull() git.pull()
.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)))
.setRemote(elem.getSelectRemotes().getName()) .setRemote(elem.getSelectRemotes().getName())
.call(); .call();
Log.verbose("select branch = '" + select_branch + "' track: '" + ret_track + "'"); LOGGER.trace("select branch = '" + select_branch + "' track: '" + ret_track + "'");
// check submodule if requested: // check submodule if requested:
if (elem.getSelectRemotes().isSync() if (elem.getSelectRemotes().isSync()
&& Files.exists(git_repo_path.resolve(".gitmodules"))) { && Files.exists(git_repo_path.resolve(".gitmodules"))) {
Log.info(" ==> sync submodule"); LOGGER.info(" ==> sync submodule");
git.submoduleUpdate() git.submoduleUpdate()
.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)))
.call(); .call();

View File

@ -49,7 +49,7 @@ public class Deliver {
// load the manifest after pulling it (if possible) // load the manifest after pulling it (if possible)
Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName());
if (!Files.exists(file_source_manifest)) { if (!Files.exists(file_source_manifest)) {
Log.critical("Missing manifest file : '" + file_source_manifest + "'"); LOGGER.critical("Missing manifest file : '" + file_source_manifest + "'");
} }
Manifest mani = new Manifest(file_source_manifest); Manifest mani = new Manifest(file_source_manifest);
if (this.from == null || this.from.isEmpty()) { if (this.from == null || this.from.isEmpty()) {
@ -60,29 +60,29 @@ public class Deliver {
} }
List<ProjectConfig> all_project = mani.get_all_configs(); List<ProjectConfig> all_project = mani.get_all_configs();
Log.info("Check if all project are on master: " + all_project.size() + " projects"); LOGGER.info("Check if all project are on master: " + all_project.size() + " projects");
boolean deliver_availlable = true; boolean deliver_availlable = true;
int id_element = 0; int id_element = 0;
for (ProjectConfig elem : all_project) { for (ProjectConfig elem : all_project) {
id_element++; id_element++;
String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem); String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem);
Log.verbose("delivercheck : " + base_display); LOGGER.trace("delivercheck : " + base_display);
if (!StatusActions.deliverCheck(elem, null, id_element, base_display, this.from, this.to)) { if (!StatusActions.deliverCheck(elem, null, id_element, base_display, this.from, this.to)) {
deliver_availlable = false; deliver_availlable = false;
} }
} }
if (!deliver_availlable) { if (!deliver_availlable) {
Log.error("deliver-ckeck: Correct the warning to validate the Merge"); LOGGER.error("deliver-ckeck: Correct the warning to validate the Merge");
return; return;
} }
Log.info("deliver-ckeck: ==> All is OK"); LOGGER.info("deliver-ckeck: ==> All is OK");
id_element = 0; id_element = 0;
for (ProjectConfig elem : all_project) { for (ProjectConfig elem : all_project) {
id_element += 1; id_element += 1;
String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem); String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem);
Log.info("deliver: ========================================================================"); LOGGER.info("deliver: ========================================================================");
Log.info("deliver:.equals(" + base_display); LOGGER.info("deliver:.equals(" + base_display);
Log.info("deliver: ========================================================================"); LOGGER.info("deliver: ========================================================================");
Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath());
// Check the validity of the version, // Check the validity of the version,
@ -90,14 +90,14 @@ public class Deliver {
if (curentVersionElem == null) { if (curentVersionElem == null) {
continue; continue;
} }
Log.info("deliver: ==> version: " + curentVersionElem.version()); LOGGER.info("deliver: ==> version: " + curentVersionElem.version());
Git git = Git.open(git_repo_path.toFile()); Git git = Git.open(git_repo_path.toFile());
// Checkout destination branch: // Checkout destination branch:
Commands.checkout(git, this.to); Commands.checkout(git, this.to);
// create new repo tag // create new repo tag
int[] new_version_description = Commands.create_new_version_repo(git, curentVersionElem.version(), curentVersionElem.addInManagement(), this.from, this.to); int[] new_version_description = Commands.create_new_version_repo(git, curentVersionElem.version(), curentVersionElem.addInManagement(), this.from, this.to);
Log.info("new version: " + Arrays.toString(new_version_description)); LOGGER.info("new version: " + Arrays.toString(new_version_description));
if (new_version_description == null) { if (new_version_description == null) {
continue; continue;
} }

View File

@ -118,9 +118,9 @@ public class DependencySync {
} }
root.put("dependency", dep); root.put("dependency", dep);
Ejson.generate(root, data); Ejson.generate(root, data);
//Log.error("generated GLD dependency : {}", data.toString()); //LOGGER.error("generated GLD dependency : {}", data.toString());
//Log.error(" ==> {}", createArtefactLinkGLDFile.toString()); //LOGGER.error(" ==> {}", createArtefactLinkGLDFile.toString());
//Log.error(" --> {}", artefactLink.toString()); //LOGGER.error(" --> {}", artefactLink.toString());
Tools.fileWriteData(createArtefactLinkGLDFile, data.toString()); Tools.fileWriteData(createArtefactLinkGLDFile, data.toString());
} }
@ -138,7 +138,7 @@ public class DependencySync {
} }
private void downloadPackage(final List<Artifactory> artefactories, final Dependency dependency, final List<UpdateDependency> alreadyDone) throws Exception { private void downloadPackage(final List<Artifactory> artefactories, final Dependency dependency, final List<UpdateDependency> alreadyDone) throws Exception {
Log.debug("download : " + dependency); LOGGER.debug("download : " + dependency);
for (final UpdateDependency elem : alreadyDone) { for (final UpdateDependency elem : alreadyDone) {
if (elem.dependency.org().equals(dependency.org()) && elem.dependency.name().equals(dependency.name()) && elem.dependency.remote().equals(dependency.remote())) { if (elem.dependency.org().equals(dependency.org()) && elem.dependency.name().equals(dependency.name()) && elem.dependency.remote().equals(dependency.remote())) {
// find element ==> check version // find element ==> check version
@ -152,10 +152,10 @@ public class DependencySync {
} }
final String metadataFile = createMavenMetadataRemoteFileName(artefactories, dependency); final String metadataFile = createMavenMetadataRemoteFileName(artefactories, dependency);
Log.verbose("Metadata position: " + metadataFile); LOGGER.trace("Metadata position: " + metadataFile);
final Path localPath = createMetadataLocalFileName(artefactories, dependency); final Path localPath = createMetadataLocalFileName(artefactories, dependency);
final String dataAsString = readAllMatadataAndStore(metadataFile, localPath); final String dataAsString = readAllMatadataAndStore(metadataFile, localPath);
Log.verbose("dataAsString: " + dataAsString); LOGGER.trace("dataAsString: " + dataAsString);
MavenMetadata metaData = null; MavenMetadata metaData = null;
final XmlMapper mapper = new XmlMapper(); final XmlMapper mapper = new XmlMapper();
try { try {
@ -164,7 +164,7 @@ public class DependencySync {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
Log.print("metaData=" + metaData); LOGGER.print("metaData=" + metaData);
// TODO : check if the current file is newer.... // TODO : check if the current file is newer....
@ -243,25 +243,25 @@ public class DependencySync {
// load the manifest after pulling it (if possible) // load the manifest after pulling it (if possible)
final Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); final Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName());
if (!Files.exists(file_source_manifest)) { if (!Files.exists(file_source_manifest)) {
Log.critical("Missing manifest file : '" + file_source_manifest + "'"); LOGGER.critical("Missing manifest file : '" + file_source_manifest + "'");
} }
final Manifest mani = new Manifest(file_source_manifest); final Manifest mani = new Manifest(file_source_manifest);
final List<Artifactory> artefactories = mani.getAllArtefactories(); final List<Artifactory> artefactories = mani.getAllArtefactories();
final List<Dependency> dependencies = mani.getAllDependencies(); final List<Dependency> dependencies = mani.getAllDependencies();
Log.info("Synchronize of: " + dependencies.size() + " dependenc" + Tools.getPlural(dependencies)); LOGGER.info("Synchronize of: " + dependencies.size() + " dependenc" + Tools.getPlural(dependencies));
Log.info("base on: " + artefactories.size() + " artefactor" + Tools.getPlural(artefactories)); LOGGER.info("base on: " + artefactories.size() + " artefactor" + Tools.getPlural(artefactories));
int id_element = 0; int id_element = 0;
for (final Dependency elem : dependencies) { for (final Dependency elem : dependencies) {
id_element++; id_element++;
final String base_display = Tools.getListBaseDisplay(id_element, dependencies.size(), elem); final String base_display = Tools.getListBaseDisplay(id_element, dependencies.size(), elem);
Log.info("dep-sync : " + base_display); LOGGER.info("dep-sync : " + base_display);
Log.debug("elem : " + elem); LOGGER.debug("elem : " + elem);
downloadPackage(artefactories, elem, alreadyDone); downloadPackage(artefactories, elem, alreadyDone);
} }
Log.print("Dependency sync END"); LOGGER.print("Dependency sync END");
} }
Artifactory findArtifactory(final List<Artifactory> artefactories, final String name) { Artifactory findArtifactory(final List<Artifactory> artefactories, final String name) {
@ -281,7 +281,7 @@ public class DependencySync {
return elem; return elem;
} }
} }
Log.error("Can not find the remote '" + name + "'artefactory in the list ==> fallback to 'default'"); LOGGER.error("Can not find the remote '" + name + "'artefactory in the list ==> fallback to 'default'");
return out; return out;
} }
@ -308,18 +308,18 @@ public class DependencySync {
} }
void listFiles(final Path path) { void listFiles(final Path path) {
Log.info("List of file in " + path); LOGGER.info("List of file in " + path);
try { try {
final ZipFile zipFile = new ZipFile(path.toFile()); final ZipFile zipFile = new ZipFile(path.toFile());
final Enumeration<? extends ZipEntry> entries = zipFile.entries(); final Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
final ZipEntry entry = entries.nextElement(); final ZipEntry entry = entries.nextElement();
Log.info(" - " + entry.getName() + " (" + entry.getSize() + ")"); LOGGER.info(" - " + entry.getName() + " (" + entry.getSize() + ")");
//InputStream stream = zipFile.getInputStream(entry); //InputStream stream = zipFile.getInputStream(entry);
} }
} catch (final IOException ex) { } catch (final IOException ex) {
Log.error("Catch Exception : " + ex.getLocalizedMessage()); LOGGER.error("Catch Exception : " + ex.getLocalizedMessage());
ex.printStackTrace(); ex.printStackTrace();
} }
} }
@ -338,25 +338,25 @@ public class DependencySync {
result.append("\n"); result.append("\n");
} }
} catch (final Exception ex) { } catch (final Exception ex) {
Log.error("Can not retrive data from artefactory ..." + ex.getLocalizedMessage()); LOGGER.error("Can not retrive data from artefactory ..." + ex.getLocalizedMessage());
throw ex; throw ex;
} }
final String dataAsString = result.toString(); final String dataAsString = result.toString();
Log.verbose("return=" + dataAsString); LOGGER.trace("return=" + dataAsString);
Tools.fileWriteData(path, dataAsString); Tools.fileWriteData(path, dataAsString);
return dataAsString; return dataAsString;
} }
void readRemoteFileAndStore(final String urlPath, final Path path, final String baseName) throws Exception { void readRemoteFileAndStore(final String urlPath, final Path path, final String baseName) throws Exception {
if (Files.exists(path)) { if (Files.exists(path)) {
Log.debug("File already download : " + baseName); LOGGER.debug("File already download : " + baseName);
return; return;
} }
try { try {
if (!Files.exists(path.getParent())) { if (!Files.exists(path.getParent())) {
final File file = path.getParent().toFile(); final File file = path.getParent().toFile();
if (!file.mkdirs()) { if (!file.mkdirs()) {
Log.critical("Can not create the path:" + path.getParent()); LOGGER.critical("Can not create the path:" + path.getParent());
} }
} }
final URL url = new URL(urlPath); final URL url = new URL(urlPath);
@ -383,7 +383,7 @@ public class DependencySync {
// this is the way to have atomic replacement of file and not partial downloaded file ==> move is 99.999999% atomic. // this is the way to have atomic replacement of file and not partial downloaded file ==> move is 99.999999% atomic.
Files.move(tmpFile, path); Files.move(tmpFile, path);
} catch (final FileNotFoundException ex) { } catch (final FileNotFoundException ex) {
Log.warning("File not found: " + urlPath); LOGGER.warn("File not found: " + urlPath);
} finally { } finally {
} }

View File

@ -39,7 +39,7 @@ public class ManifestCheckout {
ProjectConfig elem = configuration.getManifestConfig(); ProjectConfig elem = configuration.getManifestConfig();
String base_display = Tools.getListBaseDisplay(0, 0, elem); String base_display = Tools.getListBaseDisplay(0, 0, elem);
if (!StatusActions.checkoutElem(elem, this.remote, branch, base_display)) { if (!StatusActions.checkoutElem(elem, this.remote, branch, base_display)) {
Log.error("Checkout have fail !!! "); LOGGER.error("Checkout have fail !!! ");
} }
} }

View File

@ -22,17 +22,17 @@ public class StatusActions {
public static String baseNameOfATaggedBranch = "branch_on_tag_"; public static String baseNameOfATaggedBranch = "branch_on_tag_";
public static boolean checkoutElem(final ProjectConfig elem, final String argumentRemoteName, String branchToCheckout, final String baseDisplay) throws Exception { public static boolean checkoutElem(final ProjectConfig elem, final String argumentRemoteName, String branchToCheckout, final String baseDisplay) throws Exception {
Log.verbose("checkout : " + baseDisplay); LOGGER.trace("checkout : " + baseDisplay);
Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath());
if (!Files.exists(git_repo_path)){ if (!Files.exists(git_repo_path)){
Log.warning("checkout " + baseDisplay + " ==> repository does not exist ..."); LOGGER.warn("checkout " + baseDisplay + " ==> repository does not exist ...");
return false; return false;
} }
// check if the repository is modify // check if the repository is modify
Git git = Git.open(git_repo_path.toFile()); Git git = Git.open(git_repo_path.toFile());
boolean is_modify = git.status().call().hasUncommittedChanges(); boolean is_modify = git.status().call().hasUncommittedChanges();
if (is_modify){ if (is_modify){
Log.warning("checkout " + baseDisplay + " ==> modify data can not checkout new branch"); LOGGER.warn("checkout " + baseDisplay + " ==> modify data can not checkout new branch");
return false; return false;
} }
List<String> list_branch_local = Commands.getListBranchLocal(git); List<String> list_branch_local = Commands.getListBranchLocal(git);
@ -43,24 +43,24 @@ public class StatusActions {
branchToCheckout = StatusActions.baseNameOfATaggedBranch + elem.getTag(); branchToCheckout = StatusActions.baseNameOfATaggedBranch + elem.getTag();
is_tag = true; is_tag = true;
if (elem.isVolatile()) { if (elem.isVolatile()) {
Log.info("checkout " + baseDisplay + " ==> Can not checkout for 'volatile' repository"); LOGGER.info("checkout " + baseDisplay + " ==> Can not checkout for 'volatile' repository");
return true; return true;
} }
if (elem.getTag() == null) { if (elem.getTag() == null) {
Log.info("checkout " + baseDisplay + " ==> Can not checkout for 'null' Tag"); LOGGER.info("checkout " + baseDisplay + " ==> Can not checkout for 'null' Tag");
return true; return true;
} }
} }
// check if we are on the good branch{ // check if we are on the good branch{
if (branchToCheckout.equals(select_branch)) { if (branchToCheckout.equals(select_branch)) {
Log.info("checkout " + baseDisplay + " ==> No change already on good branch"); LOGGER.info("checkout " + baseDisplay + " ==> No change already on good branch");
return true; return true;
} }
// check if we have already checkout the branch before // check if we have already checkout the branch before
Log.verbose(" check : " + branchToCheckout + " in " + list_branch_local); LOGGER.trace(" check : " + branchToCheckout + " in " + list_branch_local);
if (list_branch_local.contains("refs/heads/" + branchToCheckout)) { if (list_branch_local.contains("refs/heads/" + branchToCheckout)) {
git.checkout().setCreateBranch(false).setName("refs/heads/" + branchToCheckout).call(); git.checkout().setCreateBranch(false).setName("refs/heads/" + branchToCheckout).call();
Log.info("checkout " + baseDisplay + " ==> switch branch"); LOGGER.info("checkout " + baseDisplay + " ==> switch branch");
return true; return true;
} }
@ -74,13 +74,13 @@ public class StatusActions {
} }
// Check if the remote branch exist ... // Check if the remote branch exist ...
if (is_tag) { if (is_tag) {
Log.info("checkout " + baseDisplay + " ==> NO remote branch"); LOGGER.info("checkout " + baseDisplay + " ==> NO remote branch");
return true; return true;
} }
List<String> list_branch_remote = Commands.getListBranchRemote(git); List<String> list_branch_remote = Commands.getListBranchRemote(git);
String tryRemoteBranch = elem.getSelectRemotes().getName() + "/" + branchToCheckout; String tryRemoteBranch = elem.getSelectRemotes().getName() + "/" + branchToCheckout;
if (list_branch_remote.contains("refs/remotes/" + tryRemoteBranch)) { if (list_branch_remote.contains("refs/remotes/" + tryRemoteBranch)) {
Log.info(" ==> find ..."); LOGGER.info(" ==> find ...");
try { try {
git.checkout() git.checkout()
.setCreateBranch(true) .setCreateBranch(true)
@ -90,33 +90,33 @@ public class StatusActions {
.call(); .call();
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
Log.error("checkout " + baseDisplay + " ==> Can not checkout to the correct branch"); LOGGER.error("checkout " + baseDisplay + " ==> Can not checkout to the correct branch");
return false; return false;
} }
Log.info("checkout " + baseDisplay + " ==> create new branch"); LOGGER.info("checkout " + baseDisplay + " ==> create new branch");
return true; return true;
} }
// Checkout a specific tags{ // Checkout a specific tags{
if (!list_tags.contains(elem.getTag())) { if (!list_tags.contains(elem.getTag())) {
Log.info("checkout " + baseDisplay + " ==> NO remote tags"); LOGGER.info("checkout " + baseDisplay + " ==> NO remote tags");
return true; return true;
} }
Log.info(" ==> find ..."); LOGGER.info(" ==> find ...");
Log.todo("checkout " + baseDisplay + " ==> Can not checkout to the correct tags MUST be inplemented"); LOGGER.info("[TODO] checkout " + baseDisplay + " ==> Can not checkout to the correct tags MUST be inplemented");
return false; return false;
/* /*
// checkout the new branch{ // checkout the new branch{
cmd = "git checkout --quiet " + elem.tag + " -b " + branch_to_checkout; cmd = "git checkout --quiet " + elem.tag + " -b " + branch_to_checkout;
// + " --track " + elem.select_remote["name"] + "/" + branch_to_checkout; // + " --track " + elem.select_remote["name"] + "/" + branch_to_checkout;
Log.verbose("execute : " + cmd); LOGGER.trace("execute : " + cmd);
ret = multiprocess.run_command(cmd, cwd=git_repo_path); ret = multiprocess.run_command(cmd, cwd=git_repo_path);
if ret[1] != "" \ if ret[1] != "" \
and ret != false{ and ret != false{
Log.info("'" + str(ret) + "'"); LOGGER.info("'" + str(ret) + "'");
Log.error("checkout " + base_display + " ==> Can not checkout to the correct tags"); LOGGER.error("checkout " + base_display + " ==> Can not checkout to the correct tags");
return false; return false;
} }
Log.info("checkout " + base_display + " ==> create new branch: " + branch_to_checkout); LOGGER.info("checkout " + base_display + " ==> create new branch: " + branch_to_checkout);
return true; return true;
*/ */
} }
@ -125,11 +125,11 @@ public class StatusActions {
if (elem.isVolatile()) { if (elem.isVolatile()) {
volatileString = " (volatile)"; volatileString = " (volatile)";
} }
Log.verbose("status : " + baseDisplay); LOGGER.trace("status : " + baseDisplay);
//Log.debug("elem : " + str(elem)) //LOGGER.debug("elem : " + str(elem))
Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath());
if (!Files.exists(git_repo_path)) { if (!Files.exists(git_repo_path)) {
Log.print(baseDisplay + volatileString + "\r\t\t\t\t\t\t\t\t\t" + " (not download)"); LOGGER.print(baseDisplay + volatileString + "\r\t\t\t\t\t\t\t\t\t" + " (not download)");
return 0; return 0;
} }
Git git = Git.open(git_repo_path.toFile()); Git git = Git.open(git_repo_path.toFile());
@ -137,16 +137,16 @@ public class StatusActions {
List<String> list_branch = Commands.getListBranchAll(git); List<String> list_branch = Commands.getListBranchAll(git);
String select_branch = git.getRepository().getBranch(); String select_branch = git.getRepository().getBranch();
Log.verbose("List all branch: " + list_branch); LOGGER.trace("List all branch: " + list_branch);
String tracking_remote_branch = null; String tracking_remote_branch = null;
if (!select_branch.startsWith(StatusActions.baseNameOfATaggedBranch)) { if (!select_branch.startsWith(StatusActions.baseNameOfATaggedBranch)) {
// get tracking branch // get tracking branch
tracking_remote_branch = Commands.getTrackingBranch(git, argumentRemoteName, select_branch); tracking_remote_branch = Commands.getTrackingBranch(git, argumentRemoteName, select_branch);
if (tracking_remote_branch == null) { if (tracking_remote_branch == null) {
if (select_branch == null) { if (select_branch == null) {
Log.print(baseDisplay + volatileString + "\r\t\t\t\t\t\t\t (NO BRANCH)"); LOGGER.print(baseDisplay + volatileString + "\r\t\t\t\t\t\t\t (NO BRANCH)");
} else { } else {
Log.print(baseDisplay + volatileString + "\r\t\t\t\t\t\t\t " + select_branch); LOGGER.print(baseDisplay + volatileString + "\r\t\t\t\t\t\t\t " + select_branch);
} }
return 0; return 0;
} }
@ -157,7 +157,7 @@ public class StatusActions {
if (is_modify == true) { if (is_modify == true) {
modify_status = " *** "; modify_status = " *** ";
} }
Log.verbose("select branch = '" + select_branch + "' is modify : " + is_modify + " track: '" + tracking_remote_branch + "'"); LOGGER.trace("select branch = '" + select_branch + "' is modify : " + is_modify + " track: '" + tracking_remote_branch + "'");
DeltaBranch deltas = Commands.getDeltaBranch(git, select_branch, tracking_remote_branch); DeltaBranch deltas = Commands.getDeltaBranch(git, select_branch, tracking_remote_branch);
String behind_forward_comment = ""; String behind_forward_comment = "";
if (deltas.forward() != 0) { if (deltas.forward() != 0) {
@ -177,7 +177,7 @@ public class StatusActions {
// check the current tags of the repository // check the current tags of the repository
if (argumentDisplayTag) { if (argumentDisplayTag) {
List<String> ret_current_tags = Commands.getTagsCurrent(git); List<String> ret_current_tags = Commands.getTagsCurrent(git);
Log.verbose("tags found: " + ret_current_tags); LOGGER.trace("tags found: " + ret_current_tags);
for (String elem_tag : ret_current_tags) { for (String elem_tag : ret_current_tags) {
if (!tags_comment.isEmpty()) { if (!tags_comment.isEmpty()) {
tags_comment += ","; tags_comment += ",";
@ -190,59 +190,59 @@ public class StatusActions {
tags_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t- - - - -"; tags_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t- - - - -";
} }
} }
Log.print(baseDisplay + volatileString + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + tracking_remote_branch + ")" + behind_forward_comment + tags_comment); LOGGER.print(baseDisplay + volatileString + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + tracking_remote_branch + ")" + behind_forward_comment + tags_comment);
Commands.getDiff(git); Commands.getDiff(git);
return deltas.behind(); return deltas.behind();
} }
public static boolean deliverCheck(final ProjectConfig elem, final String argumentRemoteName, final int idElement, final String baseDisplay, final String sourceBranch, final String destinationBranch) throws GitAPIException, IOException { public static boolean deliverCheck(final ProjectConfig elem, final String argumentRemoteName, final int idElement, final String baseDisplay, final String sourceBranch, final String destinationBranch) throws GitAPIException, IOException {
boolean deliver_availlable = true; boolean deliver_availlable = true;
Log.debug("deliver-ckeck: " + baseDisplay); LOGGER.debug("deliver-ckeck: " + baseDisplay);
Log.debug(" ==> check repo exist"); LOGGER.debug(" ==> check repo exist");
// Check the repo exist // Check the repo exist
Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath());
if (!Files.exists(git_repo_path)) { if (!Files.exists(git_repo_path)) {
Log.warning("deliver-ckeck: " + baseDisplay + " ==> MUST be download"); LOGGER.warn("deliver-ckeck: " + baseDisplay + " ==> MUST be download");
return false; return false;
} }
Log.debug(" ==> check is modify"); LOGGER.debug(" ==> check is modify");
// check if the curent repo is modify // check if the curent repo is modify
Git git = Git.open(git_repo_path.toFile()); Git git = Git.open(git_repo_path.toFile());
boolean is_modify = git.status().call().hasUncommittedChanges(); boolean is_modify = git.status().call().hasUncommittedChanges();
if (is_modify) { if (is_modify) {
Log.warning("deliver-ckeck: " + baseDisplay + " ==> MUST not be modify"); LOGGER.warn("deliver-ckeck: " + baseDisplay + " ==> MUST not be modify");
return false; return false;
} }
Log.debug(" ==> check current branch is '" + sourceBranch + "'"); LOGGER.debug(" ==> check current branch is '" + sourceBranch + "'");
// check if we are on source_branch // check if we are on source_branch
String select_branch = git.getRepository().getBranch(); String select_branch = git.getRepository().getBranch();
if (!select_branch.equals(sourceBranch)) { if (!select_branch.equals(sourceBranch)) {
Log.warning("deliver-ckeck: " + baseDisplay + " ==> MUST be on source branch: '" + sourceBranch + "' and is: '" + select_branch + "'"); LOGGER.warn("deliver-ckeck: " + baseDisplay + " ==> MUST be on source branch: '" + sourceBranch + "' and is: '" + select_branch + "'");
return false; return false;
} }
Log.debug(" ==> check have tracking branch"); LOGGER.debug(" ==> check have tracking branch");
// check if we have a remote traking branch // check if we have a remote traking branch
String tracking_remote_branch = Commands.getTrackingBranch(git, argumentRemoteName, select_branch); String tracking_remote_branch = Commands.getTrackingBranch(git, argumentRemoteName, select_branch);
if (tracking_remote_branch == null) { if (tracking_remote_branch == null) {
Log.warning("deliver-ckeck: " + baseDisplay + " ==> MUST have a remote tracking branch"); LOGGER.warn("deliver-ckeck: " + baseDisplay + " ==> MUST have a remote tracking branch");
deliver_availlable = false; deliver_availlable = false;
} }
// go on destination branch // go on destination branch
Commands.checkout(git, destinationBranch); Commands.checkout(git, destinationBranch);
Log.debug(" ==> check current branch is '" + sourceBranch + "'"); LOGGER.debug(" ==> check current branch is '" + sourceBranch + "'");
// check if we are on "master" // check if we are on "master"
select_branch = git.getRepository().getBranch(); select_branch = git.getRepository().getBranch();
if (select_branch != destinationBranch) { if (select_branch != destinationBranch) {
Log.warning("deliver-ckeck: " + baseDisplay + " ==> Can not checkout branch: '" + destinationBranch + "' and is: '" + select_branch + "'"); LOGGER.warn("deliver-ckeck: " + baseDisplay + " ==> Can not checkout branch: '" + destinationBranch + "' and is: '" + select_branch + "'");
deliver_availlable = false; deliver_availlable = false;
} }
Log.debug(" ==> check have tracking branch"); LOGGER.debug(" ==> check have tracking branch");
// check if we have a remote traking branch // check if we have a remote traking branch
tracking_remote_branch = Commands.getTrackingBranch(git, argumentRemoteName, select_branch); tracking_remote_branch = Commands.getTrackingBranch(git, argumentRemoteName, select_branch);
if (tracking_remote_branch == null) { if (tracking_remote_branch == null) {
Log.warning("deliver-ckeck: " + baseDisplay + " ==> MUST have a remote tracking branch"); LOGGER.warn("deliver-ckeck: " + baseDisplay + " ==> MUST have a remote tracking branch");
deliver_availlable = false; deliver_availlable = false;
} }

View File

@ -23,10 +23,10 @@ public class VolatileAdd {
public void execute(final String remoteUrl, final String localPath) throws ActionException, Exception { public void execute(final String remoteUrl, final String localPath) throws ActionException, Exception {
if (remoteUrl.isEmpty()) { if (remoteUrl.isEmpty()) {
Log.error("volatile-add: Missing git repository address ..."); LOGGER.error("volatile-add: Missing git repository address ...");
return; return;
} }
Log.info("Add 'volatile' repository: '" + remoteUrl + "' path='" + localPath + "'"); LOGGER.info("Add 'volatile' repository: '" + remoteUrl + "' path='" + localPath + "'");
// check system is OK // check system is OK
Manifest.checkIsInit(); Manifest.checkIsInit();
@ -34,12 +34,12 @@ public class VolatileAdd {
// Update the current configuration: // Update the current configuration:
ConfigManifest configuration = Config.getUniqueConfig(); ConfigManifest configuration = Config.getUniqueConfig();
if (configuration.existVolatile(localPath)) { if (configuration.existVolatile(localPath)) {
Log.error("Volatile Already exist !!!"); LOGGER.error("Volatile Already exist !!!");
return; return;
} }
// TODO: Check if the local path does not exist in the manifest // TODO: Check if the local path does not exist in the manifest
configuration.addVolatile(remoteUrl, localPath); configuration.addVolatile(remoteUrl, localPath);
configuration.store(); configuration.store();
Log.print("Volatile added: " + localPath); LOGGER.print("Volatile added: " + localPath);
} }
} }

View File

@ -20,7 +20,7 @@ public class VolatileList {
@ArgExecute @ArgExecute
public void execute() throws ActionException, Exception { public void execute() throws ActionException, Exception {
Log.info("List all 'volatile'"); LOGGER.info("List all 'volatile'");
// check system is OK // check system is OK
Manifest.checkIsInit(); Manifest.checkIsInit();
@ -29,12 +29,12 @@ public class VolatileList {
ConfigManifest configuration = Config.getUniqueConfig(); ConfigManifest configuration = Config.getUniqueConfig();
List<Volatile> volatiles = configuration.getVolatiles(); List<Volatile> volatiles = configuration.getVolatiles();
Log.print("List of volatiles:"); LOGGER.print("List of volatiles:");
if (volatiles.size() == 0) { if (volatiles.size() == 0) {
Log.print("\t==> No repository"); LOGGER.print("\t==> No repository");
} else { } else {
for (Volatile elem : volatiles) { for (Volatile elem : volatiles) {
Log.print("\t" + elem.getPath() + "\r\t\t\t\t" + elem.getAddress()); LOGGER.print("\t" + elem.getPath() + "\r\t\t\t\t" + elem.getAddress());
} }
} }
} }

View File

@ -21,7 +21,7 @@ public class VolatileRemove {
@ArgParams("path") @ArgParams("path")
@ArgParamsDescription("Path to install the new git repository") @ArgParamsDescription("Path to install the new git repository")
public void execute(final String localPath) throws ActionException, Exception { public void execute(final String localPath) throws ActionException, Exception {
Log.info("Remove 'volatile' repository: path='" + localPath + "'"); LOGGER.info("Remove 'volatile' repository: path='" + localPath + "'");
// check system is OK // check system is OK
Manifest.checkIsInit(); Manifest.checkIsInit();
@ -29,12 +29,12 @@ public class VolatileRemove {
// Update the current configuration: // Update the current configuration:
ConfigManifest configuration = Config.getUniqueConfig(); ConfigManifest configuration = Config.getUniqueConfig();
if (!configuration.existVolatile(localPath)) { if (!configuration.existVolatile(localPath)) {
Log.error("Volatile Does not exist !!!"); LOGGER.error("Volatile Does not exist !!!");
return; return;
} }
// TODO: Check if the local path does not exist in the manifest // TODO: Check if the local path does not exist in the manifest
configuration.rmVolatile(localPath); configuration.rmVolatile(localPath);
configuration.store(); configuration.store();
Log.print("Volatile Removed: " + localPath); LOGGER.print("Volatile Removed: " + localPath);
} }
} }

View File

@ -6,68 +6,68 @@ import org.atriasoft.reggol.Logger;
public class Log { public class Log {
private static final boolean FORCE = false; private static final boolean FORCE = false;
private static final String LIB_NAME = "island"; private static final String LIB_NAME = "island";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME); private static final String LIB_NAME_DRAW = Logger.getDrawableName(LOGGER.LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL); private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.CRITICAL);
private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR); private static final boolean PRINT_ERROR = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.ERROR);
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING); private static final boolean PRINT_WARNING = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.WARNING);
private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO); private static final boolean PRINT_INFO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.INFO);
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG); private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.DEBUG);
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE); private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.VERBOSE);
private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO); private static final boolean PRINT_TODO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT); private static final boolean PRINT_PRINT = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.PRINT);
public static void critical(final String data, final Exception e) { public static void critical(final String data, final Exception e) {
e.printStackTrace(); e.printStackTrace();
if (Log.PRINT_CRITICAL || Log.FORCE) { if (LOGGER.PRINT_CRITICAL || Log.FORCE) {
Logger.critical(Log.LIB_NAME_DRAW, data + " : " + e.getMessage()); Logger.critical(LOGGER.LIB_NAME_DRAW, data + " : " + e.getMessage());
} }
} }
public static void critical(final String data, Object... objects) { public static void critical(final String data, Object... objects) {
if (Log.PRINT_CRITICAL || Log.FORCE) { if (LOGGER.PRINT_CRITICAL || Log.FORCE) {
Logger.critical(Log.LIB_NAME_DRAW, data, objects); Logger.critical(LOGGER.LIB_NAME_DRAW, data, objects);
} }
} }
public static void debug(final String data, Object... objects) { public static void debug(final String data, Object... objects) {
if (Log.PRINT_DEBUG || Log.FORCE) { if (LOGGER.PRINT_DEBUG || Log.FORCE) {
Logger.debug(Log.LIB_NAME_DRAW, data, objects); Logger.debug(LOGGER.LIB_NAME_DRAW, data, objects);
} }
} }
public static void error(final String data, Object... objects) { public static void error(final String data, Object... objects) {
if (Log.PRINT_ERROR || Log.FORCE) { if (LOGGER.PRINT_ERROR || Log.FORCE) {
Logger.error(Log.LIB_NAME_DRAW, data, objects); Logger.error(LOGGER.LIB_NAME_DRAW, data, objects);
} }
} }
public static void info(final String data, Object... objects) { public static void info(final String data, Object... objects) {
if (Log.PRINT_INFO || Log.FORCE) { if (LOGGER.PRINT_INFO || Log.FORCE) {
Logger.info(Log.LIB_NAME_DRAW, data, objects); Logger.info(LOGGER.LIB_NAME_DRAW, data, objects);
} }
} }
public static void print(final String data, Object... objects) { public static void print(final String data, Object... objects) {
if (Log.PRINT_PRINT || Log.FORCE) { if (LOGGER.PRINT_PRINT || Log.FORCE) {
Logger.print(Log.LIB_NAME_DRAW, data, objects); Logger.print(LOGGER.LIB_NAME_DRAW, data, objects);
} }
} }
public static void todo(final String data, Object... objects) { public static void todo(final String data, Object... objects) {
if (Log.PRINT_TODO || Log.FORCE) { if (LOGGER.PRINT_TODO || Log.FORCE) {
Logger.todo(Log.LIB_NAME_DRAW, data, objects); Logger.todo(LOGGER.LIB_NAME_DRAW, data, objects);
} }
} }
public static void verbose(final String data, Object... objects) { public static void verbose(final String data, Object... objects) {
if (Log.PRINT_VERBOSE || Log.FORCE) { if (LOGGER.PRINT_VERBOSE || Log.FORCE) {
Logger.verbose(Log.LIB_NAME_DRAW, data, objects); Logger.verbose(LOGGER.LIB_NAME_DRAW, data, objects);
} }
} }
public static void warning(final String data, Object... objects) { public static void warning(final String data, Object... objects) {
if (Log.PRINT_WARNING || Log.FORCE) { if (LOGGER.PRINT_WARNING || Log.FORCE) {
Logger.warning(Log.LIB_NAME_DRAW, data, objects); Logger.warning(LOGGER.LIB_NAME_DRAW, data, objects);
} }
} }

View File

@ -29,10 +29,10 @@ public class ConfigManifest {
try { try {
root = mapper.parse(path, ConfigManifest.class); root = mapper.parse(path, ConfigManifest.class);
} catch (final ExmlException e) { } catch (final ExmlException e) {
Log.error("Can not parse the file.1. " + path); LOGGER.error("Can not parse the file.1. " + path);
e.printStackTrace(); e.printStackTrace();
} catch (final AknotException e) { } catch (final AknotException e) {
Log.error("Can not parse the file.2. " + path); LOGGER.error("Can not parse the file.2. " + path);
e.printStackTrace(); e.printStackTrace();
} }
return root; return root;
@ -82,7 +82,7 @@ public class ConfigManifest {
if (index == -1) { if (index == -1) {
index = addressManifest.lastIndexOf(':'); index = addressManifest.lastIndexOf(':');
if (index == -1) { if (index == -1) {
Log.critical("Can not retrieve the path of the repository : " + this.repo + " AND " + fetch); LOGGER.critical("Can not retrieve the path of the repository : " + this.repo + " AND " + fetch);
} }
index += 1; index += 1;
} }
@ -174,7 +174,7 @@ public class ConfigManifest {
try { try {
store(Env.getIslandPathConfig()); store(Env.getIslandPathConfig());
} catch (final ExmlBuilderException e) { } catch (final ExmlBuilderException e) {
Log.error("Can not store the configuration ... "); LOGGER.error("Can not store the configuration ... ");
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -184,7 +184,7 @@ public class ConfigManifest {
try { try {
mapper.store(this, path); mapper.store(this, path);
} catch (final ExmlException | IOException | AknotException ex) { } catch (final ExmlException | IOException | AknotException ex) {
Log.warning("detect throw: " + ex.getMessage()); LOGGER.warn("detect throw: " + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
} }
} }

View File

@ -44,7 +44,7 @@ public void have_unknow_argument():
public void execute(_arguments): public void execute(_arguments):
cmd = "" cmd = ""
for elem in _arguments: for elem in _arguments:
Log.info("Get data element: " + str(elem.getArg())) LOGGER.info("Get data element: " + str(elem.getArg()))
cmd += elem.getArg() + " " cmd += elem.getArg() + " "
// check system is OK // check system is OK
@ -54,30 +54,30 @@ public void execute(_arguments):
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name()) file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false: if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'") LOGGER.error("Missing manifest file : '" + str(file_source_manifest) + "'")
mani = manifest.Manifest(file_source_manifest) mani = manifest.Manifest(file_source_manifest)
all_project = mani.get_all_configs() all_project = mani.get_all_configs()
Log.info("status of: " + str(len(all_project)) + " projects") LOGGER.info("status of: " + str(len(all_project)) + " projects")
id_element = 0 id_element = 0
for elem in all_project: for elem in all_project:
Log.info("------------------------------------------") LOGGER.info("------------------------------------------")
id_element += 1 id_element += 1
base_display = tools.get_list_base_display(id_element, len(all_project), elem) base_display = tools.get_list_base_display(id_element, len(all_project), elem)
Log.info("execute command : " + base_display) LOGGER.info("execute command : " + base_display)
tools.wait_for_server_if_needed() tools.wait_for_server_if_needed()
//Log.debug("elem : " + str(elem)) //LOGGER.debug("elem : " + str(elem))
git_repo_path = new Path(Env.get_island_root_path(), elem.path) git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false: if os.path.exists(git_repo_path) == false:
Log.info("" + base_display + "\r\t\t\t\t\t\t\t\t\t" + " (not download)") LOGGER.info("" + base_display + "\r\t\t\t\t\t\t\t\t\t" + " (not download)")
continue continue
Log.verbose("execute : " + cmd) LOGGER.trace("execute : " + cmd)
ret = multiprocess.run_command(cmd, cwd=git_repo_path) ret = multiprocess.run_command(cmd, cwd=git_repo_path)
if ret[0] == 0: if ret[0] == 0:
Log.info("ret=" + ret[1]) LOGGER.info("ret=" + ret[1])
Log.info("err=" + ret[2]) LOGGER.info("err=" + ret[2])
else: else:
Log.info("Execution ERROR") LOGGER.info("Execution ERROR")

View File

@ -46,10 +46,10 @@ public void execute(_arguments):
argument_remote_name = "" argument_remote_name = ""
for elem in _arguments: for elem in _arguments:
if elem.getOptionName().equals("remote": if elem.getOptionName().equals("remote":
Log.info("find remote name: '" + elem.getArg() + "'") LOGGER.info("find remote name: '" + elem.getArg() + "'")
argument_remote_name = elem.getArg() argument_remote_name = elem.getArg()
else: else:
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'") LOGGER.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
// check system is OK // check system is OK
Manifest.checkIsInit(); Manifest.checkIsInit();
@ -58,14 +58,14 @@ public void execute(_arguments):
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name()) file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false: if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'") LOGGER.error("Missing manifest file : '" + str(file_source_manifest) + "'")
mani = manifest.Manifest(file_source_manifest) mani = manifest.Manifest(file_source_manifest)
destination_branch = mani.deliver_master destination_branch = mani.deliver_master
source_branch = mani.deliver_develop source_branch = mani.deliver_develop
all_project = mani.get_all_configs() all_project = mani.get_all_configs()
Log.info("fetch : " + str(len(all_project)) + " projects") LOGGER.info("fetch : " + str(len(all_project)) + " projects")
id_element = 0 id_element = 0
for elem in all_project: for elem in all_project:
id_element += 1 id_element += 1
@ -73,7 +73,7 @@ public void execute(_arguments):
if argument_remote_name.equals("": if argument_remote_name.equals("":
argument_remote_name = elem.select_remote["name"] argument_remote_name = elem.select_remote["name"]
base_display = tools.get_list_base_display(id_element, len(all_project), elem) base_display = tools.get_list_base_display(id_element, len(all_project), elem)
Log.info("deliver-push: " + base_display) LOGGER.info("deliver-push: " + base_display)
tools.wait_for_server_if_needed() tools.wait_for_server_if_needed()
status.deliver_push(elem, argument_remote_name, destination_branch, source_branch, base_display) status.deliver_push(elem, argument_remote_name, destination_branch, source_branch, base_display)

View File

@ -45,7 +45,7 @@ public void add_specific_arguments(my_args, section):
//# //#
public void execute(_arguments): public void execute(_arguments):
for elem in _arguments: for elem in _arguments:
Log.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'") LOGGER.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
// check system is OK // check system is OK
Manifest.checkIsInit(); Manifest.checkIsInit();
@ -54,7 +54,7 @@ public void execute(_arguments):
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name()) file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false: if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'") LOGGER.error("Missing manifest file : '" + str(file_source_manifest) + "'")
elem = configuration.get_manifest_config() elem = configuration.get_manifest_config()

View File

@ -49,7 +49,7 @@ public void add_specific_arguments(my_args, section):
public void execute(_arguments): public void execute(_arguments):
argument_remote_name = "" argument_remote_name = ""
for elem in _arguments: for elem in _arguments:
Log.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'") LOGGER.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
// check system is OK // check system is OK
Manifest.checkIsInit(); Manifest.checkIsInit();
@ -58,7 +58,7 @@ public void execute(_arguments):
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name()) file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false: if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'") LOGGER.error("Missing manifest file : '" + str(file_source_manifest) + "'")
elem = configuration.get_manifest_config() elem = configuration.get_manifest_config()
@ -69,31 +69,31 @@ public void execute(_arguments):
// Check the manifest is up to date ... // Check the manifest is up to date ...
base_display = tools.get_list_base_display(0, 0, elem) base_display = tools.get_list_base_display(0, 0, elem)
Log.verbose("deliver-ckeck: " + base_display) LOGGER.trace("deliver-ckeck: " + base_display)
if status.deliver_check(elem, argument_remote_name, 0, base_display, source_branch, destination_branch) == false: if status.deliver_check(elem, argument_remote_name, 0, base_display, source_branch, destination_branch) == false:
Log.error("Can not deliver a MANIFEST that is not ready to merge", crash=false) LOGGER.error("Can not deliver a MANIFEST that is not ready to merge", crash=false)
return Env.ret_action_fail return Env.ret_action_fail
all_tags = check_all_tags(mani) all_tags = check_all_tags(mani)
if all_tags == None: if all_tags == None:
Log.error("Need the Tags are set in sub-repository", crash=false) LOGGER.error("Need the Tags are set in sub-repository", crash=false)
return Env.ret_action_fail return Env.ret_action_fail
// deliver the manifest (if Needed ...) // deliver the manifest (if Needed ...)
base_display = tools.get_list_base_display(0, 0, elem) base_display = tools.get_list_base_display(0, 0, elem)
Log.info("manifest-deliver: ========================================================================") LOGGER.info("manifest-deliver: ========================================================================")
Log.info("manifest-deliver:.equals(" + base_display) LOGGER.info("manifest-deliver:.equals(" + base_display)
Log.info("manifest-deliver: ========================================================================") LOGGER.info("manifest-deliver: ========================================================================")
git_repo_path = new Path(Env.get_island_root_path(), elem.path) git_repo_path = new Path(Env.get_island_root_path(), elem.path)
// Check the validity of the version, // Check the validity of the version,
version_description, add_in_version_management = status.get_current_version_repo(git_repo_path) version_description, add_in_version_management = status.get_current_version_repo(git_repo_path)
if version_description == None: if version_description == None:
return Env.ret_action_fail return Env.ret_action_fail
Log.info("manifest-deliver: ==> version: " + str(version_description)) LOGGER.info("manifest-deliver: ==> version: " + str(version_description))
// go to the dev branch // go to the dev branch
select_branch = commands.get_current_branch(git_repo_path) select_branch = commands.get_current_branch(git_repo_path)
@ -101,7 +101,7 @@ public void execute(_arguments):
// create new repo tag // create new repo tag
new_version_description = status.create_new_version_repo(git_repo_path, version_description, add_in_version_management, source_branch, destination_branch) new_version_description = status.create_new_version_repo(git_repo_path, version_description, add_in_version_management, source_branch, destination_branch)
Log.info("new version: " + str(new_version_description)) LOGGER.info("new version: " + str(new_version_description))
if new_version_description == None: if new_version_description == None:
return return
// merge branch // merge branch
@ -130,13 +130,13 @@ public void execute(_arguments):
commands.checkout(git_repo_path, destination_branch) commands.checkout(git_repo_path, destination_branch)
Log.info("manifest-deliver: ==> DONE") LOGGER.info("manifest-deliver: ==> DONE")
public void check_all_tags(mani): public void check_all_tags(mani):
all_project = mani.get_all_configs() all_project = mani.get_all_configs()
Log.info("Check all: " + str(len(all_project)) + " projects have a current tag ...") LOGGER.info("Check all: " + str(len(all_project)) + " projects have a current tag ...")
id_element = 0 id_element = 0
check_have_error = false check_have_error = false
list_tags = [] list_tags = []
@ -144,16 +144,16 @@ public void check_all_tags(mani):
id_element += 1 id_element += 1
base_display = tools.get_list_base_display(id_element, len(all_project), elem) base_display = tools.get_list_base_display(id_element, len(all_project), elem)
if elem.volatile == true: if elem.volatile == true:
Log.info(base_display + "\r\t\t\t\t\t\t\t\t\t" + " (Not Managed)") LOGGER.info(base_display + "\r\t\t\t\t\t\t\t\t\t" + " (Not Managed)")
continue continue
tags_comment = "" tags_comment = ""
git_repo_path = new Path(Env.get_island_root_path(), elem.path) git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false: if os.path.exists(git_repo_path) == false:
Log.error(base_display + volatile + "\r\t\t\t\t\t\t\t\t\t" + " (not download)", crash=false) LOGGER.error(base_display + volatile + "\r\t\t\t\t\t\t\t\t\t" + " (not download)", crash=false)
check_have_error = true check_have_error = true
continue continue
ret_current_tags = commands.get_tags_current(git_repo_path) ret_current_tags = commands.get_tags_current(git_repo_path)
Log.verbose("tags found: " + str(ret_current_tags)) LOGGER.trace("tags found: " + str(ret_current_tags))
if len(ret_current_tags) == 0: if len(ret_current_tags) == 0:
list_tags.append({ list_tags.append({
"name":elem.name, "name":elem.name,
@ -169,11 +169,11 @@ public void check_all_tags(mani):
tags_comment += "," tags_comment += ","
tags_comment += elem_tag tags_comment += elem_tag
if len(ret_current_tags) == 0: if len(ret_current_tags) == 0:
Log.error(base_display + "\r\t\t\t\t\t\t\t\t\t" + " (NO TAG DETECTED)", crash=false) LOGGER.error(base_display + "\r\t\t\t\t\t\t\t\t\t" + " (NO TAG DETECTED)", crash=false)
check_have_error = true check_have_error = true
continue continue
else: else:
Log.info(base_display + "\r\t\t\t\t\t\t\t\t\t" + " " + tags_comment) LOGGER.info(base_display + "\r\t\t\t\t\t\t\t\t\t" + " " + tags_comment)
if check_have_error == true: if check_have_error == true:
return None return None
return list_tags return list_tags

View File

@ -44,14 +44,14 @@ public void add_specific_arguments(my_args, section):
//# //#
public void execute(_arguments): public void execute(_arguments):
for elem in _arguments: for elem in _arguments:
Log.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'") LOGGER.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
// check system is OK // check system is OK
Manifest.checkIsInit(); Manifest.checkIsInit();
ConfigManifest configuration = Config.getUniqueConfig(); ConfigManifest configuration = Config.getUniqueConfig();
Log.info("update manifest : '" + str(Env.get_island_path_manifest()) + "'") LOGGER.info("update manifest : '" + str(Env.get_island_path_manifest()) + "'")
is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest()) is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest())
if is_modify_manifest == true: if is_modify_manifest == true:
commands.fetch(Env.get_island_path_manifest(), "origin") commands.fetch(Env.get_island_path_manifest(), "origin")

View File

@ -50,104 +50,104 @@ public void execute(_arguments):
for elem in _arguments: for elem in _arguments:
if elem.getOptionName().equals("rebase": if elem.getOptionName().equals("rebase":
reset_instead_of_rebase = true reset_instead_of_rebase = true
Log.info("==> Request reset instead of rebase") LOGGER.info("==> Request reset instead of rebase")
else: else:
Log.error("SYNC Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'", ret_value=Env.ret_action_wrong_parameters) LOGGER.error("SYNC Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'", ret_value=Env.ret_action_wrong_parameters)
// check system is OK // check system is OK
Manifest.checkIsInit(); Manifest.checkIsInit();
ConfigManifest configuration = Config.getUniqueConfig(); ConfigManifest configuration = Config.getUniqueConfig();
Log.info("update manifest : '" + str(Env.get_island_path_manifest()) + "'") LOGGER.info("update manifest : '" + str(Env.get_island_path_manifest()) + "'")
is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest()) is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest())
if is_modify_manifest == true: if is_modify_manifest == true:
Log.warning("Manifest is modify") LOGGER.warn("Manifest is modify")
else: else:
ret_track = commands.get_current_tracking_branch(Env.get_island_path_manifest()) ret_track = commands.get_current_tracking_branch(Env.get_island_path_manifest())
is_forward = commands.is_forward(Env.get_island_path_manifest(), ret_track) is_forward = commands.is_forward(Env.get_island_path_manifest(), ret_track)
if is_forward == true: if is_forward == true:
// fetch the repository // fetch the repository
Log.warning("sync-local: Not update ==> the MANIFEST is forward the remote branch " + str(commands.get_forward(Env.get_island_path_manifest(), ret_track))) LOGGER.warn("sync-local: Not update ==> the MANIFEST is forward the remote branch " + str(commands.get_forward(Env.get_island_path_manifest(), ret_track)))
else: else:
Log.verbose("Check behind:") LOGGER.trace("Check behind:")
is_behind = commands.is_behind(Env.get_island_path_manifest(), ret_track) is_behind = commands.is_behind(Env.get_island_path_manifest(), ret_track)
if is_behind == false: if is_behind == false:
// fetch the repository // fetch the repository
Log.info("sync-local: MANIFEST is up-to-date") LOGGER.info("sync-local: MANIFEST is up-to-date")
else: else:
if reset_instead_of_rebase == true: if reset_instead_of_rebase == true:
Log.info("sync-local: MANIFEST Reset to " + ret_track) LOGGER.info("sync-local: MANIFEST Reset to " + ret_track)
commands.reset_hard(Env.get_island_path_manifest(), ret_track) commands.reset_hard(Env.get_island_path_manifest(), ret_track)
else: else:
Log.info("sync-local: MANIFEST Rebase to " + ret_track) LOGGER.info("sync-local: MANIFEST Rebase to " + ret_track)
commands.rebase(Env.get_island_path_manifest(), ret_track) commands.rebase(Env.get_island_path_manifest(), ret_track)
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name()) file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false: if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'", ret_value=Env.ret_manifest_is_not_existing) LOGGER.error("Missing manifest file : '" + str(file_source_manifest) + "'", ret_value=Env.ret_manifest_is_not_existing)
mani = manifest.Manifest(file_source_manifest) mani = manifest.Manifest(file_source_manifest)
all_project = mani.get_all_configs() all_project = mani.get_all_configs()
Log.info("synchronize : " + str(len(all_project)) + " projects") LOGGER.info("synchronize : " + str(len(all_project)) + " projects")
id_element = 0 id_element = 0
count_error = 0 count_error = 0
for elem in all_project: for elem in all_project:
id_element += 1 id_element += 1
base_display = tools.get_list_base_display(id_element, len(all_project), elem) base_display = tools.get_list_base_display(id_element, len(all_project), elem)
Log.info("----------------------------------------------------------------") LOGGER.info("----------------------------------------------------------------")
Log.info("sync-local: " + base_display) LOGGER.info("sync-local: " + base_display)
//Log.debug("elem : " + str(elem)) //LOGGER.debug("elem : " + str(elem))
git_repo_path = new Path(Env.get_island_root_path(), elem.path) git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false: if os.path.exists(git_repo_path) == false:
// The Repository does not exist ==> Nothing to do... // The Repository does not exist ==> Nothing to do...
Log.warning("sync-local: ==> Not download") LOGGER.warn("sync-local: ==> Not download")
count_error += 1 count_error += 1
continue continue
if os.path.exists(new Path(git_repo_path,".git")) == false: if os.path.exists(new Path(git_repo_path,".git")) == false:
// path already exist but it is not used to as a git repo ==> this is an error // path already exist but it is not used to as a git repo ==> this is an error
Log.warning("sync-local: is already existing but not used for a git repository. Remove it and sync") LOGGER.warn("sync-local: is already existing but not used for a git repository. Remove it and sync")
count_error += 1 count_error += 1
continue continue
// simply update the repository ... // simply update the repository ...
Log.verbose("Check modify:") LOGGER.trace("Check modify:")
is_modify = commands.check_repository_is_modify(git_repo_path) is_modify = commands.check_repository_is_modify(git_repo_path)
if is_modify == true: if is_modify == true:
// fetch the repository // fetch the repository
Log.warning("sync-local: Not update ==> the repository is modified (pass through)") LOGGER.warn("sync-local: Not update ==> the repository is modified (pass through)")
count_error += 1 count_error += 1
continue continue
Log.verbose("Check tracking and local branch:") LOGGER.trace("Check tracking and local branch:")
// get tracking branch // get tracking branch
ret_track = commands.get_current_tracking_branch(git_repo_path) ret_track = commands.get_current_tracking_branch(git_repo_path)
select_branch = commands.get_current_branch(git_repo_path) select_branch = commands.get_current_branch(git_repo_path)
Log.debug("sync-local: check: " + select_branch + " ==> " + ret_track) LOGGER.debug("sync-local: check: " + select_branch + " ==> " + ret_track)
Log.verbose("Check forward:") LOGGER.trace("Check forward:")
is_forward = commands.is_forward(git_repo_path, ret_track) is_forward = commands.is_forward(git_repo_path, ret_track)
if is_forward == true: if is_forward == true:
// fetch the repository // fetch the repository
Log.warning("sync-local: Not update ==> the repository is forward the remote branch " + str(commands.get_forward(git_repo_path, ret_track))) LOGGER.warn("sync-local: Not update ==> the repository is forward the remote branch " + str(commands.get_forward(git_repo_path, ret_track)))
count_error += 1 count_error += 1
continue continue
Log.verbose("Check behind:") LOGGER.trace("Check behind:")
is_behind = commands.is_behind(git_repo_path, ret_track) is_behind = commands.is_behind(git_repo_path, ret_track)
if is_behind == false: if is_behind == false:
// fetch the repository // fetch the repository
Log.info("sync-local: Nothing to do.") LOGGER.info("sync-local: Nothing to do.")
continue continue
if reset_instead_of_rebase == true: if reset_instead_of_rebase == true:
Log.info("sync-local: Reset to " + ret_track) LOGGER.info("sync-local: Reset to " + ret_track)
commands.reset_hard(git_repo_path, ret_track) commands.reset_hard(git_repo_path, ret_track)
else: else:
Log.info("sync-local: Reset to " + ret_track) LOGGER.info("sync-local: Reset to " + ret_track)
commands.rebase(git_repo_path, ret_track) commands.rebase(git_repo_path, ret_track)
if count_error != 0: if count_error != 0:
Log.info(" ***********************************************************") LOGGER.info(" ***********************************************************")
Log.info(" ** local sync partial warning on " + str(count_error) + " repository") LOGGER.info(" ** local sync partial warning on " + str(count_error) + " repository")
Log.info(" ***********************************************************") LOGGER.info(" ***********************************************************")
return Env.ret_action_partial_done return Env.ret_action_partial_done
//# Update the links: //# Update the links:

View File

@ -22,32 +22,32 @@ import os
public void deliver_check(elem, argument_remote_name, id_element, base_display, source_branch, destination_branch): public void deliver_check(elem, argument_remote_name, id_element, base_display, source_branch, destination_branch):
deliver_availlable = true deliver_availlable = true
Log.debug("deliver-ckeck: " + base_display) LOGGER.debug("deliver-ckeck: " + base_display)
Log.debug(" ==> check repo exist") LOGGER.debug(" ==> check repo exist")
// Check the repo exist // Check the repo exist
git_repo_path = new Path(Env.get_island_root_path(), elem.path) git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false: if os.path.exists(git_repo_path) == false:
Log.warning("deliver-ckeck: " + base_display + " ==> MUST be download") LOGGER.warn("deliver-ckeck: " + base_display + " ==> MUST be download")
return false return false
Log.debug(" ==> check is modify") LOGGER.debug(" ==> check is modify")
// check if the curent repo is modify // check if the curent repo is modify
is_modify = commands.check_repository_is_modify(git_repo_path) is_modify = commands.check_repository_is_modify(git_repo_path)
if is_modify == true: if is_modify == true:
Log.warning("deliver-ckeck: " + base_display + " ==> MUST not be modify") LOGGER.warn("deliver-ckeck: " + base_display + " ==> MUST not be modify")
return false return false
Log.debug(" ==> check current branch is '" + source_branch + "'") LOGGER.debug(" ==> check current branch is '" + source_branch + "'")
// check if we are on source_branch // check if we are on source_branch
select_branch = commands.get_current_branch(git_repo_path) select_branch = commands.get_current_branch(git_repo_path)
if select_branch != source_branch: if select_branch != source_branch:
Log.warning("deliver-ckeck: " + base_display + " ==> MUST be on source branch: '" + source_branch + "' and is: '" + select_branch + "'") LOGGER.warn("deliver-ckeck: " + base_display + " ==> MUST be on source branch: '" + source_branch + "' and is: '" + select_branch + "'")
return false return false
Log.debug(" ==> check have tracking branch") LOGGER.debug(" ==> check have tracking branch")
// check if we have a remote traking branch // check if we have a remote traking branch
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch) tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch)
if tracking_remote_branch == None: if tracking_remote_branch == None:
Log.warning("deliver-ckeck: " + base_display + " ==> MUST have a remote tracking branch") LOGGER.warn("deliver-ckeck: " + base_display + " ==> MUST have a remote tracking branch")
deliver_availlable = false deliver_availlable = false
@ -55,17 +55,17 @@ public void deliver_check(elem, argument_remote_name, id_element, base_display,
commands.checkout(git_repo_path, destination_branch) commands.checkout(git_repo_path, destination_branch)
// TODO: check return value // TODO: check return value
Log.debug(" ==> check current branch is '" + source_branch + "'") LOGGER.debug(" ==> check current branch is '" + source_branch + "'")
// check if we are on "master" // check if we are on "master"
select_branch = commands.get_current_branch(git_repo_path) select_branch = commands.get_current_branch(git_repo_path)
if select_branch != destination_branch: if select_branch != destination_branch:
Log.warning("deliver-ckeck: " + base_display + " ==> Can not checkout branch: '" + destination_branch + "' and is: '" + select_branch + "'") LOGGER.warn("deliver-ckeck: " + base_display + " ==> Can not checkout branch: '" + destination_branch + "' and is: '" + select_branch + "'")
deliver_availlable = false deliver_availlable = false
Log.debug(" ==> check have tracking branch") LOGGER.debug(" ==> check have tracking branch")
// check if we have a remote traking branch // check if we have a remote traking branch
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch) tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch)
if tracking_remote_branch == None: if tracking_remote_branch == None:
Log.warning("deliver-ckeck: " + base_display + " ==> MUST have a remote tracking branch") LOGGER.warn("deliver-ckeck: " + base_display + " ==> MUST have a remote tracking branch")
deliver_availlable = false deliver_availlable = false
@ -74,7 +74,7 @@ public void deliver_check(elem, argument_remote_name, id_element, base_display,
// check if we have a local branch // check if we have a local branch
list_branch_local = commands.get_list_branch_local(git_repo_path) list_branch_local = commands.get_list_branch_local(git_repo_path)
if destination_branch not in list_branch_local: if destination_branch not in list_branch_local:
Log.warning("deliver-ckeck: " + base_display + " ==> MUST have local branch named '" + destination_branch + "'") LOGGER.warn("deliver-ckeck: " + base_display + " ==> MUST have local branch named '" + destination_branch + "'")
deliver_availlable = false deliver_availlable = false
// TODO: check source_branch is up to date // TODO: check source_branch is up to date
@ -95,26 +95,26 @@ public void get_current_version_repo(git_repo_path):
add_in_version_management = false add_in_version_management = false
version_description = None version_description = None
if os.path.exists(version_path_file) == false: if os.path.exists(version_path_file) == false:
Log.info("deliver: ==> No 'version.txt' file ==> not manage release version....") LOGGER.info("deliver: ==> No 'version.txt' file ==> not manage release version....")
// Action to do: // Action to do:
valid = false valid = false
while valid == false: while valid == false:
Log.info("Create a new version: (0.0.0)") LOGGER.info("Create a new version: (0.0.0)")
Log.info(" (1) Add in managing version") LOGGER.info(" (1) Add in managing version")
Log.info(" (2) Do NOTHING & continue") LOGGER.info(" (2) Do NOTHING & continue")
input1 = input() input1 = input()
if input1 in ["1", "2"]: if input1 in ["1", "2"]:
valid = true valid = true
else: else:
Log.info("!!! Must select in range " + str(["1", "2"])) LOGGER.info("!!! Must select in range " + str(["1", "2"]))
if input1.equals("1": if input1.equals("1":
version_description = [0, 0, 0] version_description = [0, 0, 0]
add_in_version_management = true add_in_version_management = true
} else if input1.equals("2": } else if input1.equals("2":
Log.info("Continue Not managing for this repository") LOGGER.info("Continue Not managing for this repository")
return (None, None) return (None, None)
else: else:
Log.warning("An error occured for this repository") LOGGER.warn("An error occured for this repository")
return (None, None) return (None, None)
else: else:
version_description = tools.version_string_to_list(tools.file_read_data(version_path_file)) version_description = tools.version_string_to_list(tools.file_read_data(version_path_file))
@ -131,10 +131,10 @@ public void create_new_version_repo(git_repo_path, version_description, add_in_v
for elem_sha1 in ret_destination_branch_sha1: for elem_sha1 in ret_destination_branch_sha1:
if elem_sha1 not in ret_source_branch_sha1: if elem_sha1 not in ret_source_branch_sha1:
message = commands.get_specific_commit_message(git_repo_path, elem_sha1) message = commands.get_specific_commit_message(git_repo_path, elem_sha1)
Log.warning("deliver: Forward commit: '" + message + "'") LOGGER.warn("deliver: Forward commit: '" + message + "'")
have_forward = true have_forward = true
if have_forward == true: if have_forward == true:
Log.error("'" + destination_branch + "' branch must not be forward '" + source_branch + "' branch") LOGGER.error("'" + destination_branch + "' branch must not be forward '" + source_branch + "' branch")
return None return None
behind_message = "" behind_message = ""
behind_count = 0 behind_count = 0
@ -144,30 +144,30 @@ public void create_new_version_repo(git_repo_path, version_description, add_in_v
behind_count += 1 behind_count += 1
behind_message = message behind_message = message
if behind_count == 0 and add_in_version_management == false: if behind_count == 0 and add_in_version_management == false:
Log.info("deliver: ==> Nothing to do (1).") LOGGER.info("deliver: ==> Nothing to do (1).")
return None return None
if behind_count == 1 \ if behind_count == 1 \
and ( behind_message == default_behind_message and ( behind_message == default_behind_message
or behind_message == default_update_message): or behind_message == default_update_message):
Log.info("deliver: ==> Nothing to do (2).") LOGGER.info("deliver: ==> Nothing to do (2).")
return None return None
for elem_sha1 in ret_source_branch_sha1: for elem_sha1 in ret_source_branch_sha1:
if elem_sha1 not in ret_destination_branch_sha1: if elem_sha1 not in ret_destination_branch_sha1:
message = commands.get_specific_commit_message(git_repo_path, elem_sha1) message = commands.get_specific_commit_message(git_repo_path, elem_sha1)
Log.info("deliver: Behind commit: '" + message + "'") LOGGER.info("deliver: Behind commit: '" + message + "'")
// Choice of the new version: // Choice of the new version:
valid = false valid = false
while valid == false: while valid == false:
Log.info("update version: curent: " + str(version_description)) LOGGER.info("update version: curent: " + str(version_description))
Log.info(" (1) Major version (change API)") LOGGER.info(" (1) Major version (change API)")
Log.info(" (2) Medium version (add feature)") LOGGER.info(" (2) Medium version (add feature)")
Log.info(" (3) Minor version (Bug fix & doc)") LOGGER.info(" (3) Minor version (Bug fix & doc)")
Log.info(" (4) Do not release & continue") LOGGER.info(" (4) Do not release & continue")
input1 = input() input1 = input()
if input1 in ["1", "2", "3", "4"]: if input1 in ["1", "2", "3", "4"]:
valid = true valid = true
else: else:
Log.info("!!! Must select in range " + str(["1", "2", "3", "4"])) LOGGER.info("!!! Must select in range " + str(["1", "2", "3", "4"]))
// limit and force at 3 the nuber of variables // limit and force at 3 the nuber of variables
version_description_tmp = version_description version_description_tmp = version_description
version_description = [] version_description = []
@ -183,7 +183,7 @@ public void create_new_version_repo(git_repo_path, version_description, add_in_v
version_description.append(version_description_tmp[2]) version_description.append(version_description_tmp[2])
else: else:
version_description.append(0) version_description.append(0)
Log.info("update version: curent: " + str(version_description)) LOGGER.info("update version: curent: " + str(version_description))
// increment the version // increment the version
if input1.equals("1": if input1.equals("1":
version_description[0] += 1 version_description[0] += 1
@ -195,12 +195,12 @@ public void create_new_version_repo(git_repo_path, version_description, add_in_v
} else if input1.equals("3": } else if input1.equals("3":
version_description[2] += 1 version_description[2] += 1
} else if input1.equals("4": } else if input1.equals("4":
Log.info("No release for this repository") LOGGER.info("No release for this repository")
return None return None
else: else:
Log.warning("An error occured for this repository") LOGGER.warn("An error occured for this repository")
return None return None
Log.info("update version: curent: " + str(version_description)) LOGGER.info("update version: curent: " + str(version_description))
return version_description return version_description
@ -208,59 +208,59 @@ public void deliver_push(elem, argument_remote_name, destination_branch, source_
// Check the repo exist // Check the repo exist
git_repo_path = new Path(Env.get_island_root_path(), elem.path) git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false: if os.path.exists(git_repo_path) == false:
Log.warning("deliver-push: " + base_display + " ==> MUST be download") LOGGER.warn("deliver-push: " + base_display + " ==> MUST be download")
return return
// check if we are on destination_branch // check if we are on destination_branch
select_branch = commands.get_current_branch(git_repo_path) select_branch = commands.get_current_branch(git_repo_path)
if select_branch != destination_branch: if select_branch != destination_branch:
Log.warning("deliver-push: " + base_display + " ==> MUST be on '" + destination_branch + "'") LOGGER.warn("deliver-push: " + base_display + " ==> MUST be on '" + destination_branch + "'")
return return
// check if we have a local branch // check if we have a local branch
list_branch_local = commands.get_list_branch_local(git_repo_path) list_branch_local = commands.get_list_branch_local(git_repo_path)
if source_branch not in list_branch_local: if source_branch not in list_branch_local:
Log.warning("deliver-push: " + base_display + " ==> No '" + source_branch + "' (not managed)") LOGGER.warn("deliver-push: " + base_display + " ==> No '" + source_branch + "' (not managed)")
return return
if destination_branch not in list_branch_local: if destination_branch not in list_branch_local:
Log.warning("deliver-push: " + base_display + " ==> No '" + destination_branch + "' (not managed)") LOGGER.warn("deliver-push: " + base_display + " ==> No '" + destination_branch + "' (not managed)")
return return
list_of_element_to_push = [] list_of_element_to_push = []
// check sha1 of destination_branch // check sha1 of destination_branch
sha_1_destination = commands.get_sha1_for_branch(git_repo_path, destination_branch) sha_1_destination = commands.get_sha1_for_branch(git_repo_path, destination_branch)
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, destination_branch) tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, destination_branch)
if tracking_remote_branch == None: if tracking_remote_branch == None:
Log.warning("deliver-push: " + base_display + " ==> '" + destination_branch + "' have no tracking branch") LOGGER.warn("deliver-push: " + base_display + " ==> '" + destination_branch + "' have no tracking branch")
deliver_availlable = false deliver_availlable = false
sha_1_destination_tracking = commands.get_sha1_for_branch(git_repo_path, tracking_remote_branch) sha_1_destination_tracking = commands.get_sha1_for_branch(git_repo_path, tracking_remote_branch)
if sha_1_destination == sha_1_destination_tracking: if sha_1_destination == sha_1_destination_tracking:
Log.info("deliver-push: " + base_display + " ==> '" + destination_branch + "' && '" + tracking_remote_branch + "' have the same sha1") LOGGER.info("deliver-push: " + base_display + " ==> '" + destination_branch + "' && '" + tracking_remote_branch + "' have the same sha1")
else: else:
list_of_element_to_push.append(destination_branch) list_of_element_to_push.append(destination_branch)
// check sha1 of source_branch // check sha1 of source_branch
sha_1_source = commands.get_sha1_for_branch(git_repo_path, source_branch) sha_1_source = commands.get_sha1_for_branch(git_repo_path, source_branch)
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, source_branch) tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, source_branch)
if tracking_remote_branch == None: if tracking_remote_branch == None:
Log.info("deliver-push: " + base_display + " ==> '" + source_branch + "' have no tracking branch") LOGGER.info("deliver-push: " + base_display + " ==> '" + source_branch + "' have no tracking branch")
deliver_availlable = false deliver_availlable = false
sha_1_source_tracking = commands.get_sha1_for_branch(git_repo_path, tracking_remote_branch) sha_1_source_tracking = commands.get_sha1_for_branch(git_repo_path, tracking_remote_branch)
if sha_1_source == sha_1_source_tracking: if sha_1_source == sha_1_source_tracking:
Log.info("deliver-push: " + base_display + " ==> '" + source_branch + "' && '" + tracking_remote_branch + "' have the same sha1") LOGGER.info("deliver-push: " + base_display + " ==> '" + source_branch + "' && '" + tracking_remote_branch + "' have the same sha1")
else: else:
list_of_element_to_push.append(source_branch) list_of_element_to_push.append(source_branch)
ret_current_tags = commands.get_tags_current(git_repo_path) ret_current_tags = commands.get_tags_current(git_repo_path)
if len(ret_current_tags) == 0: if len(ret_current_tags) == 0:
Log.info("deliver-push: " + base_display + " ==> No tag on the current '" + destination_branch + "'") LOGGER.info("deliver-push: " + base_display + " ==> No tag on the current '" + destination_branch + "'")
return return
if len(ret_current_tags) > 1: if len(ret_current_tags) > 1:
Log.info("deliver-push: " + base_display + " ==> Too mush tags on the current '" + destination_branch + "' : " + str(ret_current_tags) + " ==> only support 1") LOGGER.info("deliver-push: " + base_display + " ==> Too mush tags on the current '" + destination_branch + "' : " + str(ret_current_tags) + " ==> only support 1")
return return
list_remote_tags = commands.get_tags_remote(git_repo_path, argument_remote_name) list_remote_tags = commands.get_tags_remote(git_repo_path, argument_remote_name)
Log.verbose("remote tags: " + str(list_remote_tags)) LOGGER.trace("remote tags: " + str(list_remote_tags))
if ret_current_tags[0] not in list_remote_tags: if ret_current_tags[0] not in list_remote_tags:
Log.info("deliver-push: " + base_display + " ==> tag already exist.") LOGGER.info("deliver-push: " + base_display + " ==> tag already exist.")
list_of_element_to_push.append(ret_current_tags[0]) list_of_element_to_push.append(ret_current_tags[0])
if len(list_of_element_to_push) == 0: if len(list_of_element_to_push) == 0:
Log.info("deliver-push: " + base_display + " ==> Everything up-to-date") LOGGER.info("deliver-push: " + base_display + " ==> Everything up-to-date")
return return
Log.info("deliver-push: " + base_display + " ==> element to push:" + str(list_of_element_to_push)) LOGGER.info("deliver-push: " + base_display + " ==> element to push:" + str(list_of_element_to_push))
//push all on the server: //push all on the server:
commands.push(git_repo_path, argument_remote_name, list_of_element_to_push) commands.push(git_repo_path, argument_remote_name, list_of_element_to_push)

View File

@ -18,23 +18,23 @@ public void update(configuration, mani, type_call):
// TODO: do not remove link when not needed // TODO: do not remove link when not needed
if len(configuration.get_links()) != 0 \ if len(configuration.get_links()) != 0 \
or len(mani.get_links()) != 0: or len(mani.get_links()) != 0:
Log.info(type_call + ": remove old links ...") LOGGER.info(type_call + ": remove old links ...")
for elem in configuration.get_links(): for elem in configuration.get_links():
base_path = new Path(Env.get_island_root_path(), elem["destination"]) base_path = new Path(Env.get_island_root_path(), elem["destination"])
Log.info(type_call + ": link: " + str(base_path)) LOGGER.info(type_call + ": link: " + str(base_path))
if os.path.islink(base_path) == true: if os.path.islink(base_path) == true:
os.unlink(base_path) os.unlink(base_path)
else: else:
Log.error(type_call + ": remove link is not authorised ==> not a link", crash=false) LOGGER.error(type_call + ": remove link is not authorised ==> not a link", crash=false)
have_error = true have_error = true
configuration.clear_links() configuration.clear_links()
Log.info(type_call + ": add new links ...") LOGGER.info(type_call + ": add new links ...")
for elem in mani.get_links(): for elem in mani.get_links():
base_path = new Path(Env.get_island_root_path(), elem["destination"]) base_path = new Path(Env.get_island_root_path(), elem["destination"])
source_path = new Path(Env.get_island_root_path(), elem["source"]) source_path = new Path(Env.get_island_root_path(), elem["source"])
Log.info(type_call + ": link: " + str(base_path)) LOGGER.info(type_call + ": link: " + str(base_path))
if os.path.exists(base_path) == true: if os.path.exists(base_path) == true:
Log.error(type_call + ": create link is not possible ==> path already exist", crash=false) LOGGER.error(type_call + ": create link is not possible ==> path already exist", crash=false)
have_error = true have_error = true
else: else:
tools.create_directory_of_file(base_path) tools.create_directory_of_file(base_path)

View File

@ -56,7 +56,7 @@ public void get_list_sub_files(path):
public void remove_path_and_sub_path(path): public void remove_path_and_sub_path(path):
if os.path.isdir(path): if os.path.isdir(path):
Log.verbose("remove path : '" + path + "'") LOGGER.trace("remove path : '" + path + "'")
shutil.rmtree(path) shutil.rmtree(path)
public void remove_file(path): public void remove_file(path):
@ -94,13 +94,13 @@ public void version_to_string(version):
return version_ID return version_ID
public void version_string_to_list(version): public void version_string_to_list(version):
Log.verbose("parse version string '" + version +"'") LOGGER.trace("parse version string '" + version +"'")
out = [] out = []
if version.equals("": if version.equals("":
return [0, 0, 0] return [0, 0, 0]
elems = version.split("-") elems = version.split("-")
if len(elems[0].split(".")) <= 1: if len(elems[0].split(".")) <= 1:
Log.error("Can not parde a version with wrong version model '" + version +"'") LOGGER.error("Can not parde a version with wrong version model '" + version +"'")
for elem in elems[0].split("."): for elem in elems[0].split("."):
out.append(int(elem)) out.append(int(elem))
if len(elems) >= 2: if len(elems) >= 2:
@ -157,7 +157,7 @@ public void store_command(cmd_line, file):
if file.equals("" \ if file.equals("" \
or file == None: or file == None:
return; return;
Log.verbose("create cmd file: " + file) LOGGER.trace("create cmd file: " + file)
// Create directory: // Create directory:
create_directory_of_file(file) create_directory_of_file(file)
// Store the command Line: // Store the command Line:
@ -195,7 +195,7 @@ public void list_append_to(out_list, in_list, order=false):
} else if type(in_list) == dict: } else if type(in_list) == dict:
list_append_and_check(out_list, in_list, order) list_append_and_check(out_list, in_list, order)
else: else:
Log.warning("can not add in list other than {list/dict/str} : " + str(type(in_list))) LOGGER.warn("can not add in list other than {list/dict/str} : " + str(type(in_list)))
public void list_append_to_2(listout, module, in_list, order=false): public void list_append_to_2(listout, module, in_list, order=false):
// sepcial cse of bool // sepcial cse of bool
@ -222,19 +222,19 @@ public void get_version_from_file_or_direct(path_module, filename_or_version):
// this use a version file // this use a version file
file_data = file_read_data(new Path(path_module, filename_or_version)) file_data = file_read_data(new Path(path_module, filename_or_version))
if len(file_data) == 0: if len(file_data) == 0:
Log.warning("not enought data in the file version size=0 " + path_module + " / " + filename_or_version) LOGGER.warn("not enought data in the file version size=0 " + path_module + " / " + filename_or_version)
return [0,0,0] return [0,0,0]
lines = file_data.split("\n") lines = file_data.split("\n")
if len(lines) != 1: if len(lines) != 1:
Log.warning("More thatn one line in the file version ==> bas case use mode: 'XX', XX.YYY', 'XX.Y.ZZZ' or 'XX.Y-dev' : " + path_module + " / " + filename_or_version) LOGGER.warn("More thatn one line in the file version ==> bas case use mode: 'XX', XX.YYY', 'XX.Y.ZZZ' or 'XX.Y-dev' : " + path_module + " / " + filename_or_version)
return [0,0,0] return [0,0,0]
line = lines[0] line = lines[0]
Log.debug("Parse line: '" + line + "'") LOGGER.debug("Parse line: '" + line + "'")
//check if we have "-dev" //check if we have "-dev"
dev_mode = "" dev_mode = ""
list_tiret = line.split('-') list_tiret = line.split('-')
if len(list_tiret) > 2: if len(list_tiret) > 2:
Log.warning("more than one '-' in version file " + str(filename_or_version) + " : '" + str(list_tiret) + "' in '" + path_module + "'") LOGGER.warn("more than one '-' in version file " + str(filename_or_version) + " : '" + str(list_tiret) + "' in '" + path_module + "'")
if len(list_tiret) >= 2: if len(list_tiret) >= 2:
dev_mode = list_tiret[1] dev_mode = list_tiret[1]
line = list_tiret[0] line = list_tiret[0]
@ -244,7 +244,7 @@ public void get_version_from_file_or_direct(path_module, filename_or_version):
out.append(int(elem)) out.append(int(elem))
if dev_mode != "": if dev_mode != "":
out.append(dev_mode) out.append(dev_mode)
Log.debug(" ==> " + str(out)) LOGGER.debug(" ==> " + str(out))
return out return out
//# //#
@ -260,7 +260,7 @@ public void get_maintainer_from_file_or_direct(path_module, filename_or_author):
// this use a version file // this use a version file
file_data = file_read_data(new Path(path_module, filename_or_author)) file_data = file_read_data(new Path(path_module, filename_or_author))
if len(file_data) == 0: if len(file_data) == 0:
Log.warning("not enought data in the file author size=0 " + path_module + " / " + filename_or_author) LOGGER.warn("not enought data in the file author size=0 " + path_module + " / " + filename_or_author)
return [] return []
// One user by line and # for comment line // One user by line and # for comment line
out = [] out = []
@ -305,7 +305,7 @@ public void wait_for_server_if_needed():
is_first_time_sleep = true; is_first_time_sleep = true;
return return
if Env.get_wait_between_sever_command() != 0: if Env.get_wait_between_sever_command() != 0:
Log.info("Wait for server contrition (" + str(Env.get_wait_between_sever_command()) + " s)") LOGGER.info("Wait for server contrition (" + str(Env.get_wait_between_sever_command()) + " s)")
time.sleep(Env.get_wait_between_sever_command()) time.sleep(Env.get_wait_between_sever_command())
@ -333,29 +333,29 @@ public void exclude_list(list_elements, filter):
public void import_path_local(path, limit_sub_folder = 1, exclude_path = [], base_name = "*"): public void import_path_local(path, limit_sub_folder = 1, exclude_path = [], base_name = "*"):
out = [] out = []
Log.debug("island files: " + str(path) + " [START] " + str(limit_sub_folder)) LOGGER.debug("island files: " + str(path) + " [START] " + str(limit_sub_folder))
if limit_sub_folder == 0: if limit_sub_folder == 0:
Log.verbose("Subparsing limitation append ...") LOGGER.trace("Subparsing limitation append ...")
return [] return []
list_files = get_list_sub_files(path) list_files = get_list_sub_files(path)
// filter elements: // filter elements:
Log.debug("island files: " + str(path) + " : " + str(list_files)) LOGGER.debug("island files: " + str(path) + " : " + str(list_files))
tmp_list_island_file = filter_name_and_file(path, list_files, base_name) tmp_list_island_file = filter_name_and_file(path, list_files, base_name)
Log.debug("island files (filtered): " + str(path) + " : " + str(tmp_list_island_file)) LOGGER.debug("island files (filtered): " + str(path) + " : " + str(tmp_list_island_file))
// Import the module: // Import the module:
for filename in tmp_list_island_file: for filename in tmp_list_island_file:
out.append(new Path(path, filename)) out.append(new Path(path, filename))
Log.debug(" Find a file : '" + str(out[-1]) + "'") LOGGER.debug(" Find a file : '" + str(out[-1]) + "'")
list_folders_full = get_list_sub_path(path) list_folders_full = get_list_sub_path(path)
list_folders = [] list_folders = []
for elem in list_folders_full: for elem in list_folders_full:
if elem in exclude_path: if elem in exclude_path:
Log.verbose("find '" + str(elem) + "' in exclude_path=" + str(exclude_path)) LOGGER.trace("find '" + str(elem) + "' in exclude_path=" + str(exclude_path))
continue continue
list_folders.append(new Path(path,elem)) list_folders.append(new Path(path,elem))
// check if we need to parse sub_folder // check if we need to parse sub_folder
if len(list_folders) != 0: if len(list_folders) != 0:
Log.debug(" Find a folder : " + str(list_folders)) LOGGER.debug(" Find a folder : " + str(list_folders))
for folder in list_folders: for folder in list_folders:
tmp_out = import_path_local(folder, tmp_out = import_path_local(folder,
limit_sub_folder - 1, limit_sub_folder - 1,