diff --git a/src/org/atriasoft/island/Commands.java b/src/org/atriasoft/island/Commands.java index 5ac5573..3d4a6b0 100644 --- a/src/org/atriasoft/island/Commands.java +++ b/src/org/atriasoft/island/Commands.java @@ -92,10 +92,10 @@ public class Commands { return Commands.getCurrentTrackingBranch(git); } List 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; 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 remote_name + "/" + select_branch; @@ -160,63 +160,63 @@ public class Commands { try { Status status = git.status().call(); if (status.getAdded().size() != 0) { - Log.print(" * Added: (" + status.getAdded().size() + ")"); + LOGGER.print(" * Added: (" + status.getAdded().size() + ")"); for (String elem : status.getAdded()) { - Log.print(" - " + elem); + LOGGER.print(" - " + elem); } } if (status.getChanged().size() != 0) { - Log.print(" * Changed: (" + status.getChanged().size() + ")"); + LOGGER.print(" * Changed: (" + status.getChanged().size() + ")"); for (String elem : status.getChanged()) { - Log.print(" - " + elem); + LOGGER.print(" - " + elem); } } if (status.getConflicting().size() != 0) { - Log.print(" * Conflicting: (" + status.getConflicting().size() + ")"); + LOGGER.print(" * Conflicting: (" + status.getConflicting().size() + ")"); for (String elem : status.getConflicting()) { - Log.print(" - " + elem); + LOGGER.print(" - " + elem); } } /* 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()) { - Log.print(" - " + elem); + LOGGER.print(" - " + elem); } } */ if (status.getMissing().size() != 0) { - Log.print(" * Missing: (" + status.getMissing().size() + ")"); + LOGGER.print(" * Missing: (" + status.getMissing().size() + ")"); for (String elem : status.getMissing()) { - Log.print(" - " + elem); + LOGGER.print(" - " + elem); } } if (status.getModified().size() != 0) { - Log.print(" * Modified: (" + status.getModified().size() + ")"); + LOGGER.print(" * Modified: (" + status.getModified().size() + ")"); for (String elem : status.getModified()) { - Log.print(" - " + elem); + LOGGER.print(" - " + elem); } } if (status.getRemoved().size() != 0) { - Log.print(" * Removed: (" + status.getRemoved().size() + ")"); + LOGGER.print(" * Removed: (" + status.getRemoved().size() + ")"); for (String elem : status.getRemoved()) { - Log.print(" - " + elem); + LOGGER.print(" - " + elem); } } if (status.getUntracked().size() != 0) { - Log.print(" * Untracked: (" + status.getUntracked().size() + ")"); + LOGGER.print(" * Untracked: (" + status.getUntracked().size() + ")"); for (String elem : status.getUntracked()) { - Log.print(" - " + elem); + LOGGER.print(" - " + elem); } } if (status.getUntrackedFolders().size() != 0) { - Log.print(" * Untracked Folders: (" + status.getUntrackedFolders().size() + ")"); + LOGGER.print(" * Untracked Folders: (" + status.getUntrackedFolders().size() + ")"); for (String elem : status.getUntrackedFolders()) { - Log.print(" - " + elem); + LOGGER.print(" - " + elem); } } } 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(); } } @@ -228,12 +228,12 @@ public class Commands { public static boolean isGitRepository(final String path) { Path git_repo_path = Env.getIslandRootPath().resolve(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; } 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 - 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 true; @@ -279,7 +279,7 @@ public class Commands { try { git.checkout().setCreateBranch(false).setName("refs/heads/" + destination_branch).call(); } catch (GitAPIException e) { - Log.error("can not checkout branch:" + destination_branch); + LOGGER.error("can not checkout branch:" + destination_branch); e.printStackTrace(); } } @@ -310,29 +310,29 @@ public class Commands { boolean add_in_version_management = false; String[] version_description = null; 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: boolean valid = false; String input1 = null; while (!valid) { - Log.print("Create a new version: (0.0.0)"); - Log.print(" (1) Add in managing version"); - Log.print(" (2) Do NOTHING & continue"); + LOGGER.print("Create a new version: (0.0.0)"); + LOGGER.print(" (1) Add in managing version"); + LOGGER.print(" (2) Do NOTHING & continue"); input1 = Commands.input(); if (Commands.stringInList(new String[]{"1", "2"}, input1)) { valid = true; } else { - Log.print("!!! Must select in range [1..2]"); + LOGGER.print("!!! Must select in range [1..2]"); } } if (input1.equals("1")) { version_description = new String[]{"0", "0", "0"}; add_in_version_management = true; } else if (input1.equals("1")) { - Log.info("Continue Not managing for this repository"); + LOGGER.info("Continue Not managing for this repository"); return null; } else { - Log.warning("An error occured for this repository"); + LOGGER.warn("An error occured for this repository"); return null; } } else { @@ -360,23 +360,23 @@ public class Commands { } catch (NoHeadException e) { // TODO Auto-generated catch block e.printStackTrace(); - Log.critical("dfghdsfghdfgh"); + LOGGER.critical("dfghdsfghdfgh"); } catch (GitAPIException e) { // TODO Auto-generated catch block e.printStackTrace(); - Log.critical("sdgfhdgfhsdfhsdf"); + LOGGER.critical("sdgfhdgfhsdfhsdf"); } // remove all identical sha1 ==> not needed for this boolean have_forward = false; for (ObjectId elem_sha1 : ret_destination_branch_sha1) { if (!Commands.historyContains(ret_source_branch_sha1, 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; } } 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; } String behind_message = ""; @@ -389,30 +389,30 @@ public class Commands { } } 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; } 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; } for (ObjectId elem_sha1 : ret_source_branch_sha1) { if (!Commands.historyContains(ret_destination_branch_sha1, 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: String input1 = null; while (input1 == null) { - Log.print("update version: curent: " + Arrays.toString(version_description)); - Log.print(" (1) Major version (change API)"); - Log.print(" (2) Medium version (add feature)"); - Log.print(" (3) Minor version (Bug fix & doc)"); - Log.print(" (4) Do not release & continue"); + LOGGER.print("update version: curent: " + Arrays.toString(version_description)); + LOGGER.print(" (1) Major version (change API)"); + LOGGER.print(" (2) Medium version (add feature)"); + LOGGER.print(" (3) Minor version (Bug fix & doc)"); + LOGGER.print(" (4) Do not release & continue"); input1 = Commands.input(); 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; } } @@ -439,7 +439,7 @@ public class Commands { } else { 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 if (input1.equals("1")) { new_version_descrtiption[0] += 1; @@ -451,13 +451,13 @@ public class Commands { } else if (input1.equals("3")) { version_description[2] += 1; } else if (input1.equals("4")) { - Log.info("No release for this repository"); + LOGGER.info("No release for this repository"); return null; } else { - Log.warning("An error occured for this repository"); + LOGGER.warn("An error occured for this repository"); 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; } @@ -487,7 +487,7 @@ public class Commands { } catch (RevisionSyntaxException | IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); - Log.error("Merge error: can not retrive the source branch"); + LOGGER.error("Merge error: can not retrive the source branch"); return; } Commands.checkout(git, to); @@ -504,7 +504,7 @@ public class Commands { } 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 } } diff --git a/src/org/atriasoft/island/Env.java b/src/org/atriasoft/island/Env.java index 46b6dab..3a0eb41 100644 --- a/src/org/atriasoft/island/Env.java +++ b/src/org/atriasoft/island/Env.java @@ -51,12 +51,12 @@ public class Env { //String tmp = island_root_path.toAbsolutePath().toString(); Env.islandRootPath = Paths.get(""); 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()))) { tmpPath = tmpPath.getParent(); - Log.debug("test upper path: " + tmpPath); + LOGGER.debug("test upper path: " + tmpPath); 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(); break; } @@ -127,13 +127,13 @@ public class Env { } public static void main(final String[] args) { - Log.error("islandRootPath = {}", Env.islandRootPath.toAbsolutePath()); - Log.error("islandPathUserConfig = {}", Env.islandPathUserConfig.toAbsolutePath()); - Log.error("islandPath = {}", Env.islandPath.toAbsolutePath()); - Log.error("islandPathConfig = {}", Env.islandPathConfig.toAbsolutePath()); - Log.error("islandPathManifest = {}", Env.islandPathManifest.toAbsolutePath()); - Log.error("islandPathArtifactory = {}", Env.islandPathArtifactory.toAbsolutePath()); - Log.error("islandPathArtifactoryLink = {}", Env.islandPathArtifactoryLink.toAbsolutePath()); + LOGGER.error("islandRootPath = {}", Env.islandRootPath.toAbsolutePath()); + LOGGER.error("islandPathUserConfig = {}", Env.islandPathUserConfig.toAbsolutePath()); + LOGGER.error("islandPath = {}", Env.islandPath.toAbsolutePath()); + LOGGER.error("islandPathConfig = {}", Env.islandPathConfig.toAbsolutePath()); + LOGGER.error("islandPathManifest = {}", Env.islandPathManifest.toAbsolutePath()); + LOGGER.error("islandPathArtifactory = {}", Env.islandPathArtifactory.toAbsolutePath()); + LOGGER.error("islandPathArtifactoryLink = {}", Env.islandPathArtifactoryLink.toAbsolutePath()); } public static boolean needProcessWithFilter(final String data) { diff --git a/src/org/atriasoft/island/MainIsland.java b/src/org/atriasoft/island/MainIsland.java index efb46c7..ad9efc3 100755 --- a/src/org/atriasoft/island/MainIsland.java +++ b/src/org/atriasoft/island/MainIsland.java @@ -120,12 +120,12 @@ public class MainIsland { System.exit(0); } if (!parser.hasDetectedAction()) { - Log.error("Call The application without require an action..."); + LOGGER.error("Call The application without require an action..."); parser.showHelp(); System.exit(-1); } if (parser.hasArgumentDetected()) { - Log.error("Detected armument unavaillable :" + parser.getArgumentDetected().toString()); + LOGGER.error("Detected armument unavaillable :" + parser.getArgumentDetected().toString()); parser.showHelp(); System.exit(-1); } diff --git a/src/org/atriasoft/island/Manifest.java b/src/org/atriasoft/island/Manifest.java index 84d8092..1cd2a29 100644 --- a/src/org/atriasoft/island/Manifest.java +++ b/src/org/atriasoft/island/Manifest.java @@ -28,22 +28,22 @@ public class Manifest { public static void checkIsInit() { // check if .XXX exist (create it if needed) if (!Manifest.isInit()) { - Log.error("System not init: missing config: '" + Env.getIslandPath() + "'. Call first"); + LOGGER.error("System not init: missing config: '" + Env.getIslandPath() + "'. Call first"); System.exit(-1); } } public static boolean isInit() { 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; } 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; } 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 true; @@ -96,45 +96,45 @@ public class Manifest { defaultPlouf = this.defaultBase.clone(); } } - // Log.error(" this.default=" + str(this.default)) + // LOGGER.error(" this.default=" + str(this.default)) // add all local project for (final ProjectConfig elem : mani.getProjects()) { - Log.verbose("parse element " + elem); + LOGGER.trace("parse element " + elem); if (!Env.needProcessWithFilter(elem.getName())) { - Log.info("Filter repository: " + elem.getName()); + LOGGER.info("Filter repository: " + elem.getName()); continue; } final ProjectConfig conf = new ProjectConfig(elem.getName(), createPathWithElem(elem), elem.getTag()); // add default remote for the project (search in herited element) for (final RemoteConfig remote : mani.getRemotes()) { - Log.verbose(" Local Remote: " + remote); + LOGGER.trace(" Local Remote: " + remote); if (remote.getName().equals(defaultPlouf.getDefaultRemote())) { conf.getRemotes().add(remote); } } if (conf.getRemotes().size() == 0) { 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())) { conf.getRemotes().add(remote); } } } 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()); } // select default remote: - Log.debug(" remotes count: " + conf.getRemotes().size()); + LOGGER.debug(" remotes count: " + conf.getRemotes().size()); for (final RemoteConfig remote : conf.getRemotes()) { - Log.debug(" remote=" + remote); - Log.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getDefaultRemote()); - Log.verbose(" remote=" + remote); - Log.verbose(" default=" + defaultPlouf); + LOGGER.debug(" remote=" + remote); + LOGGER.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getDefaultRemote()); + LOGGER.trace(" remote=" + remote); + LOGGER.trace(" default=" + defaultPlouf); if (remote.getName().equals(defaultPlouf.getDefaultRemote())) { conf.setSelectRemotes(remote.clone()); - Log.debug(" copy select=" + conf.getSelectRemotes()); + LOGGER.debug(" copy select=" + conf.getSelectRemotes()); // copy the submodule synchronisation // TODO: ????? conf.getSelectRemotes().setSync(defaultPlouf.isSync()); @@ -142,7 +142,7 @@ public class Manifest { } } if (conf.getSelectRemotes() == null) { - Log.error("missing remote for project: " + conf.getName()); + LOGGER.error("missing remote for project: " + conf.getName()); } conf.setBranch(defaultPlouf.getDefaultBranch()); out.add(conf); @@ -165,7 +165,7 @@ public class Manifest { //# ------------------------------------------------------------- //# -- add Volatile ... //# ------------------------------------------------------------- - Log.verbose("include volatile config"); + LOGGER.trace("include volatile config"); // TODO: maybe find a better way to do this... /* conf_global = config.get_unique_config() @@ -192,13 +192,13 @@ public class Manifest { out.append(conf) //# ------------------------------------------------------------- if false: - Log.info("list of all repo:") + LOGGER.info("list of all repo:") for elem in out: - Log.info(" '" + elem.name + "'") - Log.info(" path: " + elem.path) - Log.info(" remotes: " + str(elem.remotes)) - Log.info(" select_remote: " + str(elem.select_remote)) - Log.info(" branch: " + elem.branch) + LOGGER.info(" '" + elem.name + "'") + LOGGER.info(" path: " + elem.path) + LOGGER.info(" remotes: " + str(elem.remotes)) + LOGGER.info(" select_remote: " + str(elem.select_remote)) + LOGGER.info(" branch: " + elem.branch) */ return out; } @@ -212,7 +212,7 @@ public class Manifest { final List out = new ArrayList<>(); // add all local project for (final Artifactory elem : mani.getArtefactories()) { - Log.verbose("parse a " + elem); + LOGGER.trace("parse a " + elem); final Artifactory conf = elem.clone(); out.add(conf); } @@ -281,7 +281,7 @@ public class Manifest { this.rootManifest = rootDirectory.getFileName().toString(); rootDirectory = rootDirectory.getParent(); - Log.debug("PArse main XML config " + rootDirectory); + LOGGER.debug("PArse main XML config " + rootDirectory); ManifestFile parsedElements = null; final XmlMapper mapper = new XmlMapper(); try { @@ -294,7 +294,7 @@ public class Manifest { this.manifests.put(this.rootManifest, parsedElements); for (final String includeElem : parsedElements.getIncludes()) { final Path maniPath = rootDirectory.resolve(includeElem); - Log.debug("PArse <> XML config " + maniPath); + LOGGER.debug("PArse <> XML config " + maniPath); ManifestFile tmpManifest = null; try { tmpManifest = mapper.parse(maniPath, ManifestFile.class); diff --git a/src/org/atriasoft/island/Tools.java b/src/org/atriasoft/island/Tools.java index 0a505e1..11f0e47 100644 --- a/src/org/atriasoft/island/Tools.java +++ b/src/org/atriasoft/island/Tools.java @@ -22,15 +22,15 @@ public class Tools { try { Files.createDirectory(absPath); } catch (IOException e) { - Log.error("Errro while creating path ... " + e.getMessage()); - Log.error("Path ... " + absPath); + LOGGER.error("Errro while creating path ... " + e.getMessage()); + LOGGER.error("Path ... " + absPath); e.printStackTrace(); } } } 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()); if (Files.exists(link)) { Files.delete(link); @@ -44,7 +44,7 @@ public class Tools { if (!Files.exists(path.getParent())) { File file = path.getParent().toFile(); if (!file.mkdirs()) { - Log.critical("Can not create the path:" + path.getParent()); + LOGGER.critical("Can not create the path:" + path.getParent()); } } try { @@ -93,14 +93,14 @@ public class Tools { * @return list of element : {"1", "5", "2", "dev"} */ public static String[] versionStringToList(final String version) { - Log.verbose("parse version string '" + version + "'"); + LOGGER.trace("parse version string '" + version + "'"); List out = new ArrayList<>(); if (version == null || version.isEmpty()) { return new String[] { "0", "0", "0" }; } String[] elems = version.split("-"); 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 values = Arrays.asList(elems[0].split(".")); for (String elem : values) { @@ -129,7 +129,7 @@ public class Tools { public static void waitForServerIfNeeded() { int waitTime = Env.getWaitBetweenSeverCommand(); if (waitTime > 0) { - Log.info("Waiting between commands: " + waitTime + "s"); + LOGGER.info("Waiting between commands: " + waitTime + "s"); try { Thread.sleep(waitTime * 1000); } catch (InterruptedException e) { diff --git a/src/org/atriasoft/island/actions/BaseCheckout.java b/src/org/atriasoft/island/actions/BaseCheckout.java index 1d22dd0..12ce172 100644 --- a/src/org/atriasoft/island/actions/BaseCheckout.java +++ b/src/org/atriasoft/island/actions/BaseCheckout.java @@ -48,12 +48,12 @@ public class BaseCheckout { Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); 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); List 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; boolean have_error = false; for (ProjectConfig elem : all_project) { @@ -64,7 +64,7 @@ public class BaseCheckout { } } if (have_error == true) { - Log.error("Checkout have fail !!! "); + LOGGER.error("Checkout have fail !!! "); } } diff --git a/src/org/atriasoft/island/actions/BaseCommit.java b/src/org/atriasoft/island/actions/BaseCommit.java index 36dcc07..c70445f 100644 --- a/src/org/atriasoft/island/actions/BaseCommit.java +++ b/src/org/atriasoft/island/actions/BaseCommit.java @@ -50,18 +50,18 @@ public class BaseCommit { // load the manifest after pulling it (if possible) Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); 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); List 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; for (ProjectConfig elem : all_project) { id_element++; 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()); if ( !Commands.isGitRepository(git_repo_path.toString())) { continue; @@ -69,7 +69,7 @@ public class BaseCommit { Git git = Git.open(git_repo_path.toFile()); boolean is_modify = git.status().call().hasUncommittedChanges(); if (!is_modify) { - Log.info("Not modify skip !! "); + LOGGER.info("Not modify skip !! "); continue; } // simply update the repository ... @@ -78,7 +78,7 @@ public class BaseCommit { .setAmend(this.amend) .setMessage(this.message) .call(); - Log.print("[" + elem.getName() + "] commit done"); + LOGGER.print("[" + elem.getName() + "] commit done"); } } } diff --git a/src/org/atriasoft/island/actions/BaseFetch.java b/src/org/atriasoft/island/actions/BaseFetch.java index 2f954db..31ea8d0 100644 --- a/src/org/atriasoft/island/actions/BaseFetch.java +++ b/src/org/atriasoft/island/actions/BaseFetch.java @@ -49,36 +49,36 @@ public class BaseFetch { // load the manifest after pulling it (if possible) Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); 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); List 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; for (ProjectConfig elem : all_project) { id_element++; String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem); - Log.print("fetch : " + base_display); + LOGGER.print("fetch : " + base_display); Tools.waitForServerIfNeeded(); - Log.debug("elem : " + elem); + LOGGER.debug("elem : " + elem); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); 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())) { continue; } // simply update the repository ... - Log.verbose("Fetching project: "); + LOGGER.trace("Fetching project: "); { Git git = Git.open(git_repo_path.toFile()); git.fetch() .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .setRemote(elem.getSelectRemotes().getName()) .call(); - Log.info("[" + elem.getName() + "] fetch done"); + LOGGER.info("[" + elem.getName() + "] fetch done"); } } // Update the links: diff --git a/src/org/atriasoft/island/actions/BaseInit.java b/src/org/atriasoft/island/actions/BaseInit.java index 2c5be28..14144c6 100644 --- a/src/org/atriasoft/island/actions/BaseInit.java +++ b/src/org/atriasoft/island/actions/BaseInit.java @@ -40,11 +40,11 @@ public class BaseInit { @ArgParams("Manifest Address") public void execute(final String addressManifest) throws ActionException, Exception { 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()) { - Log.critical("System already init: path already exist: '" + Env.getIslandPath() + "'"); + LOGGER.critical("System already init: path already exist: '" + Env.getIslandPath() + "'"); } Tools.createDirectory(Env.getIslandPath()); @@ -56,10 +56,10 @@ public class BaseInit { configuration.store(); Tools.createDirectory(Env.getIslandPathManifest()); - Log.info("Clone the manifest"); + LOGGER.info("Clone the manifest"); // init session on apache ssh: 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)); SshSessionFactory.setInstance(factory); diff --git a/src/org/atriasoft/island/actions/BasePush.java b/src/org/atriasoft/island/actions/BasePush.java index 22b3c73..f2ea112 100644 --- a/src/org/atriasoft/island/actions/BasePush.java +++ b/src/org/atriasoft/island/actions/BasePush.java @@ -52,21 +52,21 @@ public class BasePush { Manifest mani = new Manifest(file_source_manifest); List 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; for (ProjectConfig elem : all_project) { id_element++; 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(); - Log.debug("elem : " + elem); + LOGGER.debug("elem : " + elem); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); if (!Commands.isGitRepository(elem.getPath())) { continue; } // simply update the repository ... - Log.verbose("push project: "); + LOGGER.trace("push project: "); { Git git = Git.open(git_repo_path.toFile()); String select_branch = git.getRepository().getBranch(); @@ -78,8 +78,8 @@ public class BasePush { .add(select_branch) // .setDryRun(this.dryRun) // .call(); - Log.verbose("plop " + plo.hashCode()); - Log.info("[" + elem.getName() + "] fetch done " + dryRunComment); + LOGGER.trace("plop " + plo.hashCode()); + LOGGER.info("[" + elem.getName() + "] fetch done " + dryRunComment); } } // Update the links: diff --git a/src/org/atriasoft/island/actions/BaseStatus.java b/src/org/atriasoft/island/actions/BaseStatus.java index 4c54b4c..7d89f59 100644 --- a/src/org/atriasoft/island/actions/BaseStatus.java +++ b/src/org/atriasoft/island/actions/BaseStatus.java @@ -44,17 +44,17 @@ public class BaseStatus { Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); 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); Git git = Git.open(Env.getIslandPathManifest().toFile()); boolean is_modify_manifest = git.status().call().hasUncommittedChanges(); if (is_modify_manifest) { - Log.info("!!!!!!!!!!!! MANIFEST is modify !!!!!!!!"); + LOGGER.info("!!!!!!!!!!!! MANIFEST is modify !!!!!!!!"); } List 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; /* Display status of manifest ==> todo later ... diff --git a/src/org/atriasoft/island/actions/BaseSync.java b/src/org/atriasoft/island/actions/BaseSync.java index 4b8e4ce..3a44c60 100644 --- a/src/org/atriasoft/island/actions/BaseSync.java +++ b/src/org/atriasoft/island/actions/BaseSync.java @@ -62,30 +62,30 @@ public class BaseSync { // load the manifest after pulling it (if possible) Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); 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); List 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; for (ProjectConfig elem : all_project) { id_element++; String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem); - Log.info("sync : " + base_display); + LOGGER.info("sync : " + base_display); Tools.waitForServerIfNeeded(); - Log.debug("elem : " + elem); + LOGGER.debug("elem : " + elem); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); 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)) { // 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()); - Log.info("clone the repo : " + addressManifest); + LOGGER.info("clone the repo : " + addressManifest); Git git = Git.cloneRepository() .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) @@ -95,7 +95,7 @@ public class BaseSync { .call(); // add global mirror list 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()); StoredConfig config = git.getRepository().getConfig(); config.setString("remote", mirror.getName(), "url", addressManifestMiror); @@ -104,9 +104,9 @@ public class BaseSync { // check submodule if requested: if (elem.getSelectRemotes().isSync() && Files.exists(git_repo_path.resolve(".gitmodules"))) { - Log.info(" ==> update submodule (init)"); + LOGGER.info(" ==> update submodule (init)"); git.submoduleInit().call(); - Log.info(" ==> update submodule (update)"); + LOGGER.info(" ==> update submodule (update)"); git.submoduleUpdate() .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .call(); @@ -115,15 +115,15 @@ public class BaseSync { } 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 - 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) { - Log.info("SYNC: Already downloaded"); + LOGGER.info("SYNC: Already downloaded"); continue; } // simply update the repository ... - Log.verbose("Fetching project: "); + LOGGER.trace("Fetching project: "); { Git git = Git.open(git_repo_path.toFile()); Repository repo = git.getRepository(); @@ -138,18 +138,18 @@ public class BaseSync { .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .setRemote(elem.getSelectRemotes().getName()) .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; } git.pull() .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .setRemote(elem.getSelectRemotes().getName()) .call(); - Log.verbose("select branch = '" + select_branch + "' track: '" + ret_track + "'"); + LOGGER.trace("select branch = '" + select_branch + "' track: '" + ret_track + "'"); // check submodule if requested: if (elem.getSelectRemotes().isSync() && Files.exists(git_repo_path.resolve(".gitmodules"))) { - Log.info(" ==> sync submodule"); + LOGGER.info(" ==> sync submodule"); git.submoduleUpdate() .setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) .call(); diff --git a/src/org/atriasoft/island/actions/Deliver.java b/src/org/atriasoft/island/actions/Deliver.java index 796a9f9..b259b77 100644 --- a/src/org/atriasoft/island/actions/Deliver.java +++ b/src/org/atriasoft/island/actions/Deliver.java @@ -49,7 +49,7 @@ public class Deliver { // load the manifest after pulling it (if possible) Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); 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); if (this.from == null || this.from.isEmpty()) { @@ -60,29 +60,29 @@ public class Deliver { } List 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; int id_element = 0; for (ProjectConfig elem : all_project) { id_element++; 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)) { deliver_availlable = false; } } 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; } - Log.info("deliver-ckeck: ==> All is OK"); + LOGGER.info("deliver-ckeck: ==> All is OK"); id_element = 0; for (ProjectConfig elem : all_project) { id_element += 1; String base_display = Tools.getListBaseDisplay(id_element, all_project.size(), elem); - Log.info("deliver: ========================================================================"); - Log.info("deliver:.equals(" + base_display); - Log.info("deliver: ========================================================================"); + LOGGER.info("deliver: ========================================================================"); + LOGGER.info("deliver:.equals(" + base_display); + LOGGER.info("deliver: ========================================================================"); Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); // Check the validity of the version, @@ -90,14 +90,14 @@ public class Deliver { if (curentVersionElem == null) { continue; } - Log.info("deliver: ==> version: " + curentVersionElem.version()); + LOGGER.info("deliver: ==> version: " + curentVersionElem.version()); Git git = Git.open(git_repo_path.toFile()); // Checkout destination branch: Commands.checkout(git, this.to); // create new repo tag 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) { continue; } diff --git a/src/org/atriasoft/island/actions/DependencySync.java b/src/org/atriasoft/island/actions/DependencySync.java index c4fed0c..5277f59 100644 --- a/src/org/atriasoft/island/actions/DependencySync.java +++ b/src/org/atriasoft/island/actions/DependencySync.java @@ -118,9 +118,9 @@ public class DependencySync { } root.put("dependency", dep); Ejson.generate(root, data); - //Log.error("generated GLD dependency : {}", data.toString()); - //Log.error(" ==> {}", createArtefactLinkGLDFile.toString()); - //Log.error(" --> {}", artefactLink.toString()); + //LOGGER.error("generated GLD dependency : {}", data.toString()); + //LOGGER.error(" ==> {}", createArtefactLinkGLDFile.toString()); + //LOGGER.error(" --> {}", artefactLink.toString()); Tools.fileWriteData(createArtefactLinkGLDFile, data.toString()); } @@ -138,7 +138,7 @@ public class DependencySync { } private void downloadPackage(final List artefactories, final Dependency dependency, final List alreadyDone) throws Exception { - Log.debug("download : " + dependency); + LOGGER.debug("download : " + dependency); for (final UpdateDependency elem : alreadyDone) { if (elem.dependency.org().equals(dependency.org()) && elem.dependency.name().equals(dependency.name()) && elem.dependency.remote().equals(dependency.remote())) { // find element ==> check version @@ -152,10 +152,10 @@ public class DependencySync { } final String metadataFile = createMavenMetadataRemoteFileName(artefactories, dependency); - Log.verbose("Metadata position: " + metadataFile); + LOGGER.trace("Metadata position: " + metadataFile); final Path localPath = createMetadataLocalFileName(artefactories, dependency); final String dataAsString = readAllMatadataAndStore(metadataFile, localPath); - Log.verbose("dataAsString: " + dataAsString); + LOGGER.trace("dataAsString: " + dataAsString); MavenMetadata metaData = null; final XmlMapper mapper = new XmlMapper(); try { @@ -164,7 +164,7 @@ public class DependencySync { // TODO Auto-generated catch block e.printStackTrace(); } - Log.print("metaData=" + metaData); + LOGGER.print("metaData=" + metaData); // TODO : check if the current file is newer.... @@ -243,25 +243,25 @@ public class DependencySync { // load the manifest after pulling it (if possible) final Path file_source_manifest = Env.getIslandPathManifest().resolve(configuration.getManifestName()); 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 List artefactories = mani.getAllArtefactories(); final List dependencies = mani.getAllDependencies(); - Log.info("Synchronize of: " + dependencies.size() + " dependenc" + Tools.getPlural(dependencies)); - Log.info("base on: " + artefactories.size() + " artefactor" + Tools.getPlural(artefactories)); + LOGGER.info("Synchronize of: " + dependencies.size() + " dependenc" + Tools.getPlural(dependencies)); + LOGGER.info("base on: " + artefactories.size() + " artefactor" + Tools.getPlural(artefactories)); int id_element = 0; for (final Dependency elem : dependencies) { id_element++; final String base_display = Tools.getListBaseDisplay(id_element, dependencies.size(), elem); - Log.info("dep-sync : " + base_display); - Log.debug("elem : " + elem); + LOGGER.info("dep-sync : " + base_display); + LOGGER.debug("elem : " + elem); downloadPackage(artefactories, elem, alreadyDone); } - Log.print("Dependency sync END"); + LOGGER.print("Dependency sync END"); } Artifactory findArtifactory(final List artefactories, final String name) { @@ -281,7 +281,7 @@ public class DependencySync { 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; } @@ -308,18 +308,18 @@ public class DependencySync { } void listFiles(final Path path) { - Log.info("List of file in " + path); + LOGGER.info("List of file in " + path); try { final ZipFile zipFile = new ZipFile(path.toFile()); final Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { final ZipEntry entry = entries.nextElement(); - Log.info(" - " + entry.getName() + " (" + entry.getSize() + ")"); + LOGGER.info(" - " + entry.getName() + " (" + entry.getSize() + ")"); //InputStream stream = zipFile.getInputStream(entry); } } catch (final IOException ex) { - Log.error("Catch Exception : " + ex.getLocalizedMessage()); + LOGGER.error("Catch Exception : " + ex.getLocalizedMessage()); ex.printStackTrace(); } } @@ -338,25 +338,25 @@ public class DependencySync { result.append("\n"); } } 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; } final String dataAsString = result.toString(); - Log.verbose("return=" + dataAsString); + LOGGER.trace("return=" + dataAsString); Tools.fileWriteData(path, dataAsString); return dataAsString; } void readRemoteFileAndStore(final String urlPath, final Path path, final String baseName) throws Exception { if (Files.exists(path)) { - Log.debug("File already download : " + baseName); + LOGGER.debug("File already download : " + baseName); return; } try { if (!Files.exists(path.getParent())) { final File file = path.getParent().toFile(); 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); @@ -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. Files.move(tmpFile, path); } catch (final FileNotFoundException ex) { - Log.warning("File not found: " + urlPath); + LOGGER.warn("File not found: " + urlPath); } finally { } diff --git a/src/org/atriasoft/island/actions/ManifestCheckout.java b/src/org/atriasoft/island/actions/ManifestCheckout.java index f2665fa..b20de6f 100644 --- a/src/org/atriasoft/island/actions/ManifestCheckout.java +++ b/src/org/atriasoft/island/actions/ManifestCheckout.java @@ -39,7 +39,7 @@ public class ManifestCheckout { ProjectConfig elem = configuration.getManifestConfig(); String base_display = Tools.getListBaseDisplay(0, 0, elem); if (!StatusActions.checkoutElem(elem, this.remote, branch, base_display)) { - Log.error("Checkout have fail !!! "); + LOGGER.error("Checkout have fail !!! "); } } diff --git a/src/org/atriasoft/island/actions/StatusActions.java b/src/org/atriasoft/island/actions/StatusActions.java index 54bd7f4..f9f2135 100644 --- a/src/org/atriasoft/island/actions/StatusActions.java +++ b/src/org/atriasoft/island/actions/StatusActions.java @@ -22,17 +22,17 @@ public class StatusActions { public static String baseNameOfATaggedBranch = "branch_on_tag_"; 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()); if (!Files.exists(git_repo_path)){ - Log.warning("checkout " + baseDisplay + " ==> repository does not exist ..."); + LOGGER.warn("checkout " + baseDisplay + " ==> repository does not exist ..."); return false; } // check if the repository is modify Git git = Git.open(git_repo_path.toFile()); boolean is_modify = git.status().call().hasUncommittedChanges(); 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; } List list_branch_local = Commands.getListBranchLocal(git); @@ -43,24 +43,24 @@ public class StatusActions { branchToCheckout = StatusActions.baseNameOfATaggedBranch + elem.getTag(); is_tag = true; 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; } 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; } } // check if we are on the good 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; } // 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)) { git.checkout().setCreateBranch(false).setName("refs/heads/" + branchToCheckout).call(); - Log.info("checkout " + baseDisplay + " ==> switch branch"); + LOGGER.info("checkout " + baseDisplay + " ==> switch branch"); return true; } @@ -74,13 +74,13 @@ public class StatusActions { } // Check if the remote branch exist ... if (is_tag) { - Log.info("checkout " + baseDisplay + " ==> NO remote branch"); + LOGGER.info("checkout " + baseDisplay + " ==> NO remote branch"); return true; } List list_branch_remote = Commands.getListBranchRemote(git); String tryRemoteBranch = elem.getSelectRemotes().getName() + "/" + branchToCheckout; if (list_branch_remote.contains("refs/remotes/" + tryRemoteBranch)) { - Log.info(" ==> find ..."); + LOGGER.info(" ==> find ..."); try { git.checkout() .setCreateBranch(true) @@ -90,33 +90,33 @@ public class StatusActions { .call(); } catch (Exception ex) { 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; } - Log.info("checkout " + baseDisplay + " ==> create new branch"); + LOGGER.info("checkout " + baseDisplay + " ==> create new branch"); return true; } // Checkout a specific tags{ if (!list_tags.contains(elem.getTag())) { - Log.info("checkout " + baseDisplay + " ==> NO remote tags"); + LOGGER.info("checkout " + baseDisplay + " ==> NO remote tags"); return true; } - Log.info(" ==> find ..."); - Log.todo("checkout " + baseDisplay + " ==> Can not checkout to the correct tags MUST be inplemented"); + LOGGER.info(" ==> find ..."); + LOGGER.info("[TODO] checkout " + baseDisplay + " ==> Can not checkout to the correct tags MUST be inplemented"); return false; /* // checkout the new branch{ cmd = "git checkout --quiet " + elem.tag + " -b " + 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); if ret[1] != "" \ and ret != false{ - Log.info("'" + str(ret) + "'"); - Log.error("checkout " + base_display + " ==> Can not checkout to the correct tags"); + LOGGER.info("'" + str(ret) + "'"); + LOGGER.error("checkout " + base_display + " ==> Can not checkout to the correct tags"); 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; */ } @@ -125,11 +125,11 @@ public class StatusActions { if (elem.isVolatile()) { volatileString = " (volatile)"; } - Log.verbose("status : " + baseDisplay); - //Log.debug("elem : " + str(elem)) + LOGGER.trace("status : " + baseDisplay); + //LOGGER.debug("elem : " + str(elem)) Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); 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; } Git git = Git.open(git_repo_path.toFile()); @@ -137,16 +137,16 @@ public class StatusActions { List list_branch = Commands.getListBranchAll(git); 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; if (!select_branch.startsWith(StatusActions.baseNameOfATaggedBranch)) { // get tracking branch tracking_remote_branch = Commands.getTrackingBranch(git, argumentRemoteName, select_branch); if (tracking_remote_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 { - 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; } @@ -157,7 +157,7 @@ public class StatusActions { if (is_modify == true) { 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); String behind_forward_comment = ""; if (deltas.forward() != 0) { @@ -177,7 +177,7 @@ public class StatusActions { // check the current tags of the repository if (argumentDisplayTag) { List 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) { if (!tags_comment.isEmpty()) { 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- - - - -"; } } - 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); 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 { boolean deliver_availlable = true; - Log.debug("deliver-ckeck: " + baseDisplay); - Log.debug(" ==> check repo exist"); + LOGGER.debug("deliver-ckeck: " + baseDisplay); + LOGGER.debug(" ==> check repo exist"); // Check the repo exist Path git_repo_path = Env.getIslandRootPath().resolve(elem.getPath()); if (!Files.exists(git_repo_path)) { - Log.warning("deliver-ckeck: " + baseDisplay + " ==> MUST be download"); + LOGGER.warn("deliver-ckeck: " + baseDisplay + " ==> MUST be download"); return false; } - Log.debug(" ==> check is modify"); + LOGGER.debug(" ==> check is modify"); // check if the curent repo is modify Git git = Git.open(git_repo_path.toFile()); boolean is_modify = git.status().call().hasUncommittedChanges(); if (is_modify) { - Log.warning("deliver-ckeck: " + baseDisplay + " ==> MUST not be modify"); + LOGGER.warn("deliver-ckeck: " + baseDisplay + " ==> MUST not be modify"); return false; } - Log.debug(" ==> check current branch is '" + sourceBranch + "'"); + LOGGER.debug(" ==> check current branch is '" + sourceBranch + "'"); // check if we are on source_branch String select_branch = git.getRepository().getBranch(); 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; } - Log.debug(" ==> check have tracking branch"); + LOGGER.debug(" ==> check have tracking branch"); // check if we have a remote traking branch String tracking_remote_branch = Commands.getTrackingBranch(git, argumentRemoteName, select_branch); 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; } // go on destination branch Commands.checkout(git, destinationBranch); - Log.debug(" ==> check current branch is '" + sourceBranch + "'"); + LOGGER.debug(" ==> check current branch is '" + sourceBranch + "'"); // check if we are on "master" select_branch = git.getRepository().getBranch(); 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; } - Log.debug(" ==> check have tracking branch"); + LOGGER.debug(" ==> check have tracking branch"); // check if we have a remote traking branch tracking_remote_branch = Commands.getTrackingBranch(git, argumentRemoteName, select_branch); 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; } diff --git a/src/org/atriasoft/island/actions/VolatileAdd.java b/src/org/atriasoft/island/actions/VolatileAdd.java index 25cc86e..93b7542 100644 --- a/src/org/atriasoft/island/actions/VolatileAdd.java +++ b/src/org/atriasoft/island/actions/VolatileAdd.java @@ -23,10 +23,10 @@ public class VolatileAdd { public void execute(final String remoteUrl, final String localPath) throws ActionException, Exception { if (remoteUrl.isEmpty()) { - Log.error("volatile-add: Missing git repository address ..."); + LOGGER.error("volatile-add: Missing git repository address ..."); return; } - Log.info("Add 'volatile' repository: '" + remoteUrl + "' path='" + localPath + "'"); + LOGGER.info("Add 'volatile' repository: '" + remoteUrl + "' path='" + localPath + "'"); // check system is OK Manifest.checkIsInit(); @@ -34,12 +34,12 @@ public class VolatileAdd { // Update the current configuration: ConfigManifest configuration = Config.getUniqueConfig(); if (configuration.existVolatile(localPath)) { - Log.error("Volatile Already exist !!!"); + LOGGER.error("Volatile Already exist !!!"); return; } // TODO: Check if the local path does not exist in the manifest configuration.addVolatile(remoteUrl, localPath); configuration.store(); - Log.print("Volatile added: " + localPath); + LOGGER.print("Volatile added: " + localPath); } } diff --git a/src/org/atriasoft/island/actions/VolatileList.java b/src/org/atriasoft/island/actions/VolatileList.java index 8bee4cb..ba2a6ba 100644 --- a/src/org/atriasoft/island/actions/VolatileList.java +++ b/src/org/atriasoft/island/actions/VolatileList.java @@ -20,7 +20,7 @@ public class VolatileList { @ArgExecute public void execute() throws ActionException, Exception { - Log.info("List all 'volatile'"); + LOGGER.info("List all 'volatile'"); // check system is OK Manifest.checkIsInit(); @@ -29,12 +29,12 @@ public class VolatileList { ConfigManifest configuration = Config.getUniqueConfig(); List volatiles = configuration.getVolatiles(); - Log.print("List of volatiles:"); + LOGGER.print("List of volatiles:"); if (volatiles.size() == 0) { - Log.print("\t==> No repository"); + LOGGER.print("\t==> No repository"); } else { 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()); } } } diff --git a/src/org/atriasoft/island/actions/VolatileRemove.java b/src/org/atriasoft/island/actions/VolatileRemove.java index 7c956a9..068311b 100644 --- a/src/org/atriasoft/island/actions/VolatileRemove.java +++ b/src/org/atriasoft/island/actions/VolatileRemove.java @@ -21,7 +21,7 @@ public class VolatileRemove { @ArgParams("path") @ArgParamsDescription("Path to install the new git repository") 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 Manifest.checkIsInit(); @@ -29,12 +29,12 @@ public class VolatileRemove { // Update the current configuration: ConfigManifest configuration = Config.getUniqueConfig(); if (!configuration.existVolatile(localPath)) { - Log.error("Volatile Does not exist !!!"); + LOGGER.error("Volatile Does not exist !!!"); return; } // TODO: Check if the local path does not exist in the manifest configuration.rmVolatile(localPath); configuration.store(); - Log.print("Volatile Removed: " + localPath); + LOGGER.print("Volatile Removed: " + localPath); } } diff --git a/src/org/atriasoft/island/internal/Log.java b/src/org/atriasoft/island/internal/Log.java index 8a5c80e..0277a8a 100644 --- a/src/org/atriasoft/island/internal/Log.java +++ b/src/org/atriasoft/island/internal/Log.java @@ -6,68 +6,68 @@ import org.atriasoft.reggol.Logger; public class Log { private static final boolean FORCE = false; private static final String LIB_NAME = "island"; - private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME); - private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL); - private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR); - private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING); - private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO); - private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG); - private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE); - private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO); - private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT); + private static final String LIB_NAME_DRAW = Logger.getDrawableName(LOGGER.LIB_NAME); + private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.CRITICAL); + private static final boolean PRINT_ERROR = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.ERROR); + private static final boolean PRINT_WARNING = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.WARNING); + private static final boolean PRINT_INFO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.INFO); + private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.DEBUG); + private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.VERBOSE); + private static final boolean PRINT_TODO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.TODO); + private static final boolean PRINT_PRINT = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.PRINT); public static void critical(final String data, final Exception e) { e.printStackTrace(); - if (Log.PRINT_CRITICAL || Log.FORCE) { - Logger.critical(Log.LIB_NAME_DRAW, data + " : " + e.getMessage()); + if (LOGGER.PRINT_CRITICAL || Log.FORCE) { + Logger.critical(LOGGER.LIB_NAME_DRAW, data + " : " + e.getMessage()); } } public static void critical(final String data, Object... objects) { - if (Log.PRINT_CRITICAL || Log.FORCE) { - Logger.critical(Log.LIB_NAME_DRAW, data, objects); + if (LOGGER.PRINT_CRITICAL || Log.FORCE) { + Logger.critical(LOGGER.LIB_NAME_DRAW, data, objects); } } public static void debug(final String data, Object... objects) { - if (Log.PRINT_DEBUG || Log.FORCE) { - Logger.debug(Log.LIB_NAME_DRAW, data, objects); + if (LOGGER.PRINT_DEBUG || Log.FORCE) { + Logger.debug(LOGGER.LIB_NAME_DRAW, data, objects); } } public static void error(final String data, Object... objects) { - if (Log.PRINT_ERROR || Log.FORCE) { - Logger.error(Log.LIB_NAME_DRAW, data, objects); + if (LOGGER.PRINT_ERROR || Log.FORCE) { + Logger.error(LOGGER.LIB_NAME_DRAW, data, objects); } } public static void info(final String data, Object... objects) { - if (Log.PRINT_INFO || Log.FORCE) { - Logger.info(Log.LIB_NAME_DRAW, data, objects); + if (LOGGER.PRINT_INFO || Log.FORCE) { + Logger.info(LOGGER.LIB_NAME_DRAW, data, objects); } } public static void print(final String data, Object... objects) { - if (Log.PRINT_PRINT || Log.FORCE) { - Logger.print(Log.LIB_NAME_DRAW, data, objects); + if (LOGGER.PRINT_PRINT || Log.FORCE) { + Logger.print(LOGGER.LIB_NAME_DRAW, data, objects); } } public static void todo(final String data, Object... objects) { - if (Log.PRINT_TODO || Log.FORCE) { - Logger.todo(Log.LIB_NAME_DRAW, data, objects); + if (LOGGER.PRINT_TODO || Log.FORCE) { + Logger.todo(LOGGER.LIB_NAME_DRAW, data, objects); } } public static void verbose(final String data, Object... objects) { - if (Log.PRINT_VERBOSE || Log.FORCE) { - Logger.verbose(Log.LIB_NAME_DRAW, data, objects); + if (LOGGER.PRINT_VERBOSE || Log.FORCE) { + Logger.verbose(LOGGER.LIB_NAME_DRAW, data, objects); } } public static void warning(final String data, Object... objects) { - if (Log.PRINT_WARNING || Log.FORCE) { - Logger.warning(Log.LIB_NAME_DRAW, data, objects); + if (LOGGER.PRINT_WARNING || Log.FORCE) { + Logger.warning(LOGGER.LIB_NAME_DRAW, data, objects); } } diff --git a/src/org/atriasoft/island/model/manifest/ConfigManifest.java b/src/org/atriasoft/island/model/manifest/ConfigManifest.java index 69bc2bd..cd986ca 100644 --- a/src/org/atriasoft/island/model/manifest/ConfigManifest.java +++ b/src/org/atriasoft/island/model/manifest/ConfigManifest.java @@ -29,10 +29,10 @@ public class ConfigManifest { try { root = mapper.parse(path, ConfigManifest.class); } catch (final ExmlException e) { - Log.error("Can not parse the file.1. " + path); + LOGGER.error("Can not parse the file.1. " + path); e.printStackTrace(); } catch (final AknotException e) { - Log.error("Can not parse the file.2. " + path); + LOGGER.error("Can not parse the file.2. " + path); e.printStackTrace(); } return root; @@ -82,7 +82,7 @@ public class ConfigManifest { if (index == -1) { index = addressManifest.lastIndexOf(':'); 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; } @@ -174,7 +174,7 @@ public class ConfigManifest { try { store(Env.getIslandPathConfig()); } catch (final ExmlBuilderException e) { - Log.error("Can not store the configuration ... "); + LOGGER.error("Can not store the configuration ... "); e.printStackTrace(); } } @@ -184,7 +184,7 @@ public class ConfigManifest { try { mapper.store(this, path); } catch (final ExmlException | IOException | AknotException ex) { - Log.warning("detect throw: " + ex.getMessage()); + LOGGER.warn("detect throw: " + ex.getMessage()); ex.printStackTrace(); } } diff --git a/tmpsrc/actions/islandAction_command.java b/tmpsrc/actions/islandAction_command.java index ee88412..a380488 100644 --- a/tmpsrc/actions/islandAction_command.java +++ b/tmpsrc/actions/islandAction_command.java @@ -44,7 +44,7 @@ public void have_unknow_argument(): public void execute(_arguments): cmd = "" for elem in _arguments: - Log.info("Get data element: " + str(elem.getArg())) + LOGGER.info("Get data element: " + str(elem.getArg())) cmd += elem.getArg() + " " // 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()) 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) 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 for elem in all_project: - Log.info("------------------------------------------") + LOGGER.info("------------------------------------------") id_element += 1 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() - //Log.debug("elem : " + str(elem)) + //LOGGER.debug("elem : " + str(elem)) git_repo_path = new Path(Env.get_island_root_path(), elem.path) 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 - Log.verbose("execute : " + cmd) + LOGGER.trace("execute : " + cmd) ret = multiprocess.run_command(cmd, cwd=git_repo_path) if ret[0] == 0: - Log.info("ret=" + ret[1]) - Log.info("err=" + ret[2]) + LOGGER.info("ret=" + ret[1]) + LOGGER.info("err=" + ret[2]) else: - Log.info("Execution ERROR") + LOGGER.info("Execution ERROR") \ No newline at end of file diff --git a/tmpsrc/actions/islandAction_deliver-push.java b/tmpsrc/actions/islandAction_deliver-push.java index 96ab1d4..13b69f5 100644 --- a/tmpsrc/actions/islandAction_deliver-push.java +++ b/tmpsrc/actions/islandAction_deliver-push.java @@ -46,10 +46,10 @@ public void execute(_arguments): argument_remote_name = "" for elem in _arguments: if elem.getOptionName().equals("remote": - Log.info("find remote name: '" + elem.getArg() + "'") + LOGGER.info("find remote name: '" + elem.getArg() + "'") argument_remote_name = elem.getArg() else: - Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'") + LOGGER.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'") // check system is OK Manifest.checkIsInit(); @@ -58,14 +58,14 @@ public void execute(_arguments): file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name()) 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) destination_branch = mani.deliver_master source_branch = mani.deliver_develop 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 for elem in all_project: id_element += 1 @@ -73,7 +73,7 @@ public void execute(_arguments): if argument_remote_name.equals("": argument_remote_name = elem.select_remote["name"] 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() status.deliver_push(elem, argument_remote_name, destination_branch, source_branch, base_display) diff --git a/tmpsrc/actions/islandAction_manifest-deliver-push.java b/tmpsrc/actions/islandAction_manifest-deliver-push.java index 27a2b1d..e6bc77f 100644 --- a/tmpsrc/actions/islandAction_manifest-deliver-push.java +++ b/tmpsrc/actions/islandAction_manifest-deliver-push.java @@ -45,7 +45,7 @@ public void add_specific_arguments(my_args, section): //# public void execute(_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 Manifest.checkIsInit(); @@ -54,7 +54,7 @@ public void execute(_arguments): file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name()) 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() diff --git a/tmpsrc/actions/islandAction_manifest-deliver.java b/tmpsrc/actions/islandAction_manifest-deliver.java index 36c557c..7e650f4 100644 --- a/tmpsrc/actions/islandAction_manifest-deliver.java +++ b/tmpsrc/actions/islandAction_manifest-deliver.java @@ -49,7 +49,7 @@ public void add_specific_arguments(my_args, section): public void execute(_arguments): argument_remote_name = "" 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 Manifest.checkIsInit(); @@ -58,7 +58,7 @@ public void execute(_arguments): file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name()) 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() @@ -69,31 +69,31 @@ public void execute(_arguments): // Check the manifest is up to date ... 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: - 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 all_tags = check_all_tags(mani) 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 // deliver the manifest (if Needed ...) base_display = tools.get_list_base_display(0, 0, elem) - Log.info("manifest-deliver: ========================================================================") - Log.info("manifest-deliver:.equals(" + base_display) - Log.info("manifest-deliver: ========================================================================") + LOGGER.info("manifest-deliver: ========================================================================") + LOGGER.info("manifest-deliver:.equals(" + base_display) + LOGGER.info("manifest-deliver: ========================================================================") git_repo_path = new Path(Env.get_island_root_path(), elem.path) // Check the validity of the version, version_description, add_in_version_management = status.get_current_version_repo(git_repo_path) if version_description == None: 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 select_branch = commands.get_current_branch(git_repo_path) @@ -101,7 +101,7 @@ public void execute(_arguments): // 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) - Log.info("new version: " + str(new_version_description)) + LOGGER.info("new version: " + str(new_version_description)) if new_version_description == None: return // merge branch @@ -130,13 +130,13 @@ public void execute(_arguments): commands.checkout(git_repo_path, destination_branch) - Log.info("manifest-deliver: ==> DONE") + LOGGER.info("manifest-deliver: ==> DONE") public void check_all_tags(mani): 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 check_have_error = false list_tags = [] @@ -144,16 +144,16 @@ public void check_all_tags(mani): id_element += 1 base_display = tools.get_list_base_display(id_element, len(all_project), elem) 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 tags_comment = "" git_repo_path = new Path(Env.get_island_root_path(), elem.path) 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 continue 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: list_tags.append({ "name":elem.name, @@ -169,11 +169,11 @@ public void check_all_tags(mani): tags_comment += "," tags_comment += elem_tag 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 continue 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: return None return list_tags diff --git a/tmpsrc/actions/islandAction_manifest-sync.java b/tmpsrc/actions/islandAction_manifest-sync.java index 300d9d4..3c8fdfe 100644 --- a/tmpsrc/actions/islandAction_manifest-sync.java +++ b/tmpsrc/actions/islandAction_manifest-sync.java @@ -44,14 +44,14 @@ public void add_specific_arguments(my_args, section): //# public void execute(_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 Manifest.checkIsInit(); 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()) if is_modify_manifest == true: commands.fetch(Env.get_island_path_manifest(), "origin") diff --git a/tmpsrc/actions/islandAction_sync-local.java b/tmpsrc/actions/islandAction_sync-local.java index 1161391..30b81f9 100644 --- a/tmpsrc/actions/islandAction_sync-local.java +++ b/tmpsrc/actions/islandAction_sync-local.java @@ -50,104 +50,104 @@ public void execute(_arguments): for elem in _arguments: if elem.getOptionName().equals("rebase": reset_instead_of_rebase = true - Log.info("==> Request reset instead of rebase") + LOGGER.info("==> Request reset instead of rebase") 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 Manifest.checkIsInit(); 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()) if is_modify_manifest == true: - Log.warning("Manifest is modify") + LOGGER.warn("Manifest is modify") else: ret_track = commands.get_current_tracking_branch(Env.get_island_path_manifest()) is_forward = commands.is_forward(Env.get_island_path_manifest(), ret_track) if is_forward == true: // 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: - Log.verbose("Check behind:") + LOGGER.trace("Check behind:") is_behind = commands.is_behind(Env.get_island_path_manifest(), ret_track) if is_behind == false: // fetch the repository - Log.info("sync-local: MANIFEST is up-to-date") + LOGGER.info("sync-local: MANIFEST is up-to-date") else: 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) 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) file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name()) 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) 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 count_error = 0 for elem in all_project: id_element += 1 base_display = tools.get_list_base_display(id_element, len(all_project), elem) - Log.info("----------------------------------------------------------------") - Log.info("sync-local: " + base_display) - //Log.debug("elem : " + str(elem)) + LOGGER.info("----------------------------------------------------------------") + LOGGER.info("sync-local: " + base_display) + //LOGGER.debug("elem : " + str(elem)) git_repo_path = new Path(Env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == false: // The Repository does not exist ==> Nothing to do... - Log.warning("sync-local: ==> Not download") + LOGGER.warn("sync-local: ==> Not download") count_error += 1 continue 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 - 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 continue // simply update the repository ... - Log.verbose("Check modify:") + LOGGER.trace("Check modify:") is_modify = commands.check_repository_is_modify(git_repo_path) if is_modify == true: // 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 continue - Log.verbose("Check tracking and local branch:") + LOGGER.trace("Check tracking and local branch:") // get tracking branch ret_track = commands.get_current_tracking_branch(git_repo_path) select_branch = commands.get_current_branch(git_repo_path) - Log.debug("sync-local: check: " + select_branch + " ==> " + ret_track) - Log.verbose("Check forward:") + LOGGER.debug("sync-local: check: " + select_branch + " ==> " + ret_track) + LOGGER.trace("Check forward:") is_forward = commands.is_forward(git_repo_path, ret_track) if is_forward == true: // 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 continue - Log.verbose("Check behind:") + LOGGER.trace("Check behind:") is_behind = commands.is_behind(git_repo_path, ret_track) if is_behind == false: // fetch the repository - Log.info("sync-local: Nothing to do.") + LOGGER.info("sync-local: Nothing to do.") continue 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) else: - Log.info("sync-local: Reset to " + ret_track) + LOGGER.info("sync-local: Reset to " + ret_track) commands.rebase(git_repo_path, ret_track) if count_error != 0: - Log.info(" ***********************************************************") - Log.info(" ** local sync partial warning on " + str(count_error) + " repository") - Log.info(" ***********************************************************") + LOGGER.info(" ***********************************************************") + LOGGER.info(" ** local sync partial warning on " + str(count_error) + " repository") + LOGGER.info(" ***********************************************************") return Env.ret_action_partial_done //# Update the links: diff --git a/tmpsrc/actions/status.java b/tmpsrc/actions/status.java index ddf4c24..a75e605 100644 --- a/tmpsrc/actions/status.java +++ b/tmpsrc/actions/status.java @@ -22,32 +22,32 @@ import os public void deliver_check(elem, argument_remote_name, id_element, base_display, source_branch, destination_branch): deliver_availlable = true - Log.debug("deliver-ckeck: " + base_display) - Log.debug(" ==> check repo exist") + LOGGER.debug("deliver-ckeck: " + base_display) + LOGGER.debug(" ==> check repo exist") // Check the repo exist git_repo_path = new Path(Env.get_island_root_path(), elem.path) 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 - Log.debug(" ==> check is modify") + LOGGER.debug(" ==> check is modify") // check if the curent repo is modify is_modify = commands.check_repository_is_modify(git_repo_path) 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 - Log.debug(" ==> check current branch is '" + source_branch + "'") + LOGGER.debug(" ==> check current branch is '" + source_branch + "'") // check if we are on source_branch select_branch = commands.get_current_branch(git_repo_path) 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 - Log.debug(" ==> check have tracking branch") + LOGGER.debug(" ==> check have tracking branch") // check if we have a remote traking branch tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch) 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 @@ -55,17 +55,17 @@ public void deliver_check(elem, argument_remote_name, id_element, base_display, commands.checkout(git_repo_path, destination_branch) // 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" select_branch = commands.get_current_branch(git_repo_path) 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 - Log.debug(" ==> check have tracking branch") + LOGGER.debug(" ==> check have tracking branch") // check if we have a remote traking branch tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch) 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 @@ -74,7 +74,7 @@ public void deliver_check(elem, argument_remote_name, id_element, base_display, // check if we have a local branch list_branch_local = commands.get_list_branch_local(git_repo_path) 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 // 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 version_description = None 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: valid = false while valid == false: - Log.info("Create a new version: (0.0.0)") - Log.info(" (1) Add in managing version") - Log.info(" (2) Do NOTHING & continue") + LOGGER.info("Create a new version: (0.0.0)") + LOGGER.info(" (1) Add in managing version") + LOGGER.info(" (2) Do NOTHING & continue") input1 = input() if input1 in ["1", "2"]: valid = true else: - Log.info("!!! Must select in range " + str(["1", "2"])) + LOGGER.info("!!! Must select in range " + str(["1", "2"])) if input1.equals("1": version_description = [0, 0, 0] add_in_version_management = true } else if input1.equals("2": - Log.info("Continue Not managing for this repository") + LOGGER.info("Continue Not managing for this repository") return (None, None) else: - Log.warning("An error occured for this repository") + LOGGER.warn("An error occured for this repository") return (None, None) else: 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: if elem_sha1 not in ret_source_branch_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 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 behind_message = "" 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_message = message 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 if behind_count == 1 \ and ( behind_message == default_behind_message or behind_message == default_update_message): - Log.info("deliver: ==> Nothing to do (2).") + LOGGER.info("deliver: ==> Nothing to do (2).") return None for elem_sha1 in ret_source_branch_sha1: if elem_sha1 not in ret_destination_branch_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: valid = false while valid == false: - Log.info("update version: curent: " + str(version_description)) - Log.info(" (1) Major version (change API)") - Log.info(" (2) Medium version (add feature)") - Log.info(" (3) Minor version (Bug fix & doc)") - Log.info(" (4) Do not release & continue") + LOGGER.info("update version: curent: " + str(version_description)) + LOGGER.info(" (1) Major version (change API)") + LOGGER.info(" (2) Medium version (add feature)") + LOGGER.info(" (3) Minor version (Bug fix & doc)") + LOGGER.info(" (4) Do not release & continue") input1 = input() if input1 in ["1", "2", "3", "4"]: valid = true 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 version_description_tmp = 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]) else: version_description.append(0) - Log.info("update version: curent: " + str(version_description)) + LOGGER.info("update version: curent: " + str(version_description)) // increment the version if input1.equals("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": version_description[2] += 1 } else if input1.equals("4": - Log.info("No release for this repository") + LOGGER.info("No release for this repository") return None else: - Log.warning("An error occured for this repository") + LOGGER.warn("An error occured for this repository") return None - Log.info("update version: curent: " + str(version_description)) + LOGGER.info("update version: curent: " + str(version_description)) return version_description @@ -208,59 +208,59 @@ public void deliver_push(elem, argument_remote_name, destination_branch, source_ // Check the repo exist git_repo_path = new Path(Env.get_island_root_path(), elem.path) 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 // check if we are on destination_branch select_branch = commands.get_current_branch(git_repo_path) 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 // check if we have a local branch list_branch_local = commands.get_list_branch_local(git_repo_path) 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 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 list_of_element_to_push = [] // check sha1 of 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) 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 sha_1_destination_tracking = commands.get_sha1_for_branch(git_repo_path, tracking_remote_branch) 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: list_of_element_to_push.append(destination_branch) // check sha1 of 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) 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 sha_1_source_tracking = commands.get_sha1_for_branch(git_repo_path, tracking_remote_branch) 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: list_of_element_to_push.append(source_branch) ret_current_tags = commands.get_tags_current(git_repo_path) 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 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 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: - 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]) 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 - 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: commands.push(git_repo_path, argument_remote_name, list_of_element_to_push) diff --git a/tmpsrc/actions/update_links.java b/tmpsrc/actions/update_links.java index 743a7bc..f4ed274 100644 --- a/tmpsrc/actions/update_links.java +++ b/tmpsrc/actions/update_links.java @@ -18,23 +18,23 @@ public void update(configuration, mani, type_call): // TODO: do not remove link when not needed if len(configuration.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(): 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: os.unlink(base_path) 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 configuration.clear_links() - Log.info(type_call + ": add new links ...") + LOGGER.info(type_call + ": add new links ...") for elem in mani.get_links(): base_path = new Path(Env.get_island_root_path(), elem["destination"]) 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: - 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 else: tools.create_directory_of_file(base_path) diff --git a/tmpsrc/tools.java b/tmpsrc/tools.java index c798569..316bb42 100644 --- a/tmpsrc/tools.java +++ b/tmpsrc/tools.java @@ -56,7 +56,7 @@ public void get_list_sub_files(path): public void remove_path_and_sub_path(path): if os.path.isdir(path): - Log.verbose("remove path : '" + path + "'") + LOGGER.trace("remove path : '" + path + "'") shutil.rmtree(path) public void remove_file(path): @@ -94,13 +94,13 @@ public void version_to_string(version): return version_ID public void version_string_to_list(version): - Log.verbose("parse version string '" + version +"'") + LOGGER.trace("parse version string '" + version +"'") out = [] if version.equals("": return [0, 0, 0] elems = version.split("-") 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("."): out.append(int(elem)) if len(elems) >= 2: @@ -157,7 +157,7 @@ public void store_command(cmd_line, file): if file.equals("" \ or file == None: return; - Log.verbose("create cmd file: " + file) + LOGGER.trace("create cmd file: " + file) // Create directory: create_directory_of_file(file) // 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: list_append_and_check(out_list, in_list, order) 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): // 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 file_data = file_read_data(new Path(path_module, filename_or_version)) 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] lines = file_data.split("\n") 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] line = lines[0] - Log.debug("Parse line: '" + line + "'") + LOGGER.debug("Parse line: '" + line + "'") //check if we have "-dev" dev_mode = "" list_tiret = line.split('-') 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: dev_mode = list_tiret[1] 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)) if dev_mode != "": out.append(dev_mode) - Log.debug(" ==> " + str(out)) + LOGGER.debug(" ==> " + str(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 file_data = file_read_data(new Path(path_module, filename_or_author)) 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 [] // One user by line and # for comment line out = [] @@ -305,7 +305,7 @@ public void wait_for_server_if_needed(): is_first_time_sleep = true; return 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()) @@ -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 = "*"): 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: - Log.verbose("Subparsing limitation append ...") + LOGGER.trace("Subparsing limitation append ...") return [] list_files = get_list_sub_files(path) // 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) - 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: for filename in tmp_list_island_file: 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 = [] for elem in list_folders_full: 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 list_folders.append(new Path(path,elem)) // check if we need to parse sub_folder 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: tmp_out = import_path_local(folder, limit_sub_folder - 1,