[DEV] Add unique config concept
This commit is contained in:
parent
19000e72e5
commit
be4a10b1a1
@ -58,7 +58,7 @@ def execute(_arguments):
|
|||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
# update the local configuration file:
|
# update the local configuration file:
|
||||||
configuration.set_branch(branch_to_checkout)
|
configuration.set_branch(branch_to_checkout)
|
||||||
|
@ -50,7 +50,7 @@ def execute(_arguments):
|
|||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||||
if os.path.exists(file_source_manifest) == False:
|
if os.path.exists(file_source_manifest) == False:
|
||||||
|
@ -62,7 +62,7 @@ def execute(_arguments):
|
|||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||||
if os.path.exists(file_source_manifest) == False:
|
if os.path.exists(file_source_manifest) == False:
|
||||||
|
@ -54,7 +54,7 @@ def execute(_arguments):
|
|||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||||
if os.path.exists(file_source_manifest) == False:
|
if os.path.exists(file_source_manifest) == False:
|
||||||
|
@ -53,7 +53,7 @@ def execute(_arguments):
|
|||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||||
if os.path.exists(file_source_manifest) == False:
|
if os.path.exists(file_source_manifest) == False:
|
||||||
|
@ -57,7 +57,7 @@ def execute(_arguments):
|
|||||||
debug.info("fetch manifest : '" + str(env.get_island_path_manifest()) + "'")
|
debug.info("fetch manifest : '" + str(env.get_island_path_manifest()) + "'")
|
||||||
commands.fetch(env.get_island_path_manifest(), "origin")
|
commands.fetch(env.get_island_path_manifest(), "origin")
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||||
if os.path.exists(file_source_manifest) == False:
|
if os.path.exists(file_source_manifest) == False:
|
||||||
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
debug.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
|
@ -78,7 +78,7 @@ def execute(_arguments):
|
|||||||
# check if the git of the manifest if availlable
|
# check if the git of the manifest if availlable
|
||||||
|
|
||||||
# create the file configuration:
|
# create the file configuration:
|
||||||
conf = config.Config()
|
conf = config.get_unique_config()
|
||||||
conf.set_manifest(address_manifest)
|
conf.set_manifest(address_manifest)
|
||||||
conf.set_branch(branch)
|
conf.set_branch(branch)
|
||||||
conf.set_manifest_name(manifest_name)
|
conf.set_manifest_name(manifest_name)
|
||||||
|
@ -49,7 +49,7 @@ def execute(_arguments):
|
|||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
debug.info("update manifest : '" + str(env.get_island_path_manifest()) + "'")
|
debug.info("update manifest : '" + str(env.get_island_path_manifest()) + "'")
|
||||||
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
|
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
|
||||||
|
@ -30,8 +30,8 @@ def help():
|
|||||||
## @param[in,out] my_args (death.Arguments) Argument manager
|
## @param[in,out] my_args (death.Arguments) Argument manager
|
||||||
## @param[in] section Name of the currect action
|
## @param[in] section Name of the currect action
|
||||||
##
|
##
|
||||||
def add_specific_arguments(my_args, section):
|
def add_specific_arguments(_my_args, _section):
|
||||||
my_args.add("r", "remote", haveParam=True, desc="Name of the remote server")
|
_my_args.add("r", "remote", haveParam=True, desc="Name of the remote server")
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Execute the action required.
|
## @brief Execute the action required.
|
||||||
@ -54,7 +54,7 @@ def execute(_arguments):
|
|||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||||
if os.path.exists(file_source_manifest) == False:
|
if os.path.exists(file_source_manifest) == False:
|
||||||
|
@ -58,7 +58,7 @@ def execute(_arguments):
|
|||||||
|
|
||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||||
if os.path.exists(file_source_manifest) == False:
|
if os.path.exists(file_source_manifest) == False:
|
||||||
|
@ -57,7 +57,7 @@ def execute(_arguments):
|
|||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
debug.info("update manifest : '" + str(env.get_island_path_manifest()) + "'")
|
debug.info("update manifest : '" + str(env.get_island_path_manifest()) + "'")
|
||||||
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
|
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
|
||||||
|
@ -61,7 +61,7 @@ def execute(_arguments):
|
|||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.get_unique_config()
|
||||||
|
|
||||||
# TODO: Load Old manifect to check diff ...
|
# TODO: Load Old manifect to check diff ...
|
||||||
|
|
||||||
@ -88,6 +88,8 @@ def execute(_arguments):
|
|||||||
tools.wait_for_server_if_needed()
|
tools.wait_for_server_if_needed()
|
||||||
#debug.debug("elem : " + str(elem))
|
#debug.debug("elem : " + str(elem))
|
||||||
git_repo_path = os.path.join(env.get_island_root_path(), elem.path)
|
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) == False:
|
||||||
# this is a new clone ==> this is easy ...
|
# this is a new clone ==> this is easy ...
|
||||||
#clone the manifest repository
|
#clone the manifest repository
|
||||||
|
@ -75,7 +75,7 @@ def execute(_arguments):
|
|||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
# Update the current configuration:
|
# Update the current configuration:
|
||||||
conf = config.Config()
|
conf = config.get_unique_config()
|
||||||
# TODO: Check if the local path does not exist in the manifest
|
# TODO: Check if the local path does not exist in the manifest
|
||||||
|
|
||||||
if False == conf.add_volatile(address_git, path):
|
if False == conf.add_volatile(address_git, path):
|
||||||
|
@ -42,7 +42,7 @@ def execute(_arguments):
|
|||||||
# check system is OK
|
# check system is OK
|
||||||
manifest.check_lutin_is_init()
|
manifest.check_lutin_is_init()
|
||||||
|
|
||||||
conf = config.Config()
|
conf = config.get_unique_config()
|
||||||
volatiles = conf.get_volatile()
|
volatiles = conf.get_volatile()
|
||||||
debug.info("List of all volatiles repository: ")
|
debug.info("List of all volatiles repository: ")
|
||||||
for elem in volatiles:
|
for elem in volatiles:
|
||||||
|
@ -17,10 +17,18 @@ from realog import debug
|
|||||||
from . import tools
|
from . import tools
|
||||||
from . import env
|
from . import env
|
||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
|
from . import repo_config
|
||||||
|
|
||||||
env.get_island_path_config()
|
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():
|
class Config():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -153,3 +161,25 @@ class Config():
|
|||||||
self._curent_link = []
|
self._curent_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.branch = "master"
|
||||||
|
conf.volatile = False
|
||||||
|
conf.remotes = [
|
||||||
|
{
|
||||||
|
'name': 'origin',
|
||||||
|
'fetch': base_volatile,
|
||||||
|
'mirror': []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
conf.select_remote = {
|
||||||
|
'name': 'origin',
|
||||||
|
'fetch': base_volatile,
|
||||||
|
'sync': False,
|
||||||
|
'mirror': []
|
||||||
|
}
|
||||||
|
return conf
|
||||||
|
|
||||||
|
@ -204,20 +204,24 @@ class Manifest():
|
|||||||
if child.tag == "project":
|
if child.tag == "project":
|
||||||
name = ""
|
name = ""
|
||||||
path = ""
|
path = ""
|
||||||
|
tag_sha1 = None
|
||||||
for attr in child.attrib:
|
for attr in child.attrib:
|
||||||
if attr == "name":
|
if attr == "name":
|
||||||
name = child.attrib[attr]
|
name = child.attrib[attr]
|
||||||
elif attr == "path":
|
elif attr == "path":
|
||||||
path = child.attrib[attr]
|
path = child.attrib[attr]
|
||||||
|
elif attr == "tag":
|
||||||
|
tag_sha1 = child.attrib[attr]
|
||||||
else:
|
else:
|
||||||
debug.error("(l:" + str(child.sourceline) + ") Parsing the manifest: Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name,revision,sync-s]")
|
debug.error("(l:" + str(child.sourceline) + ") Parsing the manifest: Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name,tag,sync-s]")
|
||||||
if name == "":
|
if name == "":
|
||||||
debug.error("(l:" + str(child.sourceline) + ") Parsing the manifest: '" + child.tag + "' missing attribute: 'name' ==> specify the git to clone ...")
|
debug.error("(l:" + str(child.sourceline) + ") Parsing the manifest: '" + child.tag + "' missing attribute: 'name' ==> specify the git to clone ...")
|
||||||
self.projects.append({
|
self.projects.append({
|
||||||
"name":name,
|
"name":name,
|
||||||
"path":path,
|
"path":path,
|
||||||
|
"tag":tag_sha1,
|
||||||
})
|
})
|
||||||
debug.debug("(l:" + str(child.sourceline) + ") find '" + child.tag + "' : name='" + name + "' path='" + path + "'");
|
debug.debug("(l:" + str(child.sourceline) + ") find '" + child.tag + "' : name='" + name + "' path='" + path + "' tag='" + str(tag_sha1) + "'");
|
||||||
continue
|
continue
|
||||||
if child.tag == "option":
|
if child.tag == "option":
|
||||||
# not managed ==> future use
|
# not managed ==> future use
|
||||||
@ -289,6 +293,7 @@ class Manifest():
|
|||||||
continue
|
continue
|
||||||
conf = repo_config.RepoConfig()
|
conf = repo_config.RepoConfig()
|
||||||
conf.name = elem["name"]
|
conf.name = elem["name"]
|
||||||
|
conf.tag = elem["tag"]
|
||||||
conf.path = self._create_path_with_elem(elem)
|
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 herited element)
|
||||||
@ -339,7 +344,7 @@ class Manifest():
|
|||||||
## -------------------------------------------------------------
|
## -------------------------------------------------------------
|
||||||
debug.verbose("include volatile config")
|
debug.verbose("include volatile config")
|
||||||
# TODO: maybe find a better way to do this...
|
# TODO: maybe find a better way to do this...
|
||||||
conf_global = config.Config()
|
conf_global = config.get_unique_config()
|
||||||
for elem in conf_global.get_volatile():
|
for elem in conf_global.get_volatile():
|
||||||
conf = repo_config.RepoConfig()
|
conf = repo_config.RepoConfig()
|
||||||
base_volatile, repo_volatile = repo_config.split_repo(elem["git_address"])
|
base_volatile, repo_volatile = repo_config.split_repo(elem["git_address"])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user