[DEV] so many upgrade
This commit is contained in:
parent
f05cd3fe51
commit
908293a48d
16
.flake8
Normal file
16
.flake8
Normal file
@ -0,0 +1,16 @@
|
||||
[flake8]
|
||||
|
||||
# Temporary, should be fixed and reenabled
|
||||
# B006 Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them.
|
||||
# B028 'state_name' is manually surrounded by quotes, consider using the `!r` conversion flag.
|
||||
# B902 blind except Exception
|
||||
|
||||
# Permanently disabled, because conflicting with other rules
|
||||
# B950 line too long (conflicting with black)
|
||||
# E203 whitespace before ':' (conflicting with black)
|
||||
# E501 line too long (81 > 79 characters) (conflicting with black)
|
||||
# W503 line break before binary operator: Nothing to be done on this one, we use W504 instead
|
||||
ignore = B006, B028, B902, B950, E203, E501, W503, ANN101, ANN102, ANN401
|
||||
max-line-length = 99
|
||||
# max-complexity = 18
|
||||
select = A,ANN,B,C,D,E,F,I,W,T
|
18
.isort.cfg
Normal file
18
.isort.cfg
Normal file
@ -0,0 +1,18 @@
|
||||
# Configuration settings for isort.
|
||||
[settings]
|
||||
py_version=38
|
||||
profile=black
|
||||
line_length = 80
|
||||
lines_after_imports = 2
|
||||
|
||||
known_firstparty=nfar_*
|
||||
|
||||
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
|
||||
|
||||
order_by_type = false
|
||||
combine_as_imports = true
|
||||
force_grid_wrap = 3
|
||||
force_sort_within_sections = true
|
||||
include_trailing_comma = true
|
||||
skip = setup.py
|
||||
use_parentheses = true
|
@ -28,14 +28,13 @@ from . import (
|
||||
|
||||
is_init = False
|
||||
|
||||
debug.set_display_on_error(
|
||||
" ==========================\n == Some error occurred ==\n =========================="
|
||||
)
|
||||
debug.set_display_on_error(" ==========================\n == Some error occurred ==\n ==========================")
|
||||
|
||||
|
||||
def init():
|
||||
def init() -> None:
|
||||
"""Global initialization of Island."""
|
||||
global is_init
|
||||
if is_init == True:
|
||||
if is_init is True:
|
||||
return
|
||||
# import local island files
|
||||
list_of_island_files = tools.import_path_local(
|
||||
@ -77,9 +76,7 @@ my_args.add(
|
||||
desc="display debug level (verbose) default =2",
|
||||
)
|
||||
my_args.add("c", "color", desc="Display message in color")
|
||||
my_args.add(
|
||||
"n", "no-fetch-manifest", haveParam=False, desc="Disable the fetch of the manifest"
|
||||
)
|
||||
my_args.add("n", "no-fetch-manifest", haveParam=False, desc="Disable the fetch of the manifest")
|
||||
my_args.add(
|
||||
"F",
|
||||
"filter",
|
||||
@ -104,87 +101,82 @@ my_args.set_stop_at(actions.get_list_of_action())
|
||||
local_argument = my_args.parse()
|
||||
|
||||
|
||||
##
|
||||
## @brief Display the help of this makefile.
|
||||
##
|
||||
def usage():
|
||||
def usage() -> None:
|
||||
"""Display the help of Island."""
|
||||
color = debug.get_color_set()
|
||||
# generic argument displayed :
|
||||
# Generic argument displayed :
|
||||
my_args.display()
|
||||
print(" Action available")
|
||||
list_actions = actions.get_list_of_action()
|
||||
for elem in list_actions:
|
||||
print(f" {color['green']}{color['green']}{color['default']}")
|
||||
print(f" {color['green']}{elem}{color['default']}")
|
||||
print(f" {actions.get_action_help(elem)}")
|
||||
"""
|
||||
print(" " + color['green'] + "init" + color['default'])
|
||||
print(" initialize a 'island' interface with a manifest in a git ")
|
||||
print(" " + color['green'] + "sync" + color['default'])
|
||||
print(" Synchronize the current environnement")
|
||||
print(" " + color['green'] + "status" + color['default'])
|
||||
print(" Dump the status of the environnement")
|
||||
"""
|
||||
print(" {color['green']}init{color['default']}")
|
||||
print(" initialize a 'island' interface with a manifest in a git ")
|
||||
print(" {color['green']}sync{color['default']}")
|
||||
print(" Synchronize the current environnement")
|
||||
print(" {color['green']}status{color['default']}")
|
||||
print(" Dump the status of the environnement")
|
||||
"""
|
||||
print(f" ex: {sys.argv[0]} -c init http://github.com/atria-soft/manifest.git")
|
||||
print(f" ex: {sys.argv[0]} sync")
|
||||
exit(0)
|
||||
|
||||
|
||||
def check_boolean(value: Union[bool, str]) -> bool:
|
||||
if (
|
||||
value == ""
|
||||
or value == "1"
|
||||
or value == "true"
|
||||
or value == "True"
|
||||
or value is True
|
||||
):
|
||||
"""Check if the value is a real boolean or a boolean string and return the boolean value.
|
||||
|
||||
:param value: Value to check.
|
||||
:return: Equivalent boolean value.
|
||||
"""
|
||||
if value == "" or value == "1" or value == "true" or value == "True" or value is True:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
# preparse the argument to get the verbose element for debug mode
|
||||
def parse_generic_arg(argument, active):
|
||||
debug.extreme_verbose(
|
||||
"parse arg : "
|
||||
+ argument.get_option_name()
|
||||
+ " "
|
||||
+ argument.get_arg()
|
||||
+ " active="
|
||||
+ str(active)
|
||||
)
|
||||
def parse_generic_arg(argument: arg_element.ArgElement, active: bool) -> bool:
|
||||
"""Keep global args that have no dependence with the mode.
|
||||
|
||||
:param argument: _description_
|
||||
:param active: _description_
|
||||
:return: _description_
|
||||
"""
|
||||
debug.extreme_verbose(f"parse arg : {argument.get_option_name()} {argument.get_arg()} active={active}")
|
||||
if argument.get_option_name() == "help":
|
||||
if active == False:
|
||||
if active is False:
|
||||
usage()
|
||||
return True
|
||||
elif argument.get_option_name() == "jobs":
|
||||
if active == True:
|
||||
if active is True:
|
||||
# multiprocess.set_core_number(int(argument.get_arg()))
|
||||
pass
|
||||
return True
|
||||
elif argument.get_option_name() == "wait":
|
||||
if active == True:
|
||||
if active is True:
|
||||
env.set_wait_between_sever_command(int(argument.get_arg()))
|
||||
return True
|
||||
elif argument.get_option_name() == "verbose":
|
||||
if active == True:
|
||||
if active is True:
|
||||
debug.set_level(int(argument.get_arg()))
|
||||
return True
|
||||
elif argument.get_option_name() == "folder":
|
||||
if active == True:
|
||||
if active is True:
|
||||
env.set_display_folder_instead_of_git_name(True)
|
||||
return True
|
||||
elif argument.get_option_name() == "color":
|
||||
if active == True:
|
||||
if check_boolean(argument.get_arg()) == True:
|
||||
if active is True:
|
||||
if check_boolean(argument.get_arg()) is True:
|
||||
debug.enable_color()
|
||||
else:
|
||||
debug.disable_color()
|
||||
return True
|
||||
elif argument.get_option_name() == "filter":
|
||||
if active == True:
|
||||
if active is True:
|
||||
env.set_filter_command(str(argument.get_arg()))
|
||||
return True
|
||||
elif argument.get_option_name() == "no-fetch-manifest":
|
||||
if active == False:
|
||||
if active is False:
|
||||
env.set_fetch_manifest(False)
|
||||
return True
|
||||
return False
|
||||
@ -192,42 +184,40 @@ def parse_generic_arg(argument, active):
|
||||
|
||||
# open configuration of island:
|
||||
config_file = env.get_island_path_user_config()
|
||||
if os.path.isfile(config_file) == True:
|
||||
if os.path.isfile(config_file) is True:
|
||||
sys.path.append(os.path.dirname(config_file))
|
||||
debug.debug("Find basic configuration file: '" + config_file + "'")
|
||||
debug.debug(f"Find basic configuration file: '{config_file}'")
|
||||
# the file exist, we can open it and get the initial configuration:
|
||||
configuration_file = __import__(env.get_system_config_name()[:-3])
|
||||
|
||||
if "get_exclude_path" in dir(configuration_file):
|
||||
data = configuration_file.get_exclude_path()
|
||||
debug.debug(" get default config 'get_exclude_path' val='" + str(data) + "'")
|
||||
debug.debug(f"get default config 'get_exclude_path' val='{data}'")
|
||||
env.set_exclude_search_path(data)
|
||||
|
||||
if "get_default_color" in dir(configuration_file):
|
||||
data = configuration_file.get_default_color()
|
||||
debug.debug(" get default config 'get_default_color' val='" + str(data) + "'")
|
||||
debug.debug(f"get default config 'get_default_color' val='{data}'")
|
||||
parse_generic_arg(arg_element.ArgElement("color", str(data)), True)
|
||||
|
||||
if "get_default_debug_level" in dir(configuration_file):
|
||||
data = configuration_file.get_default_debug_level()
|
||||
debug.debug(
|
||||
" get default config 'get_default_debug_level' val='" + str(data) + "'"
|
||||
)
|
||||
debug.debug(f"get default config 'get_default_debug_level' val='{data}'")
|
||||
parse_generic_arg(arg_element.ArgElement("verbose", str(data)), True)
|
||||
|
||||
if "get_default_folder" in dir(configuration_file):
|
||||
data = configuration_file.get_default_folder()
|
||||
debug.debug(" get default config 'get_default_folder' val='" + str(data) + "'")
|
||||
debug.debug(f"get default config 'get_default_folder' val='{data}'")
|
||||
parse_generic_arg(arg_element.ArgElement("folder", str(data)), True)
|
||||
|
||||
if "get_default_wait" in dir(configuration_file):
|
||||
data = configuration_file.get_default_wait()
|
||||
debug.debug(" get default config 'get_default_wait' val='" + str(data) + "'")
|
||||
debug.debug(f"get default config 'get_default_wait' val='{data}'")
|
||||
parse_generic_arg(arg_element.ArgElement("wait", str(data)), True)
|
||||
|
||||
if "get_default_filter" in dir(configuration_file):
|
||||
data = configuration_file.get_default_filter()
|
||||
debug.debug(" get default config 'get_default_filter' val='" + str(data) + "'")
|
||||
debug.debug(f"get default config 'get_default_filter' val='{data}'")
|
||||
parse_generic_arg(arg_element.ArgElement("filter", str(data)), True)
|
||||
|
||||
|
||||
@ -238,7 +228,7 @@ for argument in local_argument:
|
||||
# remove all generic arguments:
|
||||
new_argument_list = []
|
||||
for argument in local_argument:
|
||||
if parse_generic_arg(argument, False) == True:
|
||||
if parse_generic_arg(argument, False) is True:
|
||||
continue
|
||||
new_argument_list.append(argument)
|
||||
|
||||
@ -257,22 +247,13 @@ action_to_do = new_argument_list[0].get_arg()
|
||||
new_argument_list = new_argument_list[1:]
|
||||
if action_to_do not in list_actions:
|
||||
debug.warning("--------------------------------------")
|
||||
debug.warning(
|
||||
"Wrong action type : '"
|
||||
+ str(action_to_do)
|
||||
+ "' availlable list: "
|
||||
+ str(list_actions)
|
||||
)
|
||||
debug.warning(f"Wrong action type : '{action_to_do}' available list: {list_actions}")
|
||||
debug.warning("--------------------------------------")
|
||||
usage()
|
||||
|
||||
# todo : Remove this
|
||||
if action_to_do != "init" and os.path.exists(env.get_island_path()) == False:
|
||||
debug.error(
|
||||
"Can not execute a island cmd if we have not initialize a config: '"
|
||||
+ str("." + env.get_system_base_name())
|
||||
+ "' in upper 6 parent path"
|
||||
)
|
||||
if action_to_do != "init" and os.path.exists(env.get_island_path()) is False:
|
||||
debug.error(f"Can not execute a island cmd if we have not initialize a config: '.{env.get_system_base_name()}' in upper 6 parent path")
|
||||
exit(-1)
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from typing import List, Any, Optional
|
||||
import death.Arguments as arguments
|
||||
|
||||
# Local import
|
||||
@ -23,9 +23,9 @@ list_actions = []
|
||||
__base_action_name = env.get_system_base_name() + "Action_"
|
||||
|
||||
|
||||
def init(files):
|
||||
def init(files) -> None:
|
||||
global list_actions
|
||||
debug.verbose("List of action for island: " + str(len(files)))
|
||||
debug.verbose(f"List of action for island: {len(files)}")
|
||||
for elem_path in files:
|
||||
debug.verbose("parse file : " + elem_path)
|
||||
base_name = os.path.basename(elem_path)
|
||||
@ -46,11 +46,11 @@ def init(files):
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the wall list of action availlable
|
||||
## @return ([string]) the list of action name
|
||||
##
|
||||
def get_list_of_action():
|
||||
def get_list_of_action() -> List[str]:
|
||||
"""Get the wall list of action available
|
||||
|
||||
:return: the list of action name
|
||||
"""
|
||||
global list_actions
|
||||
out = []
|
||||
for elem in list_actions:
|
||||
@ -58,14 +58,14 @@ def get_list_of_action():
|
||||
return out
|
||||
|
||||
|
||||
##
|
||||
## @brief Get a description of an action
|
||||
## @param[in] action_name (string) Name of the action
|
||||
## @param[in] function_name (string) Name of the fucntion to call
|
||||
## @param[in] default_value (*) Renurned value of the call if function does not exist
|
||||
## @return (*) the getted value or the default_value
|
||||
##
|
||||
def get_function_value(action_name, function_name, default_value=None):
|
||||
def get_function_value(action_name: str, function_name: str, default_value: Optional[Any] = None) -> Any:
|
||||
"""Get a description of an action.
|
||||
|
||||
:param action_name: Name of the action
|
||||
:param function_name: Name of the function to call
|
||||
:param default_value: Returned value of the call if function does not exist, defaults to None
|
||||
:return: the requested value or the default_value
|
||||
"""
|
||||
global list_actions
|
||||
for elem in list_actions:
|
||||
if elem["name"] == action_name:
|
||||
@ -79,36 +79,34 @@ def get_function_value(action_name, function_name, default_value=None):
|
||||
return default_value
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global help value of a module
|
||||
## @param[in] action_name (string) Name of the action
|
||||
## @return The first line of description
|
||||
##
|
||||
def get_action_help(action_name):
|
||||
def get_action_help(action_name: str) -> str:
|
||||
"""Get the global help value of a module.
|
||||
|
||||
:param action_name: Name of the action
|
||||
:return: The first line of description
|
||||
"""
|
||||
value = get_function_value(action_name, "help", "---")
|
||||
return value.split("\n")[0]
|
||||
|
||||
|
||||
def usage(arguments, action_name):
|
||||
color = debug.get_color_set()
|
||||
def usage(arguments, action_name) -> None:
|
||||
# generic argument displayed for specific action:
|
||||
# print("Specific argument for the command: '" + action_name + "'" )
|
||||
# print(" " + get_desc(action_name))
|
||||
value = get_function_value(action_name, "help")
|
||||
debug.info("Description:")
|
||||
debug.info("\t" + str(value))
|
||||
arguments.display(action_name)
|
||||
value = get_function_value(action_name, "help_example")
|
||||
if value != None:
|
||||
if value is not None:
|
||||
debug.info("Example:")
|
||||
for elem in value.split("\n"):
|
||||
debug.info("\t" + value)
|
||||
debug.info("\t" + elem)
|
||||
exit(0)
|
||||
|
||||
|
||||
def execute(action_name, argument_start_id):
|
||||
global list_actions
|
||||
# TODO: Move here the check if action is availlable
|
||||
# TODO: Move here the check if action is available
|
||||
|
||||
for elem in list_actions:
|
||||
if elem["name"] != action_name:
|
||||
@ -125,9 +123,7 @@ def execute(action_name, argument_start_id):
|
||||
have_unknow_argument = False
|
||||
if "have_unknow_argument" in dir(the_action):
|
||||
have_unknow_argument = the_action.have_unknow_argument()
|
||||
my_under_args = my_under_args_parser.parse(
|
||||
argument_start_id, have_unknow_argument
|
||||
)
|
||||
my_under_args = my_under_args_parser.parse(argument_start_id, have_unknow_argument)
|
||||
# search help if needed ==> permit to not duplicating code
|
||||
for elem in my_under_args:
|
||||
if elem.get_option_name() == "help":
|
||||
@ -135,17 +131,11 @@ def execute(action_name, argument_start_id):
|
||||
return 0
|
||||
# now we can execute:
|
||||
if "execute" not in dir(the_action):
|
||||
debug.error(
|
||||
"execute is not implmented for this action ... '"
|
||||
+ str(action_name)
|
||||
+ "'"
|
||||
)
|
||||
debug.error("execute is not implmented for this action ... '" + str(action_name) + "'")
|
||||
return -11
|
||||
debug.info("execute: " + action_name)
|
||||
for elem in my_under_args:
|
||||
debug.debug(
|
||||
" " + str(elem.get_option_name()) + "='" + str(elem.get_arg()) + "'"
|
||||
)
|
||||
debug.debug(" " + str(elem.get_option_name()) + "='" + str(elem.get_arg()) + "'")
|
||||
ret = the_action.execute(my_under_args)
|
||||
if ret == None:
|
||||
return 0
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for Checkout.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -14,28 +12,26 @@ from realog import debug
|
||||
import status
|
||||
|
||||
from island import (
|
||||
commands,
|
||||
config,
|
||||
env,
|
||||
manifest,
|
||||
multiprocess,
|
||||
tools,
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
def help():
|
||||
return "Ckeckout a specific branch in all repository"
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help() -> str:
|
||||
return "Checkout a specific branch in all repository"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the current action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
my_args.add("r", "remote", haveParam=True, desc="Name of the remote server")
|
||||
my_args.add_arg(
|
||||
@ -45,15 +41,15 @@ def add_specific_arguments(my_args, section):
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_remote_name = ""
|
||||
branch_to_checkout = ""
|
||||
@ -64,13 +60,7 @@ def execute(_arguments):
|
||||
elif elem.get_option_name() == "branch":
|
||||
branch_to_checkout = elem.get_arg()
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
@ -81,10 +71,8 @@ def execute(_arguments):
|
||||
configuration.set_branch(branch_to_checkout)
|
||||
configuration.store()
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
|
||||
mani = manifest.Manifest(file_source_manifest)
|
||||
@ -96,12 +84,7 @@ def execute(_arguments):
|
||||
for elem in all_project:
|
||||
id_element += 1
|
||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||
if (
|
||||
status.checkout_elem(
|
||||
elem, argument_remote_name, branch_to_checkout, base_display
|
||||
)
|
||||
== False
|
||||
):
|
||||
if status.checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display) is False:
|
||||
have_error = True
|
||||
if have_error == True:
|
||||
if have_error is True:
|
||||
return env.ret_action_fail
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for command.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -22,31 +20,31 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Write the command you want to be executed in every repository"
|
||||
|
||||
|
||||
##
|
||||
## @brief Set the option argument are not able to check if the argument are correct or not
|
||||
## @return (boolean) have parameter without arguments
|
||||
##
|
||||
#
|
||||
# @brief Set the option argument are not able to check if the argument are correct or not
|
||||
# @return (boolean) have parameter without arguments
|
||||
#
|
||||
def have_unknow_argument():
|
||||
return True
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
cmd = ""
|
||||
for elem in _arguments:
|
||||
@ -58,10 +56,8 @@ def execute(_arguments):
|
||||
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
|
||||
mani = manifest.Manifest(file_source_manifest)
|
||||
@ -77,10 +73,8 @@ def execute(_arguments):
|
||||
tools.wait_for_server_if_needed()
|
||||
# debug.debug("elem : " + str(elem))
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
debug.info(
|
||||
"" + base_display + "\r\t\t\t\t\t\t\t\t\t" + " (not download)"
|
||||
)
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
debug.info("" + base_display + "\r\t\t\t\t\t\t\t\t\t" + " (not download)")
|
||||
continue
|
||||
|
||||
debug.verbose("execute : " + cmd)
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for commit.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -22,34 +20,34 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Commit in all repository"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
my_args.add("m", "message", haveParam=True, desc="Message to commit data")
|
||||
my_args.add("a", "all", desc="Commit all elements")
|
||||
my_args.add("", "amend", desc="Ammend data at the previous commit")
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_message = ""
|
||||
argument_amend = ""
|
||||
@ -63,23 +61,15 @@ def execute(_arguments):
|
||||
elif elem.get_option_name() == "amend":
|
||||
argument_amend = " --amend "
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
mani = manifest.Manifest(file_source_manifest)
|
||||
|
||||
@ -91,17 +81,13 @@ def execute(_arguments):
|
||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||
debug.info("commit: " + base_display)
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
debug.error("can not commit project that not exist")
|
||||
continue
|
||||
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) == False:
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) is False:
|
||||
# path already exist but it is not used to as a git repo ==> this is an error
|
||||
debug.warning(
|
||||
"path '"
|
||||
+ git_repo_path
|
||||
+ "' is already existing but not used for a git repository. Clean it and restart"
|
||||
)
|
||||
debug.warning("path '" + git_repo_path + "' is already existing but not used for a git repository. Clean it and restart")
|
||||
continue
|
||||
|
||||
# simply update the repository ...
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for deliver-push.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -23,32 +21,32 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Push a delover (develop & master & tag) on the remotre server"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
my_args.add("r", "remote", haveParam=True, desc="Name of the remote server")
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_remote_name = ""
|
||||
for elem in _arguments:
|
||||
@ -56,23 +54,15 @@ def execute(_arguments):
|
||||
debug.info("find remote name: '" + elem.get_arg() + "'")
|
||||
argument_remote_name = elem.get_arg()
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
mani = manifest.Manifest(file_source_manifest)
|
||||
|
||||
@ -90,6 +80,4 @@ def execute(_arguments):
|
||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||
debug.info("deliver-push: " + base_display)
|
||||
tools.wait_for_server_if_needed()
|
||||
status.deliver_push(
|
||||
elem, argument_remote_name, destination_branch, source_branch, base_display
|
||||
)
|
||||
status.deliver_push(elem, argument_remote_name, destination_branch, source_branch, base_display)
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for deliver.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -23,33 +21,33 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Deliver the current repository (develop & master MUST be up to date and you MUST be on master)"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(_my_args, _section):
|
||||
_my_args.add("f", "from", haveParam=True, desc="source branche to deliver")
|
||||
_my_args.add("t", "to", haveParam=True, desc="desticantion branche of the deliver")
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_from = None
|
||||
argument_to = None
|
||||
@ -61,23 +59,15 @@ def execute(_arguments):
|
||||
debug.info("find destination branch name: '" + elem.get_arg() + "'")
|
||||
argument_to = elem.get_arg()
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
|
||||
mani = manifest.Manifest(file_source_manifest)
|
||||
@ -90,11 +80,9 @@ def execute(_arguments):
|
||||
destination_branch = argument_to
|
||||
|
||||
all_project = mani.get_all_configs()
|
||||
debug.info(
|
||||
"Check if all project are on master: " + str(len(all_project)) + " projects"
|
||||
)
|
||||
debug.info("Check if all project are on master: " + str(len(all_project)) + " projects")
|
||||
id_element = 0
|
||||
deliver_availlable = True
|
||||
deliver_available = True
|
||||
for elem in all_project:
|
||||
id_element += 1
|
||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||
@ -102,16 +90,16 @@ def execute(_arguments):
|
||||
if (
|
||||
status.deliver_check(
|
||||
elem,
|
||||
argument_remote_name,
|
||||
"origin", # TODO: argument_remote_name,
|
||||
id_element,
|
||||
base_display,
|
||||
source_branch,
|
||||
destination_branch,
|
||||
)
|
||||
== False
|
||||
is False
|
||||
):
|
||||
deliver_availlable = False
|
||||
if deliver_availlable == False:
|
||||
deliver_available = False
|
||||
if deliver_available is False:
|
||||
debug.error("deliver-ckeck: Correct the warning to validate the Merge")
|
||||
return
|
||||
debug.info("deliver-ckeck: ==> All is OK")
|
||||
@ -119,13 +107,9 @@ def execute(_arguments):
|
||||
for elem in all_project:
|
||||
id_element += 1
|
||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||
debug.info(
|
||||
"deliver: ========================================================================"
|
||||
)
|
||||
debug.info("deliver: ========================================================================")
|
||||
debug.info("deliver: == " + base_display)
|
||||
debug.info(
|
||||
"deliver: ========================================================================"
|
||||
)
|
||||
debug.info("deliver: ========================================================================")
|
||||
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
# Check the validity of the version,
|
||||
@ -168,23 +152,17 @@ def execute(_arguments):
|
||||
|
||||
version_path_file = os.path.join(git_repo_path, "version.txt")
|
||||
# update version file:
|
||||
tools.file_write_data(
|
||||
version_path_file, tools.version_to_string(new_version_description)
|
||||
)
|
||||
tools.file_write_data(version_path_file, tools.version_to_string(new_version_description))
|
||||
commands.add_file(git_repo_path, version_path_file)
|
||||
commands.commit_all(
|
||||
git_repo_path,
|
||||
"[RELEASE] Release v" + tools.version_to_string(new_version_description),
|
||||
)
|
||||
commands.tag(
|
||||
git_repo_path, "v" + tools.version_to_string(new_version_description)
|
||||
)
|
||||
commands.tag(git_repo_path, "v" + tools.version_to_string(new_version_description))
|
||||
commands.checkout(git_repo_path, source_branch)
|
||||
commands.reset_hard(git_repo_path, destination_branch)
|
||||
new_version_description.append("dev")
|
||||
tools.file_write_data(
|
||||
version_path_file, tools.version_to_string(new_version_description)
|
||||
)
|
||||
tools.file_write_data(version_path_file, tools.version_to_string(new_version_description))
|
||||
commands.add_file(git_repo_path, version_path_file)
|
||||
commands.commit_all(git_repo_path, status.default_update_message)
|
||||
commands.checkout(git_repo_path, destination_branch)
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for fetch.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -22,32 +20,32 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Fecth all the repository (get all modification on the server)"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
my_args.add("r", "remote", haveParam=True, desc="Name of the remote server")
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_remote_name = ""
|
||||
for elem in _arguments:
|
||||
@ -55,13 +53,7 @@ def execute(_arguments):
|
||||
debug.info("find remote name: '" + elem.get_arg() + "'")
|
||||
argument_remote_name = elem.get_arg()
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
@ -70,10 +62,8 @@ def execute(_arguments):
|
||||
commands.fetch(env.get_island_path_manifest(), "origin")
|
||||
|
||||
configuration = config.get_unique_config()
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
mani = manifest.Manifest(file_source_manifest)
|
||||
|
||||
@ -91,17 +81,13 @@ def execute(_arguments):
|
||||
tools.wait_for_server_if_needed()
|
||||
# debug.debug("elem : " + str(elem))
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
debug.error("can not fetch project that not exist")
|
||||
continue
|
||||
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) == False:
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) is False:
|
||||
# path already exist but it is not used to as a git repo ==> this is an error
|
||||
debug.error(
|
||||
"path '"
|
||||
+ git_repo_path
|
||||
+ "' is already existing but not used for a git repository. Clean it and restart"
|
||||
)
|
||||
debug.error("path '" + git_repo_path + "' is already existing but not used for a git repository. Clean it and restart")
|
||||
|
||||
# simply update the repository ...
|
||||
debug.verbose("Fetching project: ")
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for init.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -22,38 +20,38 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Init a island repository (need 'fetch' after)"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
my_args.add("b", "branch", haveParam=True, desc="Select branch to display")
|
||||
my_args.add("m", "manifest", haveParam=True, desc="Name of the manifest")
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
if len(_arguments) == 0:
|
||||
debug.error("Missing argument to execute the current action ...")
|
||||
|
||||
# the configuration availlable:
|
||||
# the configuration available:
|
||||
branch = "master"
|
||||
manifest_name = "default.xml"
|
||||
address_manifest = ""
|
||||
@ -66,46 +64,22 @@ def execute(_arguments):
|
||||
manifest_name = elem.get_arg()
|
||||
elif elem.get_option_name() == "":
|
||||
if address_manifest != "":
|
||||
debug.error(
|
||||
"Manifest adress already set : '"
|
||||
+ address_manifest
|
||||
+ "' !!! '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Manifest adress already set : '" + address_manifest + "' !!! '" + elem.get_arg() + "'")
|
||||
address_manifest = elem.get_arg()
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
if address_manifest == "":
|
||||
debug.error("Init: Missing manifest name")
|
||||
|
||||
debug.info(
|
||||
"Init with: '"
|
||||
+ address_manifest
|
||||
+ "' branch='"
|
||||
+ branch
|
||||
+ "' name of manifest='"
|
||||
+ manifest_name
|
||||
+ "'"
|
||||
)
|
||||
debug.info("Init with: '" + address_manifest + "' branch='" + branch + "' name of manifest='" + manifest_name + "'")
|
||||
|
||||
# check if .XXX exist (create it if needed)
|
||||
if manifest.is_lutin_init() == True:
|
||||
debug.error(
|
||||
"System already init: path already exist: '"
|
||||
+ str(env.get_island_path())
|
||||
+ "'"
|
||||
)
|
||||
if manifest.is_lutin_init() is True:
|
||||
debug.error("System already init: path already exist: '" + str(env.get_island_path()) + "'")
|
||||
|
||||
tools.create_directory(env.get_island_path())
|
||||
# check if the git of the manifest if availlable
|
||||
# check if the git of the manifest if available
|
||||
|
||||
# create the file configuration:
|
||||
conf = config.get_unique_config()
|
||||
@ -115,11 +89,9 @@ def execute(_arguments):
|
||||
conf.store()
|
||||
|
||||
debug.info("Clone the manifest")
|
||||
ret_values = commands.clone(
|
||||
env.get_island_path_manifest(), address_manifest, branch_name=branch
|
||||
)
|
||||
ret_values = commands.clone(env.get_island_path_manifest(), address_manifest, branch_name=branch)
|
||||
|
||||
if ret_values == False:
|
||||
if ret_values is False:
|
||||
debug.info("'" + str(ret_values) + "'")
|
||||
debug.error("Init does not work")
|
||||
return False
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for manifest-checkout.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -23,19 +21,19 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Manifest Ckeckout a specific branch of repository"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
my_args.add("r", "remote", haveParam=True, desc="Name of the remote server")
|
||||
my_args.add_arg(
|
||||
@ -45,15 +43,15 @@ def add_specific_arguments(my_args, section):
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_remote_name = ""
|
||||
branch_to_checkout = ""
|
||||
@ -64,13 +62,7 @@ def execute(_arguments):
|
||||
elif elem.get_option_name() == "branch":
|
||||
branch_to_checkout = elem.get_arg()
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
@ -79,10 +71,5 @@ def execute(_arguments):
|
||||
|
||||
elem = configuration.get_manifest_config()
|
||||
base_display = tools.get_list_base_display(0, 0, elem)
|
||||
if (
|
||||
status.checkout_elem(
|
||||
elem, argument_remote_name, branch_to_checkout, base_display
|
||||
)
|
||||
== False
|
||||
):
|
||||
if status.checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display) is False:
|
||||
return env.ret_action_fail
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for manifest-deliver-push.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -23,51 +21,43 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Push the manifest delivery"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
pass
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
for elem in _arguments:
|
||||
debug.error(
|
||||
"pull Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("pull Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
|
||||
elem = configuration.get_manifest_config()
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for manifest-deliver.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -23,19 +21,19 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Deliver the manifest (merge develop vertion and create a branch with the specific current tags)"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
pass
|
||||
|
||||
@ -43,35 +41,27 @@ def add_specific_arguments(my_args, section):
|
||||
# must be on the branch we choice to merge ...
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_remote_name = ""
|
||||
for elem in _arguments:
|
||||
debug.error(
|
||||
"pull Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("pull Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
|
||||
elem = configuration.get_manifest_config()
|
||||
@ -93,11 +83,9 @@ def execute(_arguments):
|
||||
source_branch,
|
||||
destination_branch,
|
||||
)
|
||||
== False
|
||||
is False
|
||||
):
|
||||
debug.error(
|
||||
"Can not deliver a MANIFEST that is not ready to merge", crash=False
|
||||
)
|
||||
debug.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)
|
||||
@ -108,19 +96,13 @@ def execute(_arguments):
|
||||
# deliver the manifest (if Needed ...)
|
||||
base_display = tools.get_list_base_display(0, 0, elem)
|
||||
|
||||
debug.info(
|
||||
"manifest-deliver: ========================================================================"
|
||||
)
|
||||
debug.info("manifest-deliver: ========================================================================")
|
||||
debug.info("manifest-deliver: == " + base_display)
|
||||
debug.info(
|
||||
"manifest-deliver: ========================================================================"
|
||||
)
|
||||
debug.info("manifest-deliver: ========================================================================")
|
||||
|
||||
git_repo_path = os.path.join(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
|
||||
)
|
||||
version_description, add_in_version_management = status.get_current_version_repo(git_repo_path)
|
||||
if version_description == None:
|
||||
return env.ret_action_fail
|
||||
debug.info("manifest-deliver: ==> version: " + str(version_description))
|
||||
@ -145,17 +127,13 @@ def execute(_arguments):
|
||||
merge_force = True
|
||||
else:
|
||||
merge_force = False
|
||||
commands.merge_branch_on_master(
|
||||
git_repo_path, source_branch, merge_force, branch_destination=destination_branch
|
||||
)
|
||||
commands.merge_branch_on_master(git_repo_path, source_branch, merge_force, branch_destination=destination_branch)
|
||||
|
||||
manifest.tag_manifest(file_source_manifest, all_tags)
|
||||
|
||||
version_path_file = os.path.join(git_repo_path, "version.txt")
|
||||
# update version file:
|
||||
tools.file_write_data(
|
||||
version_path_file, tools.version_to_string(new_version_description)
|
||||
)
|
||||
tools.file_write_data(version_path_file, tools.version_to_string(new_version_description))
|
||||
commands.add_file(git_repo_path, version_path_file)
|
||||
commands.commit_all(
|
||||
git_repo_path,
|
||||
@ -166,9 +144,7 @@ def execute(_arguments):
|
||||
commands.reset_hard(git_repo_path, destination_branch)
|
||||
new_version_description.append("dev")
|
||||
manifest.tag_clear(file_source_manifest)
|
||||
tools.file_write_data(
|
||||
version_path_file, tools.version_to_string(new_version_description)
|
||||
)
|
||||
tools.file_write_data(version_path_file, tools.version_to_string(new_version_description))
|
||||
commands.add_file(git_repo_path, version_path_file)
|
||||
commands.commit_all(git_repo_path, status.default_update_message)
|
||||
commands.checkout(git_repo_path, destination_branch)
|
||||
@ -178,26 +154,21 @@ def execute(_arguments):
|
||||
|
||||
def check_all_tags(mani):
|
||||
all_project = mani.get_all_configs()
|
||||
debug.info(
|
||||
"Check all: " + str(len(all_project)) + " projects have a current tag ..."
|
||||
)
|
||||
debug.info("Check all: " + str(len(all_project)) + " projects have a current tag ...")
|
||||
id_element = 0
|
||||
check_have_error = False
|
||||
list_tags = []
|
||||
for elem in all_project:
|
||||
id_element += 1
|
||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||
if elem.volatile == True:
|
||||
if elem.volatile is True:
|
||||
debug.info(base_display + "\r\t\t\t\t\t\t\t\t\t" + " (Not Managed)")
|
||||
continue
|
||||
tags_comment = ""
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
debug.error(
|
||||
base_display
|
||||
+ volatile
|
||||
+ "\r\t\t\t\t\t\t\t\t\t"
|
||||
+ " (not download)",
|
||||
base_display + volatile + "\r\t\t\t\t\t\t\t\t\t" + " (not download)",
|
||||
crash=False,
|
||||
)
|
||||
check_have_error = True
|
||||
@ -221,6 +192,6 @@ def check_all_tags(mani):
|
||||
continue
|
||||
else:
|
||||
debug.info(base_display + "\r\t\t\t\t\t\t\t\t\t" + " " + tags_comment)
|
||||
if check_have_error == True:
|
||||
if check_have_error is True:
|
||||
return None
|
||||
return list_tags
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for manifest-status.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -23,19 +21,19 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Display status spécifically of the manifest"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(_my_args, _section):
|
||||
_my_args.add(
|
||||
"t",
|
||||
@ -45,15 +43,15 @@ def add_specific_arguments(_my_args, _section):
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_remote_name = ""
|
||||
argument_display_tag = False
|
||||
@ -61,13 +59,7 @@ def execute(_arguments):
|
||||
if elem.get_option_name() == "tags":
|
||||
argument_display_tag = True
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
@ -75,8 +67,6 @@ def execute(_arguments):
|
||||
configuration = config.get_unique_config()
|
||||
elem = configuration.get_manifest_config()
|
||||
base_display = tools.get_list_base_display(0, 0, elem)
|
||||
ret = status.display_status(
|
||||
elem, argument_remote_name, argument_display_tag, 0, base_display
|
||||
)
|
||||
ret = status.display_status(elem, argument_remote_name, argument_display_tag, 0, base_display)
|
||||
if ret != None:
|
||||
return env.ret_action_need_updtate
|
||||
return env.ret_action_need_update
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for manifest-sync.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -22,41 +20,35 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Syncronize all the repository referenced"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
pass
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
for elem in _arguments:
|
||||
debug.error(
|
||||
"pull Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("pull Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
@ -64,10 +56,8 @@ def execute(_arguments):
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
debug.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:
|
||||
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
|
||||
if is_modify_manifest is True:
|
||||
commands.fetch(env.get_island_path_manifest(), "origin")
|
||||
else:
|
||||
commands.pull(env.get_island_path_manifest(), "origin")
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for push.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -22,32 +20,32 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Push all repository to the upper server"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(_my_args, _section):
|
||||
_my_args.add("r", "remote", haveParam=True, desc="Name of the remote server")
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_remote_name = ""
|
||||
for elem in _arguments:
|
||||
@ -55,23 +53,15 @@ def execute(_arguments):
|
||||
debug.info("find remote name: '" + elem.get_arg() + "'")
|
||||
argument_remote_name = elem.get_arg()
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
mani = manifest.Manifest(file_source_manifest)
|
||||
|
||||
@ -85,17 +75,13 @@ def execute(_arguments):
|
||||
tools.wait_for_server_if_needed()
|
||||
# debug.debug("elem : " + str(elem))
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
debug.error("can not push project that not exist")
|
||||
continue
|
||||
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) == False:
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) is False:
|
||||
# path already exist but it is not used to as a git repo ==> this is an error
|
||||
debug.error(
|
||||
"path '"
|
||||
+ git_repo_path
|
||||
+ "' exist but not used for a git repository. Clean it and restart"
|
||||
)
|
||||
debug.error("path '" + git_repo_path + "' exist but not used for a git repository. Clean it and restart")
|
||||
|
||||
# get the current branch:
|
||||
# get local branch
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for status.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -23,19 +21,19 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Get the status of all the repositories"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(_my_args, _section):
|
||||
_my_args.add("r", "remote", haveParam=True, desc="Name of the remote server")
|
||||
_my_args.add(
|
||||
@ -46,15 +44,15 @@ def add_specific_arguments(_my_args, _section):
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
argument_remote_name = ""
|
||||
argument_display_tag = False
|
||||
@ -65,29 +63,19 @@ def execute(_arguments):
|
||||
elif elem.get_option_name() == "tags":
|
||||
argument_display_tag = True
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
|
||||
mani = manifest.Manifest(file_source_manifest)
|
||||
is_modify_manifest = commands.check_repository_is_modify(
|
||||
env.get_island_path_manifest()
|
||||
)
|
||||
if is_modify_manifest == True:
|
||||
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
|
||||
if is_modify_manifest is True:
|
||||
debug.info("!!!!!!!!!!!! MANIFEST is modify !!!!!!!!")
|
||||
|
||||
all_project = mani.get_all_configs()
|
||||
@ -96,19 +84,15 @@ def execute(_arguments):
|
||||
|
||||
elem = configuration.get_manifest_config()
|
||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||
status.display_status(
|
||||
elem, argument_remote_name, argument_display_tag, id_element, base_display
|
||||
)
|
||||
status.display_status(elem, argument_remote_name, argument_display_tag, id_element, base_display)
|
||||
|
||||
is_behind = False
|
||||
for elem in all_project:
|
||||
id_element += 1
|
||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||
ret = status.display_status(
|
||||
elem, argument_remote_name, argument_display_tag, id_element, base_display
|
||||
)
|
||||
ret = status.display_status(elem, argument_remote_name, argument_display_tag, id_element, base_display)
|
||||
if ret != None:
|
||||
is_behind = True
|
||||
|
||||
if is_behind == True:
|
||||
return env.ret_action_need_updtate
|
||||
if is_behind is True:
|
||||
return env.ret_action_need_update
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for sync-local.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -23,19 +21,19 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Update all the branche to the trackin branch in local (no remote access)"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
my_args.add(
|
||||
"r",
|
||||
@ -45,17 +43,17 @@ def add_specific_arguments(my_args, section):
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -5 : env.ret_manifest_is_not_existing : Manifest does not exit
|
||||
## -10 : env.ret_action_is_not_existing : ACTION is not existing
|
||||
## -11 : env.ret_action_executing_system_error : ACTION execution system error
|
||||
## -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
|
||||
## -13 : env.ret_action_partial_done : ACTION partially done
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -5 : env.ret_manifest_is_not_existing : Manifest does not exit
|
||||
# -10 : env.ret_action_is_not_existing : ACTION is not existing
|
||||
# -11 : env.ret_action_executing_system_error : ACTION execution system error
|
||||
# -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
|
||||
# -13 : env.ret_action_partial_done : ACTION partially done
|
||||
#
|
||||
def execute(_arguments):
|
||||
reset_instead_of_rebase = False
|
||||
for elem in _arguments:
|
||||
@ -64,11 +62,7 @@ def execute(_arguments):
|
||||
debug.info("==> Request reset instead of rebase")
|
||||
else:
|
||||
debug.error(
|
||||
"SYNC Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'",
|
||||
"SYNC Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'",
|
||||
ret_value=env.ret_action_wrong_parameters,
|
||||
)
|
||||
|
||||
@ -78,15 +72,13 @@ def execute(_arguments):
|
||||
configuration = config.get_unique_config()
|
||||
|
||||
debug.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:
|
||||
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
|
||||
if is_modify_manifest is True:
|
||||
debug.warning("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:
|
||||
if is_forward is True:
|
||||
# fetch the repository
|
||||
debug.warning(
|
||||
"sync-local: Not update ==> the MANIFEST is forward the remote branch "
|
||||
@ -95,21 +87,19 @@ def execute(_arguments):
|
||||
else:
|
||||
debug.verbose("Check behind:")
|
||||
is_behind = commands.is_behind(env.get_island_path_manifest(), ret_track)
|
||||
if is_behind == False:
|
||||
if is_behind is False:
|
||||
# fetch the repository
|
||||
debug.info("sync-local: MANIFEST is up-to-date")
|
||||
else:
|
||||
if reset_instead_of_rebase == True:
|
||||
if reset_instead_of_rebase is True:
|
||||
debug.info("sync-local: MANIFEST Reset to " + ret_track)
|
||||
commands.reset_hard(env.get_island_path_manifest(), ret_track)
|
||||
else:
|
||||
debug.info("sync-local: MANIFEST Rebase to " + ret_track)
|
||||
commands.rebase(env.get_island_path_manifest(), ret_track)
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error(
|
||||
"Missing manifest file : '" + str(file_source_manifest) + "'",
|
||||
ret_value=env.ret_manifest_is_not_existing,
|
||||
@ -128,28 +118,24 @@ def execute(_arguments):
|
||||
debug.info("sync-local: " + base_display)
|
||||
# debug.debug("elem : " + str(elem))
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
# The Repository does not exist ==> Nothing to do...
|
||||
debug.warning("sync-local: ==> Not download")
|
||||
count_error += 1
|
||||
continue
|
||||
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) == False:
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) is False:
|
||||
# path already exist but it is not used to as a git repo ==> this is an error
|
||||
debug.warning(
|
||||
"sync-local: is already existing but not used for a git repository. Remove it and sync"
|
||||
)
|
||||
debug.warning("sync-local: is already existing but not used for a git repository. Remove it and sync")
|
||||
count_error += 1
|
||||
continue
|
||||
|
||||
# simply update the repository ...
|
||||
debug.verbose("Check modify:")
|
||||
is_modify = commands.check_repository_is_modify(git_repo_path)
|
||||
if is_modify == True:
|
||||
if is_modify is True:
|
||||
# fetch the repository
|
||||
debug.warning(
|
||||
"sync-local: Not update ==> the repository is modified (pass through)"
|
||||
)
|
||||
debug.warning("sync-local: Not update ==> the repository is modified (pass through)")
|
||||
count_error += 1
|
||||
continue
|
||||
debug.verbose("Check tracking and local branch:")
|
||||
@ -159,42 +145,33 @@ def execute(_arguments):
|
||||
debug.debug("sync-local: check: " + select_branch + " ==> " + ret_track)
|
||||
debug.verbose("Check forward:")
|
||||
is_forward = commands.is_forward(git_repo_path, ret_track)
|
||||
if is_forward == True:
|
||||
if is_forward is True:
|
||||
# fetch the repository
|
||||
debug.warning(
|
||||
"sync-local: Not update ==> the repository is forward the remote branch "
|
||||
+ str(commands.get_forward(git_repo_path, ret_track))
|
||||
"sync-local: Not update ==> the repository is forward the remote branch " + str(commands.get_forward(git_repo_path, ret_track))
|
||||
)
|
||||
count_error += 1
|
||||
continue
|
||||
debug.verbose("Check behind:")
|
||||
is_behind = commands.is_behind(git_repo_path, ret_track)
|
||||
if is_behind == False:
|
||||
if is_behind is False:
|
||||
# fetch the repository
|
||||
debug.info("sync-local: Nothing to do.")
|
||||
continue
|
||||
if reset_instead_of_rebase == True:
|
||||
if reset_instead_of_rebase is True:
|
||||
debug.info("sync-local: Reset to " + ret_track)
|
||||
commands.reset_hard(git_repo_path, ret_track)
|
||||
else:
|
||||
debug.info("sync-local: Reset to " + ret_track)
|
||||
commands.rebase(git_repo_path, ret_track)
|
||||
if count_error != 0:
|
||||
debug.info(
|
||||
" ***********************************************************"
|
||||
)
|
||||
debug.info(
|
||||
" ** local sync partial warning on "
|
||||
+ str(count_error)
|
||||
+ " repository"
|
||||
)
|
||||
debug.info(
|
||||
" ***********************************************************"
|
||||
)
|
||||
debug.info(" ***********************************************************")
|
||||
debug.info(" ** local sync partial warning on " + str(count_error) + " repository")
|
||||
debug.info(" ***********************************************************")
|
||||
return env.ret_action_partial_done
|
||||
|
||||
## Update the links:
|
||||
# Update the links:
|
||||
have_error = update_links.update(configuration, mani, "sync-local")
|
||||
if have_error == True:
|
||||
if have_error is True:
|
||||
return -1
|
||||
return None
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for sync.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -23,27 +21,27 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Syncronize all the repository referenced"
|
||||
|
||||
|
||||
##
|
||||
## @brief at the end of the help wa have the example section
|
||||
## @return (string) the Example description string
|
||||
##
|
||||
#
|
||||
# @brief at the end of the help wa have the example section
|
||||
# @return (string) the Example description string
|
||||
#
|
||||
def help_example():
|
||||
return "island init https://git.heeroyui.org/atria-tools/island.git"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
my_args.add(
|
||||
"d",
|
||||
@ -53,15 +51,15 @@ def add_specific_arguments(my_args, section):
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -10 : ACTION is not existing
|
||||
## -11 : ACTION execution system error
|
||||
## -12 : ACTION Wrong parameters
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -10 : ACTION is not existing
|
||||
# -11 : ACTION execution system error
|
||||
# -12 : ACTION Wrong parameters
|
||||
#
|
||||
def execute(_arguments):
|
||||
just_download = False
|
||||
for elem in _arguments:
|
||||
@ -69,13 +67,7 @@ def execute(_arguments):
|
||||
just_download = True
|
||||
debug.info("find remote name: '" + elem.get_arg() + "'")
|
||||
else:
|
||||
debug.error(
|
||||
"SYNC Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("SYNC Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
@ -85,18 +77,14 @@ def execute(_arguments):
|
||||
# TODO: Load Old manifect to check diff ...
|
||||
|
||||
debug.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:
|
||||
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
|
||||
if is_modify_manifest is True:
|
||||
commands.fetch(env.get_island_path_manifest(), "origin")
|
||||
else:
|
||||
commands.pull(env.get_island_path_manifest(), "origin")
|
||||
|
||||
file_source_manifest = os.path.join(
|
||||
env.get_island_path_manifest(), configuration.get_manifest_name()
|
||||
)
|
||||
if os.path.exists(file_source_manifest) == False:
|
||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||
if os.path.exists(file_source_manifest) is False:
|
||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||
|
||||
mani = manifest.Manifest(file_source_manifest)
|
||||
@ -113,16 +101,13 @@ def execute(_arguments):
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if elem.tag != None:
|
||||
debug.warning("Need to select a specific tag version ... " + elem.tag)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
# this is a new clone ==> this is easy ...
|
||||
# clone the manifest repository
|
||||
address_manifest = ""
|
||||
### example git@git.plouf.com:basic_folder
|
||||
# example git@git.plouf.com:basic_folder
|
||||
address_manifest = elem.select_remote["fetch"]
|
||||
if (
|
||||
elem.select_remote["fetch"][0:4] == "git@"
|
||||
and len(elem.select_remote["fetch"][4:].split(":")) <= 1
|
||||
):
|
||||
if elem.select_remote["fetch"][0:4] == "git@" and len(elem.select_remote["fetch"][4:].split(":")) <= 1:
|
||||
address_manifest += ":"
|
||||
else:
|
||||
address_manifest += "/"
|
||||
@ -157,10 +142,7 @@ def execute(_arguments):
|
||||
debug.verbose("Add global mirror: " + str(mirror) + " (done)")
|
||||
# debug.info("plop " + str(elem.select_remote.keys()))
|
||||
# check submodule if requested:
|
||||
if (
|
||||
elem.select_remote["sync"] == True
|
||||
and os.path.exists(os.path.join(git_repo_path, ".gitmodules")) == True
|
||||
):
|
||||
if elem.select_remote["sync"] is True and os.path.exists(os.path.join(git_repo_path, ".gitmodules")) is True:
|
||||
debug.info(" ==> update submodule")
|
||||
cmd = "git submodule init"
|
||||
ret = multiprocess.run_command_direct(cmd, cwd=git_repo_path)
|
||||
@ -181,17 +163,13 @@ def execute(_arguments):
|
||||
continue
|
||||
continue
|
||||
|
||||
if just_download == True:
|
||||
if just_download is True:
|
||||
debug.info("SYNC: Already downloaded")
|
||||
continue
|
||||
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) == False:
|
||||
if os.path.exists(os.path.join(git_repo_path, ".git")) is False:
|
||||
# path already exist but it is not used to as a git repo ==> this is an error
|
||||
debug.error(
|
||||
"path '"
|
||||
+ git_repo_path
|
||||
+ "' is already existing but not used for a git repository. Clean it and restart"
|
||||
)
|
||||
debug.error("path '" + git_repo_path + "' is already existing but not used for a git repository. Clean it and restart")
|
||||
|
||||
# simply update the repository ...
|
||||
debug.verbose("Fetching project: ")
|
||||
@ -201,30 +179,21 @@ def execute(_arguments):
|
||||
is_modify = commands.check_repository_is_modify(git_repo_path)
|
||||
select_branch = commands.get_current_branch(git_repo_path)
|
||||
|
||||
if is_modify == True:
|
||||
if is_modify is True:
|
||||
# fetch the repository
|
||||
commands.fetch(git_repo_path, elem.select_remote["name"])
|
||||
debug.warning(
|
||||
"["
|
||||
+ elem.name
|
||||
+ "] Not update ==> the repository is modified (just fetch)"
|
||||
)
|
||||
debug.warning("[" + elem.name + "] Not update ==> the repository is modified (just fetch)")
|
||||
continue
|
||||
commands.pull(git_repo_path, elem.select_remote["name"])
|
||||
|
||||
debug.verbose(
|
||||
"select branch = '" + select_branch + "' track: '" + str(ret_track) + "'"
|
||||
)
|
||||
debug.verbose("select branch = '" + select_branch + "' track: '" + str(ret_track) + "'")
|
||||
# check submodule if requested:
|
||||
if (
|
||||
elem.select_remote["sync"] == True
|
||||
and os.path.exists(os.path.join(git_repo_path, ".gitmodules")) == True
|
||||
):
|
||||
if elem.select_remote["sync"] is True and os.path.exists(os.path.join(git_repo_path, ".gitmodules")) is True:
|
||||
debug.info(" ==> sync submodule")
|
||||
commands.submodule_sync(git_repo_path)
|
||||
commands.submodule_sync(git_repo_path, elem.select_remote["name"])
|
||||
|
||||
## Update the links:
|
||||
# Update the links:
|
||||
have_error = update_links.update(configuration, mani, "sync-local")
|
||||
if have_error == True:
|
||||
if have_error is True:
|
||||
return -1
|
||||
return None
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for volatile-add.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -22,54 +20,48 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help():
|
||||
return "Add a 'volatile' repository with a local path (this element is update as an element in the manifest but is not managed by the manifest)"
|
||||
|
||||
|
||||
##
|
||||
## @brief Add argument to the specific action
|
||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||
## @param[in] section Name of the currect action
|
||||
##
|
||||
#
|
||||
# @brief Add argument to the specific action
|
||||
# @param[in,out] my_args (death.Arguments) Argument manager
|
||||
# @param[in] section Name of the currect action
|
||||
#
|
||||
def add_specific_arguments(my_args, section):
|
||||
my_args.add_arg(
|
||||
"git repository", optionnal=False, desc="Git repositoty to download"
|
||||
)
|
||||
my_args.add_arg(
|
||||
"path", optionnal=False, desc="Path to install the new git repository"
|
||||
)
|
||||
my_args.add_arg("git repository", optionnal=False, desc="Git repositoty to download")
|
||||
my_args.add_arg("path", optionnal=False, desc="Path to install the new git repository")
|
||||
|
||||
|
||||
##
|
||||
## @brief at the end of the help wa have the example section
|
||||
## @return (string) the Example description string
|
||||
##
|
||||
#
|
||||
# @brief at the end of the help wa have the example section
|
||||
# @return (string) the Example description string
|
||||
#
|
||||
def help_example():
|
||||
return "island volatile-add https://git.heeroyui.org/atria-tools/island.git git"
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -5 : env.ret_manifest_is_not_existing : Manifest does not exit
|
||||
## -10 : env.ret_action_is_not_existing : ACTION is not existing
|
||||
## -11 : env.ret_action_executing_system_error : ACTION execution system error
|
||||
## -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
|
||||
## -13 : env.ret_action_partial_done : ACTION partially done
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -5 : env.ret_manifest_is_not_existing : Manifest does not exit
|
||||
# -10 : env.ret_action_is_not_existing : ACTION is not existing
|
||||
# -11 : env.ret_action_executing_system_error : ACTION execution system error
|
||||
# -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
|
||||
# -13 : env.ret_action_partial_done : ACTION partially done
|
||||
#
|
||||
def execute(_arguments):
|
||||
if len(_arguments) == 0:
|
||||
debug.error(
|
||||
"Missing argument to execute the current action [git repository] [path]"
|
||||
)
|
||||
debug.error("Missing argument to execute the current action [git repository] [path]")
|
||||
|
||||
# the configuration availlable:
|
||||
# the configuration available:
|
||||
path = ""
|
||||
address_git = ""
|
||||
for elem in _arguments:
|
||||
@ -78,13 +70,7 @@ def execute(_arguments):
|
||||
elif elem.get_option_name() == "path":
|
||||
path = elem.get_arg()
|
||||
else:
|
||||
debug.error(
|
||||
"Wrong argument: '"
|
||||
+ elem.get_option_name()
|
||||
+ "' '"
|
||||
+ elem.get_arg()
|
||||
+ "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
if address_git == "":
|
||||
debug.error(
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Action script for volatile-list.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -22,30 +20,28 @@ from island import (
|
||||
)
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the global description of the current action
|
||||
## @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
##
|
||||
def help():
|
||||
return "List all the volatil repository"
|
||||
#
|
||||
# @brief Get the global description of the current action
|
||||
# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
||||
#
|
||||
def help() -> str:
|
||||
return "List all the volatile repository"
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the action required.
|
||||
##
|
||||
## @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
## None : No error (return program out 0)
|
||||
## -5 : env.ret_manifest_is_not_existing : Manifest does not exit
|
||||
## -10 : env.ret_action_is_not_existing : ACTION is not existing
|
||||
## -11 : env.ret_action_executing_system_error : ACTION execution system error
|
||||
## -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
|
||||
## -13 : env.ret_action_partial_done : ACTION partially done
|
||||
##
|
||||
#
|
||||
# @brief Execute the action required.
|
||||
#
|
||||
# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||
# None : No error (return program out 0)
|
||||
# -5 : env.ret_manifest_is_not_existing : Manifest does not exit
|
||||
# -10 : env.ret_action_is_not_existing : ACTION is not existing
|
||||
# -11 : env.ret_action_executing_system_error : ACTION execution system error
|
||||
# -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
|
||||
# -13 : env.ret_action_partial_done : ACTION partially done
|
||||
#
|
||||
def execute(_arguments):
|
||||
for elem in _arguments:
|
||||
debug.error(
|
||||
"Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'"
|
||||
)
|
||||
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
|
||||
|
||||
# check system is OK
|
||||
manifest.check_lutin_is_init()
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Status interface display.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -29,58 +27,37 @@ default_update_message = "[VERSION] update dev tag version"
|
||||
base_name_of_a_tagged_branch = "branch_on_tag_"
|
||||
|
||||
|
||||
def display_status(
|
||||
elem, argument_remote_name, argument_display_tag, id_element, base_display
|
||||
):
|
||||
def display_status(elem, argument_remote_name, argument_display_tag, id_element, base_display):
|
||||
volatile = ""
|
||||
if elem.volatile == True:
|
||||
if elem.volatile is True:
|
||||
volatile = " (volatile)"
|
||||
debug.verbose("status : " + base_display)
|
||||
# debug.debug("elem : " + str(elem))
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
debug.info(
|
||||
base_display + volatile + "\r\t\t\t\t\t\t\t\t\t" + " (not download)"
|
||||
)
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
debug.info(base_display + volatile + "\r\t\t\t\t\t\t\t\t\t" + " (not download)")
|
||||
return
|
||||
|
||||
is_modify = commands.check_repository_is_modify(git_repo_path)
|
||||
list_branch = commands.get_list_branch_all(git_repo_path)
|
||||
select_branch = commands.get_current_branch(git_repo_path)
|
||||
debug.verbose("List all branch: " + str(list_branch))
|
||||
if (
|
||||
select_branch[: len(base_name_of_a_tagged_branch)]
|
||||
!= base_name_of_a_tagged_branch
|
||||
):
|
||||
if select_branch[: len(base_name_of_a_tagged_branch)] != base_name_of_a_tagged_branch:
|
||||
# get tracking branch
|
||||
tracking_remote_branch = commands.get_tracking_branch(
|
||||
git_repo_path, argument_remote_name, select_branch
|
||||
)
|
||||
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch)
|
||||
if tracking_remote_branch == None:
|
||||
debug.info(base_display + volatile + "\r\t\t\t\t\t\t\t (NO BRANCH)")
|
||||
return
|
||||
else:
|
||||
tracking_remote_branch = select_branch[len(base_name_of_a_tagged_branch) :]
|
||||
modify_status = " "
|
||||
if is_modify == True:
|
||||
if is_modify is True:
|
||||
modify_status = " *** "
|
||||
|
||||
debug.verbose(
|
||||
"select branch = '"
|
||||
+ select_branch
|
||||
+ "' is modify : "
|
||||
+ str(is_modify)
|
||||
+ " track: '"
|
||||
+ str(tracking_remote_branch)
|
||||
+ "'"
|
||||
)
|
||||
debug.verbose("select branch = '" + select_branch + "' is modify : " + str(is_modify) + " track: '" + str(tracking_remote_branch) + "'")
|
||||
|
||||
ret_current_branch_sha1 = commands.get_revision_list_to_branch(
|
||||
git_repo_path, select_branch
|
||||
)
|
||||
ret_track_branch_sha1 = commands.get_revision_list_to_branch(
|
||||
git_repo_path, tracking_remote_branch
|
||||
)
|
||||
ret_current_branch_sha1 = commands.get_revision_list_to_branch(git_repo_path, select_branch)
|
||||
ret_track_branch_sha1 = commands.get_revision_list_to_branch(git_repo_path, tracking_remote_branch)
|
||||
# remove all identical sha1 ==> not needed for this
|
||||
in_forward = 0
|
||||
for elem_sha1 in ret_current_branch_sha1:
|
||||
@ -99,13 +76,11 @@ def display_status(
|
||||
behind_forward_comment += " "
|
||||
behind_forward_comment += "behind=" + str(in_behind)
|
||||
if behind_forward_comment != "":
|
||||
behind_forward_comment = (
|
||||
"\r\t\t\t\t\t\t\t\t\t\t\t\t[" + behind_forward_comment + "]"
|
||||
)
|
||||
behind_forward_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t[" + behind_forward_comment + "]"
|
||||
|
||||
tags_comment = ""
|
||||
# check the current tags of the repository
|
||||
if argument_display_tag == True:
|
||||
if argument_display_tag is True:
|
||||
ret_current_tags = commands.get_tags_current(git_repo_path)
|
||||
debug.verbose("tags found: " + str(ret_current_tags))
|
||||
for elem_tag in ret_current_tags:
|
||||
@ -129,7 +104,7 @@ def display_status(
|
||||
+ behind_forward_comment
|
||||
+ tags_comment
|
||||
)
|
||||
if is_modify == True:
|
||||
if is_modify is True:
|
||||
cmd = "git status --short"
|
||||
debug.verbose("execute : " + cmd)
|
||||
ret_diff = multiprocess.run_command(cmd, cwd=git_repo_path)
|
||||
@ -147,18 +122,18 @@ def deliver_check(
|
||||
source_branch,
|
||||
destination_branch,
|
||||
):
|
||||
deliver_availlable = True
|
||||
deliver_available = True
|
||||
debug.debug("deliver-ckeck: " + base_display)
|
||||
debug.debug(" ==> check repo exist")
|
||||
# Check the repo exist
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
debug.warning("deliver-ckeck: " + base_display + " ==> MUST be download")
|
||||
return False
|
||||
debug.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:
|
||||
if is_modify is True:
|
||||
debug.warning("deliver-ckeck: " + base_display + " ==> MUST not be modify")
|
||||
return False
|
||||
|
||||
@ -166,26 +141,14 @@ def deliver_check(
|
||||
# check if we are on source_branch
|
||||
select_branch = commands.get_current_branch(git_repo_path)
|
||||
if select_branch != source_branch:
|
||||
debug.warning(
|
||||
"deliver-ckeck: "
|
||||
+ base_display
|
||||
+ " ==> MUST be on source branch: '"
|
||||
+ source_branch
|
||||
+ "' and is: '"
|
||||
+ select_branch
|
||||
+ "'"
|
||||
)
|
||||
debug.warning("deliver-ckeck: " + base_display + " ==> MUST be on source branch: '" + source_branch + "' and is: '" + select_branch + "'")
|
||||
return False
|
||||
debug.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
|
||||
)
|
||||
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch)
|
||||
if tracking_remote_branch == None:
|
||||
debug.warning(
|
||||
"deliver-ckeck: " + base_display + " ==> MUST have a remote tracking branch"
|
||||
)
|
||||
deliver_availlable = False
|
||||
debug.warning("deliver-ckeck: " + base_display + " ==> MUST have a remote tracking branch")
|
||||
deliver_available = False
|
||||
|
||||
# go on destination branch
|
||||
commands.checkout(git_repo_path, destination_branch)
|
||||
@ -195,35 +158,23 @@ def deliver_check(
|
||||
# check if we are on "master"
|
||||
select_branch = commands.get_current_branch(git_repo_path)
|
||||
if select_branch != destination_branch:
|
||||
debug.warning(
|
||||
"deliver-ckeck: "
|
||||
+ base_display
|
||||
+ " ==> Can not checkout branch: '"
|
||||
+ destination_branch
|
||||
+ "' and is: '"
|
||||
+ select_branch
|
||||
+ "'"
|
||||
)
|
||||
deliver_availlable = False
|
||||
debug.warning("deliver-ckeck: " + base_display + " ==> Can not checkout branch: '" + destination_branch + "' and is: '" + select_branch + "'")
|
||||
deliver_available = False
|
||||
debug.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
|
||||
)
|
||||
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch)
|
||||
if tracking_remote_branch == None:
|
||||
debug.warning(
|
||||
"deliver-ckeck: " + base_display + " ==> MUST have a remote tracking branch"
|
||||
)
|
||||
deliver_availlable = False
|
||||
debug.warning("deliver-ckeck: " + base_display + " ==> MUST have a remote tracking branch")
|
||||
deliver_available = False
|
||||
|
||||
"""
|
||||
# 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:
|
||||
debug.warning("deliver-ckeck: " + base_display + " ==> MUST have local branch named '" + destination_branch + "'")
|
||||
deliver_availlable = False
|
||||
deliver_available = False
|
||||
# TODO: check source_branch is up to date
|
||||
|
||||
|
||||
# TODO: check the remote branch and the local branch are the same
|
||||
#sha_tracking = get_sha1_for_branch(git_repo_path, tracking_remote_branch)
|
||||
#sha_current = get_sha1_for_branch(git_repo_path, select_branch)
|
||||
@ -231,22 +182,20 @@ def deliver_check(
|
||||
|
||||
# check out back the source branch
|
||||
commands.checkout(git_repo_path, source_branch)
|
||||
return deliver_availlable
|
||||
return deliver_available
|
||||
|
||||
|
||||
def checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display):
|
||||
debug.verbose("checkout : " + base_display)
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
debug.warning("checkout " + base_display + " ==> repository does not exist ...")
|
||||
return False
|
||||
|
||||
# check if the repository is modify
|
||||
is_modify = commands.check_repository_is_modify(git_repo_path)
|
||||
if is_modify == True:
|
||||
debug.warning(
|
||||
"checkout " + base_display + " ==> modify data can not checkout new branch"
|
||||
)
|
||||
if is_modify is True:
|
||||
debug.warning("checkout " + base_display + " ==> modify data can not checkout new branch")
|
||||
return False
|
||||
|
||||
list_branch_local = commands.get_list_branch_local(git_repo_path)
|
||||
@ -256,17 +205,11 @@ def checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display):
|
||||
if branch_to_checkout == "__TAG__":
|
||||
branch_to_checkout = base_name_of_a_tagged_branch + str(elem.tag)
|
||||
is_tag = True
|
||||
if elem.volatile == True:
|
||||
debug.info(
|
||||
"checkout "
|
||||
+ base_display
|
||||
+ " ==> Can not checkout for 'volatile' repository"
|
||||
)
|
||||
if elem.volatile is True:
|
||||
debug.info("checkout " + base_display + " ==> Can not checkout for 'volatile' repository")
|
||||
return True
|
||||
if elem.tag == None:
|
||||
debug.info(
|
||||
"checkout " + base_display + " ==> Can not checkout for '''None''' Tag"
|
||||
)
|
||||
debug.info("checkout " + base_display + " ==> Can not checkout for '''None''' Tag")
|
||||
return True
|
||||
# check if we are on the good branch:
|
||||
if branch_to_checkout == select_branch:
|
||||
@ -274,20 +217,14 @@ def checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display):
|
||||
return True
|
||||
|
||||
# check if we have already checkout the branch before
|
||||
debug.verbose(
|
||||
" check : " + branch_to_checkout + " in " + str(list_branch_local)
|
||||
)
|
||||
debug.verbose(" check : " + branch_to_checkout + " in " + str(list_branch_local))
|
||||
if branch_to_checkout in list_branch_local:
|
||||
cmd = "git checkout " + branch_to_checkout
|
||||
debug.verbose("execute : " + cmd)
|
||||
ret = multiprocess.run_command(cmd, cwd=git_repo_path)
|
||||
if ret[0] != 0 and ret[1] != "" and ret != False:
|
||||
debug.info("'" + str(ret) + "'")
|
||||
debug.error(
|
||||
"checkout "
|
||||
+ base_display
|
||||
+ " ==> Can not checkout to the correct branch"
|
||||
)
|
||||
debug.error("checkout " + base_display + " ==> Can not checkout to the correct branch")
|
||||
return False
|
||||
debug.info("checkout " + base_display + " ==> switch branch")
|
||||
# TODO : Check the number of commit to the origin/XXX branch ....
|
||||
@ -301,7 +238,7 @@ def checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display):
|
||||
branch_to_checkout = base_name_of_a_tagged_branch + str(elem.tag)
|
||||
|
||||
# Check if the remote branch exist ...
|
||||
if is_tag == False:
|
||||
if is_tag is False:
|
||||
list_branch_remote = commands.get_list_branch_remote(git_repo_path)
|
||||
if elem.select_remote["name"] + "/" + branch_to_checkout in list_branch_remote:
|
||||
debug.info(" ==> find ...")
|
||||
@ -309,24 +246,13 @@ def checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display):
|
||||
debug.info("checkout " + base_display + " ==> NO remote branch")
|
||||
return True
|
||||
# checkout the new branch:
|
||||
cmd = (
|
||||
"git checkout --quiet "
|
||||
+ elem.select_remote["name"]
|
||||
+ "/"
|
||||
+ branch_to_checkout
|
||||
+ " -b "
|
||||
+ branch_to_checkout
|
||||
)
|
||||
cmd = "git checkout --quiet " + elem.select_remote["name"] + "/" + branch_to_checkout + " -b " + branch_to_checkout
|
||||
# + " --track " + elem.select_remote["name"] + "/" + branch_to_checkout
|
||||
debug.verbose("execute : " + cmd)
|
||||
ret = multiprocess.run_command(cmd, cwd=git_repo_path)
|
||||
if ret[1] != "" and ret != False:
|
||||
debug.info("'" + str(ret) + "'")
|
||||
debug.error(
|
||||
"checkout "
|
||||
+ base_display
|
||||
+ " ==> Can not checkout to the correct branch"
|
||||
)
|
||||
debug.error("checkout " + base_display + " ==> Can not checkout to the correct branch")
|
||||
return False
|
||||
debug.info("checkout " + base_display + " ==> create new branch")
|
||||
return True
|
||||
@ -343,13 +269,9 @@ def checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display):
|
||||
ret = multiprocess.run_command(cmd, cwd=git_repo_path)
|
||||
if ret[1] != "" and ret != False:
|
||||
debug.info("'" + str(ret) + "'")
|
||||
debug.error(
|
||||
"checkout " + base_display + " ==> Can not checkout to the correct tags"
|
||||
)
|
||||
debug.error("checkout " + base_display + " ==> Can not checkout to the correct tags")
|
||||
return False
|
||||
debug.info(
|
||||
"checkout " + base_display + " ==> create new branch: " + branch_to_checkout
|
||||
)
|
||||
debug.info("checkout " + base_display + " ==> create new branch: " + branch_to_checkout)
|
||||
return True
|
||||
|
||||
|
||||
@ -357,13 +279,11 @@ def get_current_version_repo(git_repo_path):
|
||||
version_path_file = os.path.join(git_repo_path, "version.txt")
|
||||
add_in_version_management = False
|
||||
version_description = None
|
||||
if os.path.exists(version_path_file) == False:
|
||||
debug.info(
|
||||
"deliver: ==> No 'version.txt' file ==> not manage release version...."
|
||||
)
|
||||
if os.path.exists(version_path_file) is False:
|
||||
debug.info("deliver: ==> No 'version.txt' file ==> not manage release version....")
|
||||
# Action to do:
|
||||
valid = False
|
||||
while valid == False:
|
||||
while valid is False:
|
||||
debug.info("Create a new version: (0.0.0)")
|
||||
debug.info(" (1) Add in managing version")
|
||||
debug.info(" (2) Do NOTHING & continue")
|
||||
@ -382,9 +302,7 @@ def get_current_version_repo(git_repo_path):
|
||||
debug.warning("An error occured for this repository")
|
||||
return (None, None)
|
||||
else:
|
||||
version_description = tools.version_string_to_list(
|
||||
tools.file_read_data(version_path_file)
|
||||
)
|
||||
version_description = tools.version_string_to_list(tools.file_read_data(version_path_file))
|
||||
return (version_description, add_in_version_management)
|
||||
|
||||
|
||||
@ -396,12 +314,8 @@ def create_new_version_repo(
|
||||
destination_branch,
|
||||
):
|
||||
# get tracking branch
|
||||
ret_destination_branch_sha1 = commands.get_revision_list_to_branch(
|
||||
git_repo_path, destination_branch
|
||||
)
|
||||
ret_source_branch_sha1 = commands.get_revision_list_to_branch(
|
||||
git_repo_path, source_branch
|
||||
)
|
||||
ret_destination_branch_sha1 = commands.get_revision_list_to_branch(git_repo_path, destination_branch)
|
||||
ret_source_branch_sha1 = commands.get_revision_list_to_branch(git_repo_path, source_branch)
|
||||
# remove all identical sha1 ==> not needed for this
|
||||
have_forward = False
|
||||
for elem_sha1 in ret_destination_branch_sha1:
|
||||
@ -409,14 +323,8 @@ def create_new_version_repo(
|
||||
message = commands.get_specific_commit_message(git_repo_path, elem_sha1)
|
||||
debug.warning("deliver: Forward commit: '" + message + "'")
|
||||
have_forward = True
|
||||
if have_forward == True:
|
||||
debug.error(
|
||||
"'"
|
||||
+ destination_branch
|
||||
+ "' branch must not be forward '"
|
||||
+ source_branch
|
||||
+ "' branch"
|
||||
)
|
||||
if have_forward is True:
|
||||
debug.error("'" + destination_branch + "' branch must not be forward '" + source_branch + "' branch")
|
||||
return None
|
||||
behind_message = ""
|
||||
behind_count = 0
|
||||
@ -425,13 +333,10 @@ def create_new_version_repo(
|
||||
message = commands.get_specific_commit_message(git_repo_path, elem_sha1)
|
||||
behind_count += 1
|
||||
behind_message = message
|
||||
if behind_count == 0 and add_in_version_management == False:
|
||||
if behind_count == 0 and add_in_version_management is False:
|
||||
debug.info("deliver: ==> Nothing to do (1).")
|
||||
return None
|
||||
if behind_count == 1 and (
|
||||
behind_message == default_behind_message
|
||||
or behind_message == default_update_message
|
||||
):
|
||||
if behind_count == 1 and (behind_message == default_behind_message or behind_message == default_update_message):
|
||||
debug.info("deliver: ==> Nothing to do (2).")
|
||||
return None
|
||||
for elem_sha1 in ret_source_branch_sha1:
|
||||
@ -440,7 +345,7 @@ def create_new_version_repo(
|
||||
debug.info("deliver: Behind commit: '" + message + "'")
|
||||
# Choice of the new version:
|
||||
valid = False
|
||||
while valid == False:
|
||||
while valid is False:
|
||||
debug.info("update version: curent: " + str(version_description))
|
||||
debug.info(" (1) Major version (change API)")
|
||||
debug.info(" (2) Medium version (add feature)")
|
||||
@ -487,113 +392,51 @@ def create_new_version_repo(
|
||||
return version_description
|
||||
|
||||
|
||||
def deliver_push(
|
||||
elem, argument_remote_name, destination_branch, source_branch, base_display
|
||||
):
|
||||
def deliver_push(elem, argument_remote_name, destination_branch, source_branch, base_display):
|
||||
# Check the repo exist
|
||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
||||
if os.path.exists(git_repo_path) == False:
|
||||
if os.path.exists(git_repo_path) is False:
|
||||
debug.warning("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:
|
||||
debug.warning(
|
||||
"deliver-push: "
|
||||
+ base_display
|
||||
+ " ==> MUST be on '"
|
||||
+ destination_branch
|
||||
+ "'"
|
||||
)
|
||||
debug.warning("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:
|
||||
debug.warning(
|
||||
"deliver-push: "
|
||||
+ base_display
|
||||
+ " ==> No '"
|
||||
+ source_branch
|
||||
+ "' (not managed)"
|
||||
)
|
||||
debug.warning("deliver-push: " + base_display + " ==> No '" + source_branch + "' (not managed)")
|
||||
return
|
||||
if destination_branch not in list_branch_local:
|
||||
debug.warning(
|
||||
"deliver-push: "
|
||||
+ base_display
|
||||
+ " ==> No '"
|
||||
+ destination_branch
|
||||
+ "' (not managed)"
|
||||
)
|
||||
debug.warning("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
|
||||
)
|
||||
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, destination_branch)
|
||||
if tracking_remote_branch == None:
|
||||
debug.warning(
|
||||
"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
|
||||
)
|
||||
debug.warning("deliver-push: " + base_display + " ==> '" + destination_branch + "' have no tracking branch")
|
||||
deliver_available = False
|
||||
sha_1_destination_tracking = commands.get_sha1_for_branch(git_repo_path, tracking_remote_branch)
|
||||
if sha_1_destination == sha_1_destination_tracking:
|
||||
debug.info(
|
||||
"deliver-push: "
|
||||
+ base_display
|
||||
+ " ==> '"
|
||||
+ destination_branch
|
||||
+ "' && '"
|
||||
+ tracking_remote_branch
|
||||
+ "' have the same sha1"
|
||||
)
|
||||
debug.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
|
||||
)
|
||||
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, source_branch)
|
||||
if tracking_remote_branch == None:
|
||||
debug.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
|
||||
)
|
||||
debug.info("deliver-push: " + base_display + " ==> '" + source_branch + "' have no tracking branch")
|
||||
deliver_available = False
|
||||
sha_1_source_tracking = commands.get_sha1_for_branch(git_repo_path, tracking_remote_branch)
|
||||
if sha_1_source == sha_1_source_tracking:
|
||||
debug.info(
|
||||
"deliver-push: "
|
||||
+ base_display
|
||||
+ " ==> '"
|
||||
+ source_branch
|
||||
+ "' && '"
|
||||
+ tracking_remote_branch
|
||||
+ "' have the same sha1"
|
||||
)
|
||||
debug.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:
|
||||
debug.info(
|
||||
"deliver-push: "
|
||||
+ base_display
|
||||
+ " ==> No tag on the current '"
|
||||
+ destination_branch
|
||||
+ "'"
|
||||
)
|
||||
debug.info("deliver-push: " + base_display + " ==> No tag on the current '" + destination_branch + "'")
|
||||
return
|
||||
if len(ret_current_tags) > 1:
|
||||
debug.info(
|
||||
@ -614,11 +457,6 @@ def deliver_push(
|
||||
if len(list_of_element_to_push) == 0:
|
||||
debug.info("deliver-push: " + base_display + " ==> Everything up-to-date")
|
||||
return
|
||||
debug.info(
|
||||
"deliver-push: "
|
||||
+ base_display
|
||||
+ " ==> element to push:"
|
||||
+ str(list_of_element_to_push)
|
||||
)
|
||||
debug.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)
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
"""Update tools.
|
||||
|
||||
@author Edouard DUPIN
|
||||
@copyright 2012, Edouard DUPIN, all right reserved
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@ -15,7 +13,7 @@ from realog import debug
|
||||
from island import env, tools
|
||||
|
||||
|
||||
## Update the links:
|
||||
# Update the links:
|
||||
def 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:
|
||||
@ -23,7 +21,7 @@ def update(configuration, mani, type_call):
|
||||
for elem in configuration.get_links():
|
||||
base_path = os.path.join(env.get_island_root_path(), elem["destination"])
|
||||
debug.info(type_call + ": link: " + str(base_path))
|
||||
if os.path.islink(base_path) == True:
|
||||
if os.path.islink(base_path) is True:
|
||||
os.unlink(base_path)
|
||||
else:
|
||||
debug.error(
|
||||
@ -37,7 +35,7 @@ def update(configuration, mani, type_call):
|
||||
base_path = os.path.join(env.get_island_root_path(), elem["destination"])
|
||||
source_path = os.path.join(env.get_island_root_path(), elem["source"])
|
||||
debug.info(type_call + ": link: " + str(base_path))
|
||||
if os.path.exists(base_path) == True:
|
||||
if os.path.exists(base_path) is True:
|
||||
debug.error(
|
||||
type_call + ": create link is not possible ==> path already exist",
|
||||
crash=False,
|
||||
|
@ -23,21 +23,16 @@ from . import (
|
||||
)
|
||||
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def check_repository_is_modify(path_repository):
|
||||
# check if the repository is modify
|
||||
cmd = "git diff --quiet"
|
||||
debug.verbose("execute : " + cmd)
|
||||
debug.verbose(f"execute : {cmd}")
|
||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||
multiprocess.generic_display_error(
|
||||
return_value,
|
||||
"check_repository_is_modify",
|
||||
error_only=True,
|
||||
availlable_return=[0, 1],
|
||||
available_return=[0, 1],
|
||||
display_if_nothing=False,
|
||||
)
|
||||
ret_diff = return_value
|
||||
@ -51,9 +46,7 @@ def get_list_branch_meta(path_repository):
|
||||
cmd = "git branch -a"
|
||||
debug.verbose("execute : " + cmd)
|
||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||
multiprocess.generic_display_error(
|
||||
return_value, "get_list_branch_meta", error_only=True
|
||||
)
|
||||
multiprocess.generic_display_error(return_value, "get_list_branch_meta", error_only=True)
|
||||
ret_branch = return_value
|
||||
list_branch = ret_branch[1].split("\n")
|
||||
out = []
|
||||
@ -91,7 +84,7 @@ def get_list_branch_local(path_repository):
|
||||
tmp = get_list_branch_meta(path_repository)
|
||||
out = []
|
||||
for elem in tmp:
|
||||
if elem["remote"] == False:
|
||||
if elem["remote"] is False:
|
||||
out.append(elem["name"])
|
||||
debug.verbose("List local branch: " + str(out))
|
||||
return out
|
||||
@ -101,7 +94,7 @@ def get_list_branch_remote(path_repository):
|
||||
tmp = get_list_branch_meta(path_repository)
|
||||
out = []
|
||||
for elem in tmp:
|
||||
if elem["remote"] == True:
|
||||
if elem["remote"] is True:
|
||||
out.append(elem["name"])
|
||||
debug.verbose("List remote branch: " + str(out))
|
||||
return out
|
||||
@ -110,7 +103,7 @@ def get_list_branch_remote(path_repository):
|
||||
def get_current_branch(path_repository):
|
||||
tmp = get_list_branch_meta(path_repository)
|
||||
for elem in tmp:
|
||||
if elem["select"] == True:
|
||||
if elem["select"] is True:
|
||||
debug.verbose("List local branch: " + str(elem["name"]))
|
||||
return elem["name"]
|
||||
debug.verbose("List local branch: None")
|
||||
@ -125,9 +118,7 @@ def get_current_tracking_branch(path_repository):
|
||||
if return_value[1] == "@{u}":
|
||||
debug.warning("in '" + path_repository + "' no tracking branch is specify")
|
||||
return None
|
||||
multiprocess.generic_display_error(
|
||||
return_value, "get_current_tracking_branch", error_only=True
|
||||
)
|
||||
multiprocess.generic_display_error(return_value, "get_current_tracking_branch", error_only=True)
|
||||
return return_value[1]
|
||||
|
||||
|
||||
@ -135,21 +126,17 @@ def get_revision_list_to_branch(path_repository, branch):
|
||||
cmd = "git rev-list " + branch
|
||||
debug.verbose("execute : " + cmd)
|
||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||
multiprocess.generic_display_error(
|
||||
return_value, "get_revision_list_to_branch", error_only=True
|
||||
)
|
||||
multiprocess.generic_display_error(return_value, "get_revision_list_to_branch", error_only=True)
|
||||
return return_value[1].split("\n")
|
||||
|
||||
|
||||
def get_specific_commit_message(path_repository, sha_1):
|
||||
if sha_1 == None or sha_1 == "":
|
||||
if sha_1 is None or sha_1 == "":
|
||||
return ""
|
||||
cmd = "git log --format=%B -n 1 " + sha_1
|
||||
debug.verbose("execute : " + cmd)
|
||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||
multiprocess.generic_display_error(
|
||||
return_value, "get_specific_commit_message", error_only=True
|
||||
)
|
||||
multiprocess.generic_display_error(return_value, "get_specific_commit_message", error_only=True)
|
||||
return return_value[1].split("\n")[0]
|
||||
|
||||
|
||||
@ -159,9 +146,7 @@ def get_sha1_for_branch(path_repository, branch_name):
|
||||
cmd = "git rev-parse " + branch_name
|
||||
debug.verbose("execute : " + cmd)
|
||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||
multiprocess.generic_display_error(
|
||||
return_value, "get_sha1_for_branch", error_only=True
|
||||
)
|
||||
multiprocess.generic_display_error(return_value, "get_sha1_for_branch", error_only=True)
|
||||
return return_value[1].split("\n")[0]
|
||||
|
||||
|
||||
@ -169,9 +154,7 @@ def get_tags_current(path_repository):
|
||||
cmd = "git tag --points-at"
|
||||
debug.verbose("execute : " + cmd)
|
||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||
multiprocess.generic_display_error(
|
||||
return_value, "get_tags_current", error_only=True
|
||||
)
|
||||
multiprocess.generic_display_error(return_value, "get_tags_current", error_only=True)
|
||||
list_tags = []
|
||||
for elem in return_value[1].split("\n"):
|
||||
if elem != "":
|
||||
@ -221,42 +204,24 @@ def get_tracking_branch(path_repository, remote_name, select_branch):
|
||||
if remote_name == "" or remote_name == None:
|
||||
return get_current_tracking_branch(path_repository)
|
||||
list_branch_remote = get_list_branch_remote(path_repository)
|
||||
debug.extreme_verbose(
|
||||
"check if exist "
|
||||
+ remote_name
|
||||
+ "/"
|
||||
+ select_branch
|
||||
+ " in "
|
||||
+ str(list_branch_remote)
|
||||
)
|
||||
debug.extreme_verbose("check if exist " + remote_name + "/" + select_branch + " in " + str(list_branch_remote))
|
||||
if remote_name + "/" + select_branch not in list_branch_remote:
|
||||
debug.debug(" ==> can not get remote branch")
|
||||
return None
|
||||
return remote_name + "/" + select_branch
|
||||
|
||||
|
||||
def merge_branch_on_master(
|
||||
path_repository, branch_name, merge_force=True, branch_destination="master"
|
||||
):
|
||||
def merge_branch_on_master(path_repository, branch_name, merge_force=True, branch_destination="master"):
|
||||
if branch_name == None or branch_name == "":
|
||||
raise "Missing branch name"
|
||||
cmd = "git merge "
|
||||
if merge_force == True:
|
||||
if merge_force is True:
|
||||
cmd += "--no-ff "
|
||||
cmd += (
|
||||
branch_name
|
||||
+ " --message \"Merge branch '"
|
||||
+ branch_name
|
||||
+ "' into '"
|
||||
+ branch_destination
|
||||
+ "'\""
|
||||
)
|
||||
cmd += branch_name + " --message \"Merge branch '" + branch_name + "' into '" + branch_destination + "'\""
|
||||
debug.verbose("execute : " + cmd)
|
||||
# TODO: check if the command work correctly
|
||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||
multiprocess.generic_display_error(
|
||||
return_value, "merge_branch_on_master", error_only=True
|
||||
)
|
||||
multiprocess.generic_display_error(return_value, "merge_branch_on_master", error_only=True)
|
||||
return return_value
|
||||
|
||||
|
||||
@ -338,7 +303,7 @@ def clone(path_repository, address, branch_name=None, origin=None):
|
||||
if path_repository != None and path_repository != "":
|
||||
cmd += " " + path_repository
|
||||
debug.verbose("execute : " + cmd)
|
||||
if os.path.exists(path_repository) == True:
|
||||
if os.path.exists(path_repository) is True:
|
||||
debug.warning("Can not clone repository path already exist")
|
||||
return False
|
||||
return_value = multiprocess.run_command(cmd)
|
||||
@ -348,7 +313,7 @@ def clone(path_repository, address, branch_name=None, origin=None):
|
||||
|
||||
def fetch(path_repository, remote_name, prune=True):
|
||||
cmd = "git fetch " + remote_name
|
||||
if prune == True:
|
||||
if prune is True:
|
||||
cmd += " --prune"
|
||||
debug.verbose("execute : " + cmd)
|
||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||
@ -360,7 +325,7 @@ def pull(path_repository, remote_name, prune=True):
|
||||
if remote_name == None or remote_name == "":
|
||||
raise "Missing remote_name"
|
||||
cmd = "git pull " + remote_name
|
||||
if prune == True:
|
||||
if prune is True:
|
||||
cmd += " --prune"
|
||||
debug.verbose("execute : " + cmd)
|
||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||
@ -404,9 +369,7 @@ def get_forward(path_repository, branch_name):
|
||||
raise "get_fast_forward: Missing branch_name"
|
||||
select_branch = get_current_branch(path_repository)
|
||||
# get tracking branch
|
||||
ret_current_branch_sha1 = get_revision_list_to_branch(
|
||||
path_repository, select_branch
|
||||
)
|
||||
ret_current_branch_sha1 = get_revision_list_to_branch(path_repository, select_branch)
|
||||
ret_track_branch_sha1 = get_revision_list_to_branch(path_repository, branch_name)
|
||||
# count the number of commit fast forward
|
||||
forward_count = 0
|
||||
@ -425,9 +388,7 @@ def get_behind(path_repository, branch_name):
|
||||
raise "get_fast_forward: Missing branch_name"
|
||||
select_branch = get_current_branch(path_repository)
|
||||
# get tracking branch
|
||||
ret_current_branch_sha1 = get_revision_list_to_branch(
|
||||
path_repository, select_branch
|
||||
)
|
||||
ret_current_branch_sha1 = get_revision_list_to_branch(path_repository, select_branch)
|
||||
ret_track_branch_sha1 = get_revision_list_to_branch(path_repository, branch_name)
|
||||
# count the number of commit behind
|
||||
behind_count = 0
|
||||
|
@ -9,15 +9,13 @@
|
||||
import copy
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
||||
# Local import
|
||||
from realog import debug
|
||||
|
||||
from . import (
|
||||
env,
|
||||
multiprocess,
|
||||
repo_config,
|
||||
tools,
|
||||
)
|
||||
@ -25,62 +23,21 @@ from . import (
|
||||
|
||||
env.get_island_path_config()
|
||||
|
||||
unique_config = None
|
||||
|
||||
|
||||
def get_unique_config():
|
||||
global unique_config
|
||||
if unique_config == None:
|
||||
unique_config = Config()
|
||||
return unique_config
|
||||
|
||||
|
||||
class Config:
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
self._repo = ""
|
||||
self._branch = "master"
|
||||
self._manifest_name = "default.xml"
|
||||
self._volatiles = []
|
||||
self._curent_link = []
|
||||
self._current_link = []
|
||||
self.load()
|
||||
|
||||
# set it deprecated at 2020/07
|
||||
def load_old(self):
|
||||
config_property = tools.file_read_data(env.get_island_path_config_old())
|
||||
element_config = config_property.split("\n")
|
||||
for line in element_config:
|
||||
if len(line) == 0 or line[0] == "#":
|
||||
# simple comment line ==> pass
|
||||
pass
|
||||
elif line[:5] == "repo=":
|
||||
self._repo = line[5:]
|
||||
elif line[:7] == "branch=":
|
||||
self._branch = line[7:]
|
||||
elif line[:5] == "file=":
|
||||
self._manifest_name = line[5:]
|
||||
else:
|
||||
debug.warning("island config error: can not parse: '" + str(line) + "'")
|
||||
return True
|
||||
|
||||
def convert_config_file(self):
|
||||
debug.warning(
|
||||
"INTERNAL: Convert your configuration file: "
|
||||
+ str(env.get_island_path_config_old())
|
||||
+ " -> "
|
||||
+ str(env.get_island_path_config())
|
||||
)
|
||||
self.load_old()
|
||||
self.store()
|
||||
tools.remove_file(env.get_island_path_config_old())
|
||||
|
||||
def load(self):
|
||||
# transform the old format of configuration (use json now ==> simple
|
||||
if os.path.exists(env.get_island_path_config_old()) == True:
|
||||
self.convert_config_file()
|
||||
if os.path.exists(env.get_island_path_config()) == False:
|
||||
def load(self) -> bool:
|
||||
if os.path.exists(env.get_island_path_config()) is False:
|
||||
return True
|
||||
self._volatiles = []
|
||||
self._curent_link = []
|
||||
self._current_link = []
|
||||
with open(env.get_island_path_config()) as json_file:
|
||||
data = json.load(json_file)
|
||||
if "repo" in data.keys():
|
||||
@ -100,13 +57,13 @@ class Config:
|
||||
return True
|
||||
return False
|
||||
|
||||
def store(self):
|
||||
def store(self) -> bool:
|
||||
data = {}
|
||||
data["repo"] = self._repo
|
||||
data["branch"] = self._branch
|
||||
data["manifest_name"] = self._manifest_name
|
||||
data["volatiles"] = self._volatiles
|
||||
data["link"] = self._curent_link
|
||||
data["link"] = self._current_link
|
||||
with open(env.get_island_path_config(), "w") as outfile:
|
||||
json.dump(data, outfile, indent=4)
|
||||
return True
|
||||
@ -145,36 +102,34 @@ class Config:
|
||||
return copy.deepcopy(self._volatiles)
|
||||
|
||||
def get_links(self):
|
||||
return self._curent_link
|
||||
return self._current_link
|
||||
|
||||
def add_link(self, source, destination):
|
||||
for elem in self._curent_link:
|
||||
def add_link(self, source, destination) -> bool:
|
||||
for elem in self._current_link:
|
||||
if elem["destination"] == destination:
|
||||
debug.error(
|
||||
"can not have multiple destination folder in link " + destination,
|
||||
crash=False,
|
||||
)
|
||||
return False
|
||||
self._curent_link.append({"source": source, "destination": destination})
|
||||
self._current_link.append({"source": source, "destination": destination})
|
||||
return True
|
||||
|
||||
def remove_link(self, destination):
|
||||
for elem in self._curent_link:
|
||||
def remove_link(self, destination) -> None:
|
||||
for elem in self._current_link:
|
||||
if elem["destination"] == destination:
|
||||
del self._curent_link[elem]
|
||||
del self._current_link[elem]
|
||||
return
|
||||
debug.warning("Request remove link that does not exist")
|
||||
|
||||
def clear_links(self):
|
||||
self._curent_link = []
|
||||
self._current_link = []
|
||||
|
||||
def get_manifest_config(self):
|
||||
conf = repo_config.RepoConfig()
|
||||
base_volatile, repo_volatile = repo_config.split_repo(self.get_manifest())
|
||||
conf.name = repo_volatile
|
||||
conf.path = os.path.join(
|
||||
"." + env.get_system_base_name(), "manifest"
|
||||
) # env.get_island_path_manifest()
|
||||
conf.path = os.path.join("." + env.get_system_base_name(), "manifest") # env.get_island_path_manifest()
|
||||
conf.branch = "master"
|
||||
conf.volatile = False
|
||||
conf.remotes = [{"name": "origin", "fetch": base_volatile, "mirror": []}]
|
||||
@ -185,3 +140,13 @@ class Config:
|
||||
"mirror": [],
|
||||
}
|
||||
return conf
|
||||
|
||||
|
||||
_unique_config: Optional[Config] = None
|
||||
|
||||
|
||||
def get_unique_config() -> Config:
|
||||
global _unique_config
|
||||
if _unique_config is None:
|
||||
_unique_config = Config()
|
||||
return _unique_config
|
||||
|
@ -96,28 +96,18 @@ def get_display_folder_instead_of_git_name():
|
||||
|
||||
|
||||
island_root_path = os.path.join(os.getcwd())
|
||||
if os.path.exists(os.path.join(island_root_path, "." + get_system_base_name())) == True:
|
||||
if os.path.exists(os.path.join(island_root_path, "." + get_system_base_name())) is True:
|
||||
# all is good ...
|
||||
pass
|
||||
elif os.path.exists(os.path.join(island_root_path, "..", "." + get_system_base_name())):
|
||||
island_root_path = os.path.join(os.getcwd(), "..")
|
||||
elif os.path.exists(
|
||||
os.path.join(island_root_path, "..", "..", "." + get_system_base_name())
|
||||
):
|
||||
elif os.path.exists(os.path.join(island_root_path, "..", "..", "." + get_system_base_name())):
|
||||
island_root_path = os.path.join(os.getcwd(), "..", "..")
|
||||
elif os.path.exists(
|
||||
os.path.join(island_root_path, "..", "..", "..", "." + get_system_base_name())
|
||||
):
|
||||
elif os.path.exists(os.path.join(island_root_path, "..", "..", "..", "." + get_system_base_name())):
|
||||
island_root_path = os.path.join(os.getcwd(), "..", "..", "..")
|
||||
elif os.path.exists(
|
||||
os.path.join(island_root_path, "..", "..", "..", "..", "." + get_system_base_name())
|
||||
):
|
||||
elif os.path.exists(os.path.join(island_root_path, "..", "..", "..", "..", "." + get_system_base_name())):
|
||||
island_root_path = os.path.join(os.getcwd(), "..", "..", "..", "..")
|
||||
elif os.path.exists(
|
||||
os.path.join(
|
||||
island_root_path, "..", "..", "..", "..", "..", "." + get_system_base_name()
|
||||
)
|
||||
):
|
||||
elif os.path.exists(os.path.join(island_root_path, "..", "..", "..", "..", "..", "." + get_system_base_name())):
|
||||
island_root_path = os.path.join(os.getcwd(), "..", "..", "..", "..", "..")
|
||||
elif os.path.exists(
|
||||
os.path.join(
|
||||
@ -137,41 +127,35 @@ else:
|
||||
pass
|
||||
island_path_user_config = os.path.join(island_root_path, get_system_config_name())
|
||||
island_path = os.path.join(island_root_path, "." + get_system_base_name())
|
||||
island_path_config_old = os.path.join(island_path, "config.txt")
|
||||
island_path_config = os.path.join(island_path, "config.json")
|
||||
island_path_manifest = os.path.join(island_path, "manifest")
|
||||
|
||||
|
||||
##
|
||||
## @brief to use later to know where the ".island" parent path is ...
|
||||
## @return the parent path of the ".island"
|
||||
##
|
||||
def get_island_root_path():
|
||||
def get_island_root_path() -> str:
|
||||
"""Get the parent path where is define ".island" folder.
|
||||
|
||||
:return: the parent path of the ".island"
|
||||
"""
|
||||
global island_root_path
|
||||
return island_root_path
|
||||
|
||||
|
||||
def get_island_path():
|
||||
def get_island_path() -> str:
|
||||
global island_path
|
||||
return island_path
|
||||
|
||||
|
||||
def get_island_path_config():
|
||||
def get_island_path_config() -> str:
|
||||
global island_path_config
|
||||
return island_path_config
|
||||
|
||||
|
||||
def get_island_path_config_old():
|
||||
global island_path_config_old
|
||||
return island_path_config_old
|
||||
|
||||
|
||||
def get_island_path_manifest():
|
||||
def get_island_path_manifest() -> str:
|
||||
global island_path_manifest
|
||||
return island_path_manifest
|
||||
|
||||
|
||||
def get_island_path_user_config():
|
||||
def get_island_path_user_config() -> str:
|
||||
global island_path_user_config
|
||||
return island_path_user_config
|
||||
|
||||
@ -183,4 +167,4 @@ ret_action_wrong_parameters = -12
|
||||
ret_action_partial_done = -13
|
||||
ret_action_fail = -14
|
||||
|
||||
ret_action_need_updtate = 15
|
||||
ret_action_need_update = 15
|
||||
|
@ -7,13 +7,10 @@
|
||||
@license MPL v2.0 (see license file)
|
||||
"""
|
||||
import platform
|
||||
import sys
|
||||
|
||||
# Local import
|
||||
from realog import debug
|
||||
|
||||
|
||||
# print os.name # ==> 'posix'
|
||||
if platform.system() == "Linux":
|
||||
OS = "Linux"
|
||||
elif platform.system() == "Windows":
|
||||
@ -21,6 +18,6 @@ elif platform.system() == "Windows":
|
||||
elif platform.system() == "Darwin":
|
||||
OS = "MacOs"
|
||||
else:
|
||||
debug.error("Unknow the Host OS ... '" + platform.system() + "'")
|
||||
debug.error(f"Unknown the Host OS ... '{platform.system()}'")
|
||||
|
||||
debug.debug("host.OS = " + OS)
|
||||
debug.debug("host.OS = {OS}")
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import copy
|
||||
import os
|
||||
from typing import List, Dict
|
||||
|
||||
from lxml import etree
|
||||
|
||||
@ -18,37 +19,20 @@ from realog import debug
|
||||
from . import (
|
||||
config,
|
||||
env,
|
||||
link_config,
|
||||
multiprocess,
|
||||
repo_config,
|
||||
tools,
|
||||
)
|
||||
|
||||
|
||||
def is_lutin_init():
|
||||
if os.path.exists(env.get_island_path()) == False:
|
||||
debug.verbose(
|
||||
"Lutin is not init: path does not exist: '" + env.get_island_path() + "'"
|
||||
)
|
||||
if os.path.exists(env.get_island_path()) is False:
|
||||
debug.verbose(f"Island is not init: path does not exist: '{env.get_island_path()}'")
|
||||
return False
|
||||
if (
|
||||
os.path.exists(env.get_island_path_config()) == False
|
||||
and os.path.exists(env.get_island_path_config_old()) == False
|
||||
):
|
||||
debug.verbose(
|
||||
"Lutin is not init: config does not exist: '"
|
||||
+ env.get_island_path_config()
|
||||
+ "' or '"
|
||||
+ env.get_island_path_config_old()
|
||||
+ "'"
|
||||
)
|
||||
if os.path.exists(env.get_island_path_config()) is False and os.path.exists(env.get_island_path_config_old()) is False:
|
||||
debug.verbose(f"Island is not init: config does not exist: '{env.get_island_path_config()}' or '{env.get_island_path_config_old()}'")
|
||||
return False
|
||||
if os.path.exists(env.get_island_path_manifest()) == False:
|
||||
debug.verbose(
|
||||
"Lutin is not init: Manifest does not exist: '"
|
||||
+ env.get_island_path_manifest()
|
||||
+ "'"
|
||||
)
|
||||
if os.path.exists(env.get_island_path_manifest()) is False:
|
||||
debug.verbose(f"Island is not init: Manifest does not exist: '{env.get_island_path_manifest()}'")
|
||||
return False
|
||||
return True
|
||||
|
||||
@ -56,27 +40,23 @@ def is_lutin_init():
|
||||
def check_lutin_is_init():
|
||||
# check if .XXX exist (create it if needed)
|
||||
if not is_lutin_init():
|
||||
debug.error(
|
||||
"System not init: missing config: '"
|
||||
+ str(env.get_island_path())
|
||||
+ "'. Call <island init> first"
|
||||
)
|
||||
debug.error(f"System not init: missing config: '{env.get_island_path()}'. Call <island init> first")
|
||||
exit(-1)
|
||||
|
||||
|
||||
class Manifest:
|
||||
def __init__(self, manifest_xml: str) -> None:
|
||||
self.manifest_xml = manifest_xml
|
||||
self.projects = []
|
||||
self.projects: List[Dict] = []
|
||||
self.default = None
|
||||
self.default_base = {
|
||||
"remote": "origin",
|
||||
"revision": "master",
|
||||
"sync": False,
|
||||
}
|
||||
self.remotes = []
|
||||
self.includes = []
|
||||
self.links = []
|
||||
self.remotes: List[Dict] = []
|
||||
self.includes: List[Dict] = []
|
||||
self.links: List[Dict] = []
|
||||
self.deliver_master = "master"
|
||||
self.deliver_develop = "develop"
|
||||
self.deliver_mode = "merge"
|
||||
@ -89,22 +69,14 @@ class Manifest:
|
||||
return self.links
|
||||
|
||||
def _load(self):
|
||||
debug.debug("manifest : '" + self.manifest_xml + "'")
|
||||
debug.debug("manifest : '{self.manifest_xml}'")
|
||||
tree = etree.parse(self.manifest_xml)
|
||||
root = tree.getroot()
|
||||
if root.tag != "manifest":
|
||||
debug.error(
|
||||
f"(l:{child.sourceline}) in '{file}' have not main xml node='manifest'"
|
||||
)
|
||||
debug.error(f"(l:{child.sourceline}) in '{file}' have not main xml node='manifest'")
|
||||
for child in root:
|
||||
if type(child) == etree._Comment:
|
||||
debug.verbose(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") comment='"
|
||||
+ str(child.text)
|
||||
+ "'"
|
||||
)
|
||||
debug.verbose(f"(l:{child.sourceline}) comment='{child.text}'")
|
||||
continue
|
||||
if child.tag == "remote":
|
||||
name = "origin"
|
||||
@ -117,17 +89,13 @@ class Manifest:
|
||||
if len(fetch) >= 2 and fetch[:2] == "..":
|
||||
# we have a relative island manifest ==> use local manifest origin to get the full origin
|
||||
cmd = "git remote get-url origin"
|
||||
debug.verbose("execute : " + cmd)
|
||||
base_origin = multiprocess.run_command(
|
||||
cmd, cwd=env.get_island_path_manifest()
|
||||
)
|
||||
debug.verbose("base_origin=" + base_origin[1])
|
||||
debug.verbose(f"execute : {cmd}")
|
||||
base_origin = multiprocess.run_command(cmd, cwd=env.get_island_path_manifest())
|
||||
debug.verbose(f"base_origin={base_origin[1]}")
|
||||
base_origin = base_origin[1]
|
||||
while len(fetch) >= 2 and fetch[:2] == "..":
|
||||
fetch = fetch[2:]
|
||||
while len(fetch) >= 1 and (
|
||||
fetch[0] == "/" or fetch[0] == "\\"
|
||||
):
|
||||
while len(fetch) >= 1 and (fetch[0] == "/" or fetch[0] == "\\"):
|
||||
fetch = fetch[1:]
|
||||
offset_1 = base_origin.rfind("/")
|
||||
offset_2 = base_origin.rfind(":")
|
||||
@ -135,24 +103,20 @@ class Manifest:
|
||||
base_origin = base_origin[:offset_1]
|
||||
else:
|
||||
base_origin = base_origin[:offset_2]
|
||||
debug.verbose("new base_origin=" + base_origin)
|
||||
debug.verbose("tmp fetch=" + fetch)
|
||||
debug.verbose(f"new base_origin={base_origin}")
|
||||
debug.verbose(f"tmp fetch={fetch}")
|
||||
if fetch != "":
|
||||
fetch = base_origin + "/" + fetch
|
||||
fetch = f"{base_origin}/{fetch}"
|
||||
else:
|
||||
fetch = base_origin
|
||||
debug.verbose("new fetch=" + fetch)
|
||||
while len(fetch) > 1 and (
|
||||
fetch[-1] == "\\" or fetch[-1] == "/"
|
||||
):
|
||||
debug.verbose(f"new fetch={fetch}")
|
||||
while len(fetch) > 1 and (fetch[-1] == "\\" or fetch[-1] == "/"):
|
||||
fetch = fetch[:-1]
|
||||
else:
|
||||
debug.error(
|
||||
f"(l:{child.sourceline}) Parsing the manifest : Unknown '{child.tag}' attribute : '{attr}', available:[name,fetch]"
|
||||
f"(l:{child.sourceline}) Parsing the manifest : unknown '{child.tag}' attribute : '{attr}', available:[name,fetch]"
|
||||
)
|
||||
debug.debug(
|
||||
f"(l:{child.sourceline}) find '{child.tag}' : name='{name}' fetch='{fetch}'"
|
||||
)
|
||||
debug.debug(f"(l:{child.sourceline}) find '{child.tag}' : name='{name}' fetch='{fetch}'")
|
||||
# parse the sub global mirror list
|
||||
mirror_list = []
|
||||
for child_2 in child:
|
||||
@ -165,35 +129,17 @@ class Manifest:
|
||||
mirror_name = child_2.attrib[attr_2]
|
||||
elif attr_2 == "fetch":
|
||||
mirror_fetch = child_2.attrib[attr_2]
|
||||
while len(mirror_fetch) > 1 and (
|
||||
mirror_fetch[-1] == "\\" or mirror_fetch[-1] == "/"
|
||||
):
|
||||
while len(mirror_fetch) > 1 and (mirror_fetch[-1] == "\\" or mirror_fetch[-1] == "/"):
|
||||
mirror_fetch = mirror_fetch[:-1]
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child_2.sourceline)
|
||||
+ ") Parsing the manifest : Unknow '"
|
||||
+ child_2.tag
|
||||
+ "' attibute : '"
|
||||
+ attr_2
|
||||
+ "', availlable:[name,fetch]"
|
||||
f"(l:{child_2.sourceline}) Parsing the manifest : unknown '{child_2.tag}' attribute : '{attr_2}', available:[name,fetch]"
|
||||
)
|
||||
debug.debug(
|
||||
"mirror: '" + mirror_name + "' '" + mirror_fetch + "'"
|
||||
)
|
||||
debug.debug(f"mirror: '{mirror_name}' '{mirror_fetch}'")
|
||||
if mirror_name == "":
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child_2.sourceline)
|
||||
+ ") Missing mirrot 'name'"
|
||||
)
|
||||
debug.error(f"(l:{child_2.sourceline}) Missing mirror 'name'")
|
||||
if mirror_fetch == "":
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child_2.sourceline)
|
||||
+ ") Missing mirror 'fetch'"
|
||||
)
|
||||
debug.error(f"(l:{child_2.sourceline}) Missing mirror 'fetch'")
|
||||
mirror_list.append(
|
||||
{
|
||||
"name": mirror_name,
|
||||
@ -201,16 +147,8 @@ class Manifest:
|
||||
}
|
||||
)
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child_2.sourceline)
|
||||
+ ") Parsing the manifest : Unknow '"
|
||||
+ child_2.tag
|
||||
+ "', availlable:[mirror]"
|
||||
)
|
||||
self.remotes.append(
|
||||
{"name": name, "fetch": fetch, "mirror": mirror_list}
|
||||
)
|
||||
debug.error(f"(l:{child_2.sourceline}) Parsing the manifest : unknown '{child_2.tag}', available:[mirror]")
|
||||
self.remotes.append({"name": name, "fetch": fetch, "mirror": mirror_list})
|
||||
continue
|
||||
|
||||
if child.tag == "include":
|
||||
@ -219,37 +157,13 @@ class Manifest:
|
||||
if attr == "name":
|
||||
name = child.attrib[attr]
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest : Unknow '"
|
||||
+ child.tag
|
||||
+ "' attibute : '"
|
||||
+ attr
|
||||
+ "', availlable:[name]"
|
||||
)
|
||||
debug.debug(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") find '"
|
||||
+ child.tag
|
||||
+ "' : name='"
|
||||
+ name
|
||||
+ "'"
|
||||
)
|
||||
debug.error(f"(l:{child.sourceline}) Parsing the manifest : unknown '{child.tag}' attribute : '{attr}', available:[name]")
|
||||
debug.debug(f"(l:{child.sourceline}) find '{child.tag}' : name='{name}'")
|
||||
# check if the file exist ...
|
||||
new_name_xml = os.path.join(os.path.dirname(self.manifest_xml), name)
|
||||
if os.path.exists(new_name_xml) == False:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") The file does not exist : '"
|
||||
+ new_name_xml
|
||||
+ "'"
|
||||
)
|
||||
self.includes.append(
|
||||
{"name": name, "path": new_name_xml, "manifest": None}
|
||||
)
|
||||
if os.path.exists(new_name_xml) is False:
|
||||
debug.error(f"(l:{child.sourceline}) The file does not exist : '{new_name_xml}'")
|
||||
self.includes.append({"name": name, "path": new_name_xml, "manifest": None})
|
||||
continue
|
||||
if child.tag == "default":
|
||||
remote = "origin"
|
||||
@ -262,65 +176,26 @@ class Manifest:
|
||||
revision = child.attrib[attr]
|
||||
elif attr == "sync-s": # synchronize submodule ... automaticaly
|
||||
sync = child.attrib[attr]
|
||||
if (
|
||||
sync.lower() == "true"
|
||||
or sync == "1"
|
||||
or sync.lower() == "yes"
|
||||
):
|
||||
if sync.lower() == "true" or sync == "1" or sync.lower() == "yes":
|
||||
sync = True
|
||||
elif (
|
||||
sync.lower() == "false"
|
||||
or sync == "0"
|
||||
or sync.lower() == "no"
|
||||
):
|
||||
elif sync.lower() == "false" or sync == "0" or sync.lower() == "no":
|
||||
sync = False
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest : Unknow '"
|
||||
+ child.tag
|
||||
+ "' attbute : '"
|
||||
+ attr
|
||||
+ "', value:'"
|
||||
+ sync
|
||||
+ "' availlable:[true,1,yes,false,0,no]"
|
||||
f"(l:{child.sourceline}) Parsing the manifest : unknown '{child.tag}' attribute : '{attr}', value:'{sync}' available:[true,1,yes,false,0,no]"
|
||||
)
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest : Unknow '"
|
||||
+ child.tag
|
||||
+ "' attibute : '"
|
||||
+ attr
|
||||
+ "', availlable:[remote,revision,sync-s]"
|
||||
f"(l:{child.sourceline}) Parsing the manifest : unknown '{child.tag}' attribute : '{attr}', available:[remote,revision,sync-s]"
|
||||
)
|
||||
if self.default != None:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest : Node '"
|
||||
+ child.tag
|
||||
+ "' already set"
|
||||
)
|
||||
debug.error(f"(l:{child.sourceline}) Parsing the manifest : Node '{child.tag}' already set")
|
||||
self.default = {
|
||||
"remote": remote,
|
||||
"revision": revision,
|
||||
"sync": sync,
|
||||
}
|
||||
debug.debug(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") find '"
|
||||
+ child.tag
|
||||
+ "' : remote='"
|
||||
+ remote
|
||||
+ "' revision='"
|
||||
+ revision
|
||||
+ "' sync="
|
||||
+ str(sync)
|
||||
)
|
||||
debug.debug(f"(l:{child.sourceline}) find '{child.tag}' : remote='{remote}' revision='{revision}' sync={sync}")
|
||||
continue
|
||||
if child.tag == "project":
|
||||
name = ""
|
||||
@ -335,21 +210,11 @@ class Manifest:
|
||||
tag_sha1 = child.attrib[attr]
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: Unknow '"
|
||||
+ child.tag
|
||||
+ "' attibute : '"
|
||||
+ attr
|
||||
+ "', availlable:[name,tag,sync-s]"
|
||||
f"(l:{child.sourceline}) Parsing the manifest: unknown '{child.tag}' attribute : '{attr}', available:[name,tag,sync-s]"
|
||||
)
|
||||
if name == "":
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: '"
|
||||
+ child.tag
|
||||
+ "' missing attribute: 'name' ==> specify the git to clone ..."
|
||||
f"(l:{child.sourceline}) Parsing the manifest: '{child.tag}' missing attribute: 'name' ==> specify the git to clone ..."
|
||||
)
|
||||
self.projects.append(
|
||||
{
|
||||
@ -358,19 +223,7 @@ class Manifest:
|
||||
"tag": tag_sha1,
|
||||
}
|
||||
)
|
||||
debug.debug(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") find '"
|
||||
+ child.tag
|
||||
+ "' : name='"
|
||||
+ name
|
||||
+ "' path='"
|
||||
+ path
|
||||
+ "' tag='"
|
||||
+ str(tag_sha1)
|
||||
+ "'"
|
||||
)
|
||||
debug.debug(f"(l:{child.sourceline}) find '{child.tag}' : name='{name}' path='{path}' tag='{str(tag_sha1)}'")
|
||||
continue
|
||||
if child.tag == "option":
|
||||
# not managed ==> future use
|
||||
@ -383,13 +236,7 @@ class Manifest:
|
||||
value_option = child.attrib[attr]
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: Unknow '"
|
||||
+ child.tag
|
||||
+ "' attibute : '"
|
||||
+ attr
|
||||
+ "', availlable:[type,value]"
|
||||
f"(l:{child.sourceline}) Parsing the manifest: unknown '{child.tag}' attribute : '{attr}', available:[type,value]"
|
||||
)
|
||||
if type_option == "deliver_master":
|
||||
self.deliver_master = value_option
|
||||
@ -398,16 +245,10 @@ class Manifest:
|
||||
elif type_option == "deliver_mode":
|
||||
self.deliver_mode = value_option
|
||||
if self.deliver_mode not in ["merge", "fast_forward"]:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: option 'deliver_mode' value availlable: [merge,fast_forward]"
|
||||
)
|
||||
debug.error(f"(l:{child.sourceline}) Parsing the manifest: option 'deliver_mode' value available: [merge,fast_forward]")
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: Unknow 'type' value availlable: [deliver_master,deliver_develop,deliver_mode]"
|
||||
f"(l:{child.sourceline}) Parsing the manifest: unknown 'type' value available: [deliver_master,deliver_develop,deliver_mode]"
|
||||
)
|
||||
continue
|
||||
if child.tag == "link":
|
||||
@ -421,29 +262,15 @@ class Manifest:
|
||||
destination = child.attrib[attr]
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: Unknow '"
|
||||
+ child.tag
|
||||
+ "' attibute : '"
|
||||
+ attr
|
||||
+ "', availlable:[source,destination]"
|
||||
f"(l:{child.sourceline}) Parsing the manifest: unknown '{child.tag}' attribute : '{attr}', available:[source,destination]"
|
||||
)
|
||||
if source == "":
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: '"
|
||||
+ child.tag
|
||||
+ "' missing attribute: 'source' ==> specify the git to clone ..."
|
||||
f"(l:{child.sourceline}) Parsing the manifest: '{child.tag}' missing attribute: 'source' ==> specify the git to clone."
|
||||
)
|
||||
if destination == "":
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: '"
|
||||
+ child.tag
|
||||
+ "' missing attribute: 'destination' ==> specify the git to clone ..."
|
||||
f"(l:{child.sourceline}) Parsing the manifest: '{child.tag}' missing attribute: 'destination' ==> specify the git to clone."
|
||||
)
|
||||
self.links.append(
|
||||
{
|
||||
@ -451,25 +278,10 @@ class Manifest:
|
||||
"destination": destination,
|
||||
}
|
||||
)
|
||||
debug.debug(
|
||||
"Add link: '" + str(destination) + "' ==> '" + str(source) + "'"
|
||||
)
|
||||
debug.debug(f"Add link: '{destination}' ==> '{source}'")
|
||||
continue
|
||||
debug.info(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") '"
|
||||
+ str(child.tag)
|
||||
+ "' values="
|
||||
+ str(child.attrib)
|
||||
)
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing error Unknow NODE : '"
|
||||
+ str(child.tag)
|
||||
+ "' availlable:[remote,include,default,project,option,link]"
|
||||
)
|
||||
debug.info(f"(l:{child.sourceline}) '{child.tag}' values={child.attrib}")
|
||||
debug.error(f"(l:{child.sourceline}) Parsing error unknown NODE : '{child.tag}' available:[remote,include,default,project,option,link]")
|
||||
# now we parse all sub repo:
|
||||
for elem in self.includes:
|
||||
elem["manifest"] = Manifest(elem["path"])
|
||||
@ -485,14 +297,12 @@ class Manifest:
|
||||
return path
|
||||
|
||||
def _check_double_path(self, list_path=[], space=""):
|
||||
debug.debug(space + "check path : '" + self.manifest_xml + "'")
|
||||
debug.debug(f"{space}check path : '{self.manifest_xml}'")
|
||||
for elem in self.projects:
|
||||
path = self._create_path_with_elem(elem)
|
||||
debug.debug(space + " check path:'" + str(path) + "'")
|
||||
debug.debug(f"{space} check path:'{path}'")
|
||||
if path in list_path:
|
||||
debug.error(
|
||||
"Check Manifest error : double use of the path '" + str(path) + "'"
|
||||
)
|
||||
debug.error(f"Check Manifest error : double use of the path '{path}'")
|
||||
list_path.append(path)
|
||||
for elem in self.includes:
|
||||
elem["manifest"]._check_double_path(list_path, space + " ")
|
||||
@ -504,59 +314,50 @@ class Manifest:
|
||||
default = copy.deepcopy(self.default)
|
||||
else:
|
||||
default = copy.deepcopy(self.default_base)
|
||||
# debug.error(" self.default=" + str(self.default))
|
||||
# debug.error(f" self.default={self.default}")
|
||||
# add all local project
|
||||
for elem in self.projects:
|
||||
debug.verbose("parse element " + str(elem))
|
||||
if env.need_process_with_filter(elem["name"]) == False:
|
||||
debug.info("Filter repository: " + str(elem["name"]))
|
||||
debug.verbose(f"parse element {elem}")
|
||||
if env.need_process_with_filter(elem["name"]) is False:
|
||||
debug.info(f"Filter repository: {elem['name']}")
|
||||
continue
|
||||
conf = repo_config.RepoConfig()
|
||||
conf.name = elem["name"]
|
||||
conf.tag = elem["tag"]
|
||||
conf.path = self._create_path_with_elem(elem)
|
||||
|
||||
# add default remote for the project (search in herited element)
|
||||
# add default remote for the project (search in inherited element)
|
||||
for remote in self.remotes:
|
||||
debug.verbose(" Local Remote: " + str(remote))
|
||||
debug.verbose(f" Local Remote: {remote}")
|
||||
if remote["name"] == default["remote"]:
|
||||
conf.remotes.append(remote)
|
||||
if len(conf.remotes) == 0:
|
||||
for remote in upper_remotes:
|
||||
debug.verbose(" upper Remote: " + str(remote))
|
||||
debug.verbose(f" upper Remote: {remote}")
|
||||
if remote["name"] == default["remote"]:
|
||||
conf.remotes.append(remote)
|
||||
if len(conf.remotes) == 0:
|
||||
debug.error(
|
||||
" No remote detected: "
|
||||
+ str(len(conf.remotes))
|
||||
+ " for "
|
||||
+ conf.name
|
||||
+ " with default remote name : "
|
||||
+ default["remote"]
|
||||
+ " self remote: "
|
||||
+ str(self.remotes)
|
||||
f" No remote detected: {len(conf.remotes)} for {conf.name} with default remote name : {default['remote']} self remote: {self.remotes}"
|
||||
)
|
||||
|
||||
# select default remote:
|
||||
conf.select_remote = None
|
||||
debug.debug(" remotes count: " + str(len(conf.remotes)))
|
||||
debug.debug(f" remotes count: {len(conf.remotes)}")
|
||||
for remote in conf.remotes:
|
||||
debug.debug(" remote=" + str(remote))
|
||||
debug.debug(
|
||||
f" Check remote : {remote['name']} == {default['remote']}"
|
||||
)
|
||||
debug.verbose(" remote=" + str(remote))
|
||||
debug.verbose(" default=" + str(default))
|
||||
debug.debug(f" remote={remote}")
|
||||
debug.debug(f" Check remote : {remote['name']} == {default['remote']}")
|
||||
debug.verbose(f" remote={remote}")
|
||||
debug.verbose(f" default={default}")
|
||||
if remote["name"] == default["remote"]:
|
||||
conf.select_remote = copy.deepcopy(remote)
|
||||
debug.debug(" copy select=" + str(conf.select_remote))
|
||||
debug.debug(f" copy select={conf.select_remote}")
|
||||
|
||||
# copy the submodule synchronization
|
||||
conf.select_remote["sync"] = default["sync"]
|
||||
break
|
||||
if conf.select_remote == None:
|
||||
debug.error("missing remote for project: " + str(conf.name))
|
||||
debug.error(f"missing remote for project: {conf.name}")
|
||||
|
||||
conf.branch = default["revision"]
|
||||
out.append(conf)
|
||||
@ -566,15 +367,13 @@ class Manifest:
|
||||
upper_remotes_forward.append(remote)
|
||||
# add all include project
|
||||
for elem in self.includes:
|
||||
list_project = elem["manifest"].get_all_configs(
|
||||
default, upper_remotes_forward
|
||||
)
|
||||
list_project = elem["manifest"].get_all_configs(default, upper_remotes_forward)
|
||||
for elem_proj in list_project:
|
||||
out.append(elem_proj)
|
||||
|
||||
## -------------------------------------------------------------
|
||||
## -- add Volatile ...
|
||||
## -------------------------------------------------------------
|
||||
# -------------------------------------------------------------
|
||||
# -- add Volatile ...
|
||||
# -------------------------------------------------------------
|
||||
debug.verbose("include volatile config")
|
||||
# TODO: maybe find a better way to do this...
|
||||
conf_global = config.get_unique_config()
|
||||
@ -593,7 +392,7 @@ class Manifest:
|
||||
"mirror": [],
|
||||
}
|
||||
out.append(conf)
|
||||
## -------------------------------------------------------------
|
||||
# -------------------------------------------------------------
|
||||
if False:
|
||||
debug.info("list of all repo:")
|
||||
for elem in out:
|
||||
@ -607,27 +406,15 @@ class Manifest:
|
||||
|
||||
def tag_manifest(manifest_xml_filename, all_tags):
|
||||
tree = etree.parse(manifest_xml_filename)
|
||||
debug.debug("manifest : '" + manifest_xml_filename + "'")
|
||||
debug.debug(f"manifest : '{manifest_xml_filename}'")
|
||||
root = tree.getroot()
|
||||
includes = []
|
||||
if root.tag != "manifest":
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") in '"
|
||||
+ str(file)
|
||||
+ "' have not main xml node='manifest'"
|
||||
)
|
||||
debug.error(f"(l:{child.sourceline}) in '{file}' have not main xml node='manifest'")
|
||||
return False
|
||||
for child in root:
|
||||
if type(child) == etree._Comment:
|
||||
debug.verbose(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") comment='"
|
||||
+ str(child.text)
|
||||
+ "'"
|
||||
)
|
||||
debug.verbose(f"(l:{child.sourceline}) comment='{child.text}'")
|
||||
continue
|
||||
if child.tag == "remote":
|
||||
continue
|
||||
@ -637,34 +424,12 @@ def tag_manifest(manifest_xml_filename, all_tags):
|
||||
if attr == "name":
|
||||
name = child.attrib[attr]
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest : Unknow '"
|
||||
+ child.tag
|
||||
+ "' attibute : '"
|
||||
+ attr
|
||||
+ "', availlable:[name]"
|
||||
)
|
||||
debug.debug(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") find '"
|
||||
+ child.tag
|
||||
+ "' : name='"
|
||||
+ name
|
||||
+ "'"
|
||||
)
|
||||
debug.error(f"(l:{child.sourceline}) Parsing the manifest : unknown '{child.tag}' attribute : '{attr}', available:[name]")
|
||||
debug.debug(f"(l:{child.sourceline}) find '{child.tag}' : name='{name}'")
|
||||
# check if the file exist ...
|
||||
new_name_xml = os.path.join(os.path.dirname(manifest_xml_filename), name)
|
||||
if os.path.exists(new_name_xml) == False:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") The file does not exist : '"
|
||||
+ new_name_xml
|
||||
+ "'"
|
||||
)
|
||||
if os.path.exists(new_name_xml) is False:
|
||||
debug.error(f"(l:{child.sourceline}) The file does not exist : '{new_name_xml}'")
|
||||
includes.append({"name": name, "path": new_name_xml, "manifest": None})
|
||||
continue
|
||||
if child.tag == "default":
|
||||
@ -682,22 +447,10 @@ def tag_manifest(manifest_xml_filename, all_tags):
|
||||
tag_sha1 = child.attrib[attr]
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: Unknow '"
|
||||
+ child.tag
|
||||
+ "' attibute : '"
|
||||
+ attr
|
||||
+ "', availlable:[name,tag,sync-s]"
|
||||
f"(l:{child.sourceline}) Parsing the manifest: unknown '{child.tag}' attribute : '{attr}', available:[name,tag,sync-s]"
|
||||
)
|
||||
if name == "":
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest: '"
|
||||
+ child.tag
|
||||
+ "' missing attribute: 'name' ==> specify the git to clone ..."
|
||||
)
|
||||
debug.error(f"(l:{child.sourceline}) Parsing the manifest: '{child.tag}' missing attribute: 'name' ==> specify the git to clone.")
|
||||
for elem_tag in all_tags:
|
||||
if elem_tag["name"] == name:
|
||||
child.set("tag", elem_tag["tag"])
|
||||
@ -707,24 +460,9 @@ def tag_manifest(manifest_xml_filename, all_tags):
|
||||
continue
|
||||
if child.tag == "link":
|
||||
continue
|
||||
debug.info(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") '"
|
||||
+ str(child.tag)
|
||||
+ "' values="
|
||||
+ str(child.attrib)
|
||||
)
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing error Unknow NODE : '"
|
||||
+ str(child.tag)
|
||||
+ "' availlable:[remote,include,default,project,option,link]"
|
||||
)
|
||||
tree.write(
|
||||
manifest_xml_filename, pretty_print=True, xml_declaration=True, encoding="utf-8"
|
||||
)
|
||||
debug.info(f"(l:{child.sourceline}) '{child.tag}' values={child.attrib}")
|
||||
debug.error(f"(l:{child.sourceline}) Parsing error unknown NODE : '{child.tag}' available:[remote,include,default,project,option,link]")
|
||||
tree.write(manifest_xml_filename, pretty_print=True, xml_declaration=True, encoding="utf-8")
|
||||
# now we parse all sub repo:
|
||||
for elem in includes:
|
||||
tag_manifest(elem["path"], all_tags)
|
||||
@ -732,27 +470,15 @@ def tag_manifest(manifest_xml_filename, all_tags):
|
||||
|
||||
def tag_clear(manifest_xml_filename):
|
||||
tree = etree.parse(manifest_xml_filename)
|
||||
debug.debug("manifest : '" + manifest_xml_filename + "'")
|
||||
debug.debug(f"manifest : '{manifest_xml_filename}'")
|
||||
root = tree.getroot()
|
||||
includes = []
|
||||
if root.tag != "manifest":
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") in '"
|
||||
+ str(file)
|
||||
+ "' have not main xml node='manifest'"
|
||||
)
|
||||
debug.error(f"(l:{child.sourceline}) in '{file}' have not main xml node='manifest'")
|
||||
return False
|
||||
for child in root:
|
||||
if type(child) == etree._Comment:
|
||||
debug.verbose(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") comment='"
|
||||
+ str(child.text)
|
||||
+ "'"
|
||||
)
|
||||
debug.verbose("(l:{child.sourceline}) comment='{child.text}'")
|
||||
continue
|
||||
if child.tag == "remote":
|
||||
continue
|
||||
@ -762,34 +488,12 @@ def tag_clear(manifest_xml_filename):
|
||||
if attr == "name":
|
||||
name = child.attrib[attr]
|
||||
else:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing the manifest : Unknow '"
|
||||
+ child.tag
|
||||
+ "' attibute : '"
|
||||
+ attr
|
||||
+ "', availlable:[name]"
|
||||
)
|
||||
debug.debug(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") find '"
|
||||
+ child.tag
|
||||
+ "' : name='"
|
||||
+ name
|
||||
+ "'"
|
||||
)
|
||||
debug.error(f"(l:{child.sourceline}) Parsing the manifest : unknown '{child.tag}' attribute : '{attr}', available:[name]")
|
||||
debug.debug("(l:{child.sourceline}) find '{child.tag}' : name='{name}'")
|
||||
# check if the file exist ...
|
||||
new_name_xml = os.path.join(os.path.dirname(manifest_xml_filename), name)
|
||||
if os.path.exists(new_name_xml) == False:
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") The file does not exist : '"
|
||||
+ new_name_xml
|
||||
+ "'"
|
||||
)
|
||||
if os.path.exists(new_name_xml) is False:
|
||||
debug.error("(l:{child.sourceline}) The file does not exist : '{new_name_xml}'")
|
||||
includes.append({"name": name, "path": new_name_xml, "manifest": None})
|
||||
continue
|
||||
if child.tag == "default":
|
||||
@ -801,24 +505,9 @@ def tag_clear(manifest_xml_filename):
|
||||
continue
|
||||
if child.tag == "link":
|
||||
continue
|
||||
debug.info(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") '"
|
||||
+ str(child.tag)
|
||||
+ "' values="
|
||||
+ str(child.attrib)
|
||||
)
|
||||
debug.error(
|
||||
"(l:"
|
||||
+ str(child.sourceline)
|
||||
+ ") Parsing error Unknow NODE : '"
|
||||
+ str(child.tag)
|
||||
+ "' availlable:[remote,include,default,project,option,link]"
|
||||
)
|
||||
tree.write(
|
||||
manifest_xml_filename, pretty_print=True, xml_declaration=True, encoding="utf-8"
|
||||
)
|
||||
debug.info(f"(l:{child.sourceline}) '{child.tag}' values={child.attrib}")
|
||||
debug.error(f"(l:{child.sourceline}) Parsing error unknown NODE : '{child.tag}' available:[remote,include,default,project,option,link]")
|
||||
tree.write(manifest_xml_filename, pretty_print=True, xml_declaration=True, encoding="utf-8")
|
||||
# now we parse all sub repo:
|
||||
for elem in includes:
|
||||
tag_clear(elem["path"])
|
||||
|
@ -24,12 +24,12 @@ def generic_display_error(
|
||||
return_value,
|
||||
type_name,
|
||||
error_only=False,
|
||||
availlable_return=[0],
|
||||
available_return=[0],
|
||||
display_if_nothing=True,
|
||||
):
|
||||
debug.verbose(str(return_value))
|
||||
if return_value[0] in availlable_return:
|
||||
if error_only == True:
|
||||
if return_value[0] in available_return:
|
||||
if error_only is True:
|
||||
return
|
||||
display = False
|
||||
if return_value[1] != "":
|
||||
@ -38,9 +38,9 @@ def generic_display_error(
|
||||
if return_value[2] != "":
|
||||
debug.warning(return_value[2])
|
||||
display = True
|
||||
if display_if_nothing == False:
|
||||
if display_if_nothing is False:
|
||||
return
|
||||
if display == False:
|
||||
if display is False:
|
||||
debug.verbose("GIT(" + type_name + "): All done OK")
|
||||
else:
|
||||
display = False
|
||||
@ -50,13 +50,8 @@ def generic_display_error(
|
||||
if return_value[2] != "":
|
||||
debug.warning("ERROR GIT(" + type_name + ") 2:" + return_value[2])
|
||||
display = True
|
||||
if display == False:
|
||||
debug.warning(
|
||||
"ERROR GIT("
|
||||
+ type_name
|
||||
+ "): Unknow error return_value="
|
||||
+ str(return_value[0])
|
||||
)
|
||||
if display is False:
|
||||
debug.warning("ERROR GIT(" + type_name + "): Unknow error return_value=" + str(return_value[0]))
|
||||
|
||||
|
||||
def run_command_direct_shell(cmd_line, cwd=None, shell=False):
|
||||
@ -67,9 +62,9 @@ def run_command_direct_shell(cmd_line, cwd=None, shell=False):
|
||||
return ""
|
||||
|
||||
|
||||
##
|
||||
## @brief Execute the command and ruturn generate data
|
||||
##
|
||||
#
|
||||
# @brief Execute the command and ruturn generate data
|
||||
#
|
||||
def run_command_direct(cmd_line, cwd=None):
|
||||
# prepare command line:
|
||||
args = shlex.split(cmd_line)
|
||||
@ -87,9 +82,7 @@ def run_command_direct(cmd_line, cwd=None):
|
||||
if cwd != None:
|
||||
debug.info("path = " + cwd)
|
||||
"""
|
||||
p = subprocess.Popen(
|
||||
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd
|
||||
)
|
||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
|
||||
except subprocess.CalledProcessError as e:
|
||||
debug.error("subprocess.CalledProcessError : " + str(args))
|
||||
except:
|
||||
@ -118,13 +111,11 @@ def run_command(cmd_line, cwd=None):
|
||||
if cwd != None:
|
||||
debug.info("path = " + cwd)
|
||||
"""
|
||||
p = subprocess.Popen(
|
||||
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
debug.error("subprocess.CalledProcessError : " + str(args))
|
||||
except:
|
||||
debug.error("Exception on : " + str(args))
|
||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
|
||||
except subprocess.CalledProcessError as ex:
|
||||
debug.error(f"subprocess.CalledProcessError : {args} ==> {ex}")
|
||||
except Exception as ex:
|
||||
debug.error(f"Exception : {args} ==> {ex}")
|
||||
# launch the subprocess:
|
||||
output, err = p.communicate()
|
||||
if sys.version_info >= (3, 0):
|
||||
|
@ -16,9 +16,7 @@ class RepoConfig:
|
||||
def __init__(self):
|
||||
self.name = ""
|
||||
self.path = ""
|
||||
self.remotes = (
|
||||
[]
|
||||
) # list of all remotes, with the upstream elements (needed for third party integrations)
|
||||
self.remotes = [] # list of all remotes, with the upstream elements (needed for third party integrations)
|
||||
self.select_remote = ""
|
||||
self.branch = ""
|
||||
self.tag = None
|
||||
@ -31,30 +29,18 @@ def split_repo(git_repo):
|
||||
# http://wdfqsdfqs@qsdfqsdf/qsdfqsdf/qsdfqsdf/qsdfqs.git find the 3rd '/' and cut at this point
|
||||
elements = git_repo.split("/")
|
||||
if len(elements) < 4:
|
||||
debug.error(
|
||||
"Can not parse the git repository : '"
|
||||
+ str(git_repo)
|
||||
+ "' wrong format http?://xxx@xxx.xxx/****"
|
||||
)
|
||||
debug.error("Can not parse the git repository : '" + str(git_repo) + "' wrong format http?://xxx@xxx.xxx/****")
|
||||
base = elements[0] + "/" + elements[1] + "/" + elements[2]
|
||||
repo = git_repo[len(base) + 1 :]
|
||||
elif len(git_repo) > 3 and git_repo[:3] == "git":
|
||||
# git@qsdfqsdf:qsdfqsdf/qsdfqsdf/qsdfqs.git find the 1st ':' and cut at this point
|
||||
elements = git_repo.split(":")
|
||||
if len(elements) < 2:
|
||||
debug.error(
|
||||
"Can not parse the git repository : '"
|
||||
+ str(git_repo)
|
||||
+ "' wrong format git@xxx.xxx:****"
|
||||
)
|
||||
debug.error("Can not parse the git repository : '" + str(git_repo) + "' wrong format git@xxx.xxx:****")
|
||||
base = elements[0]
|
||||
repo = git_repo[len(base) + 1 :]
|
||||
else:
|
||||
debug.error(
|
||||
"Can not parse the git repository : '"
|
||||
+ str(git_repo)
|
||||
+ "' does not start with ['http', 'git']"
|
||||
)
|
||||
debug.error("Can not parse the git repository : '" + str(git_repo) + "' does not start with ['http', 'git']")
|
||||
debug.verbose(" base: " + str(base))
|
||||
debug.verbose(" repo: " + str(repo))
|
||||
return (base, repo)
|
||||
|
149
island/tools.py
149
island/tools.py
@ -75,7 +75,7 @@ def file_size(path):
|
||||
def file_read_data(path, binary=False):
|
||||
if not os.path.isfile(path):
|
||||
return ""
|
||||
if binary == True:
|
||||
if binary is True:
|
||||
file = open(path, "rb")
|
||||
else:
|
||||
file = open(path, "r")
|
||||
@ -103,9 +103,7 @@ def version_string_to_list(version):
|
||||
return [0, 0, 0]
|
||||
elems = version.split("-")
|
||||
if len(elems[0].split(".")) <= 1:
|
||||
debug.error(
|
||||
"Can not parde a version with wrong version model '" + version + "'"
|
||||
)
|
||||
debug.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:
|
||||
@ -113,14 +111,14 @@ def version_string_to_list(version):
|
||||
return out
|
||||
|
||||
|
||||
##
|
||||
## @brief Write data in a specific path.
|
||||
## @param[in] path Path of the data might be written.
|
||||
## @param[in] data Data To write in the file.
|
||||
## @param[in] only_if_new (default: False) Write data only if data is different.
|
||||
## @return True Something has been copied
|
||||
## @return False Nothing has been copied
|
||||
##
|
||||
#
|
||||
# @brief Write data in a specific path.
|
||||
# @param[in] path Path of the data might be written.
|
||||
# @param[in] data Data To write in the file.
|
||||
# @param[in] only_if_new (default: False) Write data only if data is different.
|
||||
# @return True Something has been copied
|
||||
# @return False Nothing has been copied
|
||||
#
|
||||
def file_write_data(path, data: str, only_if_new: bool = False):
|
||||
if only_if_new is True:
|
||||
if os.path.exists(path) is True:
|
||||
@ -129,14 +127,13 @@ def file_write_data(path, data: str, only_if_new: bool = False):
|
||||
return False
|
||||
# real write of data:
|
||||
create_directory_of_file(path)
|
||||
file = open(path, "w")
|
||||
file.write(data)
|
||||
file.close()
|
||||
with open(path, "w") as file:
|
||||
file.write(data)
|
||||
return True
|
||||
|
||||
|
||||
def list_to_str(list):
|
||||
if type(list) == type(str()):
|
||||
if isinstance(list, str):
|
||||
return list + " "
|
||||
else:
|
||||
result = ""
|
||||
@ -147,9 +144,9 @@ def list_to_str(list):
|
||||
|
||||
|
||||
def add_prefix(prefix, list):
|
||||
if type(list) == type(None):
|
||||
if list is None:
|
||||
return ""
|
||||
if type(list) == type(str()):
|
||||
if isinstance(list, str):
|
||||
return prefix + list
|
||||
else:
|
||||
if len(list) == 0:
|
||||
@ -163,7 +160,7 @@ def add_prefix(prefix, list):
|
||||
|
||||
def store_command(cmd_line, file):
|
||||
# write cmd line only after to prevent errors ...
|
||||
if file == "" or file == None:
|
||||
if file == "" or file is None:
|
||||
return
|
||||
debug.verbose("create cmd file: " + file)
|
||||
# Create directory:
|
||||
@ -182,33 +179,30 @@ def get_type_string(in_type):
|
||||
return "list"
|
||||
elif type(in_type) == dict:
|
||||
return "dict"
|
||||
return "unknow"
|
||||
return "unknown"
|
||||
|
||||
|
||||
## List tools:
|
||||
# List tools:
|
||||
def list_append_and_check(listout, newElement, order):
|
||||
for element in listout:
|
||||
if element == newElement:
|
||||
return
|
||||
listout.append(newElement)
|
||||
if order == True:
|
||||
if type(newElement) is not dict:
|
||||
listout.sort()
|
||||
if order is True and not isinstance(newElement, dict):
|
||||
listout.sort()
|
||||
|
||||
|
||||
def list_append_to(out_list, in_list, order=False):
|
||||
if type(in_list) == str:
|
||||
list_append_and_check(out_list, in_list, order)
|
||||
elif type(in_list) == list:
|
||||
# mulyiple imput in the list ...
|
||||
# multiple input in the list ...
|
||||
for elem in in_list:
|
||||
list_append_and_check(out_list, elem, order)
|
||||
elif type(in_list) == dict:
|
||||
list_append_and_check(out_list, in_list, order)
|
||||
else:
|
||||
debug.warning(
|
||||
"can not add in list other than {list/dict/str} : " + str(type(in_list))
|
||||
)
|
||||
debug.warning(f"can not add in list other than {list/dict/str} : {type(in_list)}")
|
||||
|
||||
|
||||
def list_append_to_2(listout, module, in_list, order=False):
|
||||
@ -223,12 +217,12 @@ def list_append_to_2(listout, module, in_list, order=False):
|
||||
list_append_to(listout[module], in_list, order)
|
||||
|
||||
|
||||
##
|
||||
## @brief The vertion number can be set in an external file to permit to have a singe position to change when create a vew version
|
||||
## @param[in] path_module (string) Path of the module position
|
||||
## @param[in] filename_or_version (string or list) Path of the version or the real version lint parameter
|
||||
## @return (list) List of version number
|
||||
##
|
||||
#
|
||||
# @brief The version number can be set in an external file to permit to have a singe position to change when create a vew version
|
||||
# @param[in] path_module (string) Path of the module position
|
||||
# @param[in] filename_or_version (string or list) Path of the version or the real version lint parameter
|
||||
# @return (list) List of version number
|
||||
#
|
||||
def get_version_from_file_or_direct(path_module, filename_or_version):
|
||||
# check case of iser set the version directly
|
||||
if type(filename_or_version) == list:
|
||||
@ -236,37 +230,21 @@ def get_version_from_file_or_direct(path_module, filename_or_version):
|
||||
# this use a version file
|
||||
file_data = file_read_data(os.path.join(path_module, filename_or_version))
|
||||
if len(file_data) == 0:
|
||||
debug.warning(
|
||||
"not enought data in the file version size=0 "
|
||||
+ path_module
|
||||
+ " / "
|
||||
+ filename_or_version
|
||||
)
|
||||
debug.warning("not enough 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:
|
||||
debug.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
|
||||
f"More than 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]
|
||||
debug.debug("Parse line: '" + line + "'")
|
||||
debug.debug(f"Parse line: '{line}'")
|
||||
# check if we have "-dev"
|
||||
dev_mode = ""
|
||||
list_tiret = line.split("-")
|
||||
if len(list_tiret) > 2:
|
||||
debug.warning(
|
||||
"more than one '-' in version file "
|
||||
+ str(filename_or_version)
|
||||
+ " : '"
|
||||
+ str(list_tiret)
|
||||
+ "' in '"
|
||||
+ path_module
|
||||
+ "'"
|
||||
)
|
||||
debug.warning(f"more than one '-' in version file {filename_or_version} : '{list_tiret}' in '{path_module}'")
|
||||
if len(list_tiret) >= 2:
|
||||
dev_mode = list_tiret[1]
|
||||
line = list_tiret[0]
|
||||
@ -276,29 +254,24 @@ def get_version_from_file_or_direct(path_module, filename_or_version):
|
||||
out.append(int(elem))
|
||||
if dev_mode != "":
|
||||
out.append(dev_mode)
|
||||
debug.debug(" ==> " + str(out))
|
||||
debug.debug(f" ==> {out}")
|
||||
return out
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the list of the authors frim an input list or a file
|
||||
## @param[in] path_module (string) Path of the module position
|
||||
## @param[in] filename_or_version (string or list) Path of the author file or the real list of authors
|
||||
## @return (list) List of authors
|
||||
##
|
||||
#
|
||||
# @brief Get the list of the authors from an input list or a file
|
||||
# @param[in] path_module (string) Path of the module position
|
||||
# @param[in] filename_or_version (string or list) Path of the author file or the real list of authors
|
||||
# @return (list) List of authors
|
||||
#
|
||||
def get_maintainer_from_file_or_direct(path_module, filename_or_author):
|
||||
# check case of iser set the version directly
|
||||
if type(filename_or_author) == list:
|
||||
# check case of it is set the version directly
|
||||
if isinstance(filename_or_author, list):
|
||||
return filename_or_author
|
||||
# this use a version file
|
||||
file_data = file_read_data(os.path.join(path_module, filename_or_author))
|
||||
if len(file_data) == 0:
|
||||
debug.warning(
|
||||
"not enought data in the file author size=0 "
|
||||
+ path_module
|
||||
+ " / "
|
||||
+ filename_or_author
|
||||
)
|
||||
debug.warning(f"not enough data in the file author size=0 {path_module}/{filename_or_author}")
|
||||
return []
|
||||
# One user by line and # for comment line
|
||||
out = []
|
||||
@ -335,9 +308,9 @@ def remove_element(data, to_remove):
|
||||
|
||||
|
||||
def get_list_base_display(id, count, elem):
|
||||
if env.get_display_folder_instead_of_git_name() == False:
|
||||
return str(id) + "/" + str(count) + " : " + str(elem.name)
|
||||
return str(id) + "/" + str(count) + " : " + str(elem.path)
|
||||
if env.get_display_folder_instead_of_git_name() is False:
|
||||
return f"{id}/{count} : {elem.name}"
|
||||
return f"{id}/{count} : {elem.path}"
|
||||
|
||||
|
||||
is_first_time_sleep = True
|
||||
@ -345,15 +318,11 @@ is_first_time_sleep = True
|
||||
|
||||
def wait_for_server_if_needed():
|
||||
global is_first_time_sleep
|
||||
if is_first_time_sleep == False:
|
||||
if is_first_time_sleep is False:
|
||||
is_first_time_sleep = True
|
||||
return
|
||||
if env.get_wait_between_sever_command() != 0:
|
||||
debug.info(
|
||||
"Wait for server contrition ("
|
||||
+ str(env.get_wait_between_sever_command())
|
||||
+ " s)"
|
||||
)
|
||||
debug.info(f"Wait for server contrition ({env.get_wait_between_sever_command()} s)")
|
||||
time.sleep(env.get_wait_between_sever_command())
|
||||
|
||||
|
||||
@ -362,7 +331,7 @@ def filter_name_and_file(root, list_files, filter):
|
||||
tmp_list = fnmatch.filter(list_files, filter)
|
||||
out = []
|
||||
for elem in tmp_list:
|
||||
if os.path.isfile(os.path.join(root, elem)) == True:
|
||||
if os.path.isfile(os.path.join(root, elem)) is True:
|
||||
out.append(elem)
|
||||
return out
|
||||
|
||||
@ -382,37 +351,31 @@ def exclude_list(list_elements, filter):
|
||||
|
||||
def import_path_local(path, limit_sub_folder=1, exclude_path=[], base_name="*"):
|
||||
out = []
|
||||
debug.debug("island files: " + str(path) + " [START] " + str(limit_sub_folder))
|
||||
debug.debug(f"island files: {path} [START] {limit_sub_folder}")
|
||||
if limit_sub_folder == 0:
|
||||
debug.verbose("Subparsing limitation append ...")
|
||||
debug.verbose("Sub-parsing limitation append ...")
|
||||
return []
|
||||
list_files = get_list_sub_files(path)
|
||||
# filter elements:
|
||||
debug.debug("island files: " + str(path) + " : " + str(list_files))
|
||||
debug.debug(f"island files: {path} : {list_files}")
|
||||
tmp_list_island_file = filter_name_and_file(path, list_files, base_name)
|
||||
debug.debug(
|
||||
"island files (filtered): " + str(path) + " : " + str(tmp_list_island_file)
|
||||
)
|
||||
debug.debug(f"island files (filtered): {path} : {tmp_list_island_file}")
|
||||
# Import the module:
|
||||
for filename in tmp_list_island_file:
|
||||
out.append(os.path.join(path, filename))
|
||||
debug.debug(" Find a file : '" + str(out[-1]) + "'")
|
||||
debug.debug(f" Find a file : '{out[-1]}'")
|
||||
list_folders_full = get_list_sub_path(path)
|
||||
list_folders = []
|
||||
for elem in list_folders_full:
|
||||
if elem in exclude_path:
|
||||
debug.verbose(
|
||||
"find '" + str(elem) + "' in exclude_path=" + str(exclude_path)
|
||||
)
|
||||
debug.verbose(f"find '{elem}' in exclude_path={exclude_path}")
|
||||
continue
|
||||
list_folders.append(os.path.join(path, elem))
|
||||
# check if we need to parse sub_folder
|
||||
if len(list_folders) != 0:
|
||||
debug.debug(" Find a folder : " + str(list_folders))
|
||||
debug.debug(f" Find a folder : {list_folders}")
|
||||
for folder in list_folders:
|
||||
tmp_out = import_path_local(
|
||||
folder, limit_sub_folder - 1, exclude_path, base_name
|
||||
)
|
||||
tmp_out = import_path_local(folder, limit_sub_folder - 1, exclude_path, base_name)
|
||||
# add all the elements:
|
||||
for elem in tmp_out:
|
||||
out.append(elem)
|
||||
|
2
pyproject.toml
Normal file
2
pyproject.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[tool.black]
|
||||
line-length = 150
|
14
setup.py
14
setup.py
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
#
|
||||
# @author Edouard DUPIN
|
||||
#
|
||||
# @copyright 2012, Edouard DUPIN, all right reserved
|
||||
#
|
||||
# @license MPL v2.0 (see license file)
|
||||
#
|
||||
|
||||
from setuptools import setup
|
||||
import os
|
||||
|
Loading…
Reference in New Issue
Block a user