Commit 75dbfdde authored by Tristan Gingold's avatar Tristan Gingold

Remove undocumented and inconsistent behaviour of gitsm.

parent 86d08faf
...@@ -90,56 +90,3 @@ class Git(Fetcher): ...@@ -90,56 +90,3 @@ class Git(Fetcher):
class GitSM(Git): class GitSM(Git):
def __init__(self): def __init__(self):
self.submodule = True self.submodule = True
def get_git_toplevel(module):
"""Get the top level for the Git repository"""
cur_dir = os.getcwd()
try:
os.chdir(path_utils.rel2abs(module.path))
if not os.path.exists(".gitmodules"):
return None
return shell.run("git rev-parse --show-toplevel")
finally:
os.chdir(cur_dir)
def get_git_submodules(module):
"""Get a dictionary containing the git submodules
that are listed in the module's path"""
submodule_dir = path_utils.rel2abs(module.path)
if module.isfetched == False:
logging.debug("Cannot check submodules, module %s is not fetched",
submodule_dir)
return {}
logging.debug("Checking git submodules in %s", submodule_dir)
cur_dir = os.getcwd()
try:
os.chdir(submodule_dir)
if not os.path.exists(".gitmodules"):
return {}
config_submodules = {}
config_content = Popen("git config -f .gitmodules --list",
stdout=PIPE,
stdin=PIPE,
close_fds=not shell.check_windows_tools(),
shell=True)
config_lines = [line.strip().decode('utf-8') for line
in config_content.stdout.readlines()]
config_submodule_lines = [line for line in config_lines
if line.startswith("submodule")]
for line in config_submodule_lines:
line_split = line.split("=")
lhs = line_split[0]
rhs = line_split[1]
lhs_split = lhs.split(".")
module_name = '.'.join(lhs_split[1:-1])
if module_name not in config_submodules:
config_submodules[module_name] = {}
config_submodules[module_name][lhs_split[-1]] = rhs
if len(list(config_submodules)) > 0:
logging.info("Found git submodules in %s: %s",
module.path, str(config_submodules))
finally:
os.chdir(cur_dir)
return config_submodules
...@@ -157,7 +157,6 @@ class Module(object): ...@@ -157,7 +157,6 @@ class Module(object):
self._process_manifest_files() self._process_manifest_files()
self._process_manifest_modules() self._process_manifest_modules()
self._process_manifest_makefiles() self._process_manifest_makefiles()
self._process_git_submodules()
def _process_manifest_universal(self): def _process_manifest_universal(self):
"""Method processing the universal manifest directives; """Method processing the universal manifest directives;
...@@ -260,23 +259,6 @@ class Module(object): ...@@ -260,23 +259,6 @@ class Module(object):
parent=self, url=path, source=m, fetchto=fetchto)) parent=self, url=path, source=m, fetchto=fetchto))
self.modules[m] = mods self.modules[m] = mods
def _process_git_submodules(self):
"""Get the submodules if found in the Manifest path"""
if not self.source == 'gitsm':
return
git_submodule_dict = git.get_git_submodules(self)
git_toplevel = git.get_git_toplevel(self)
for submodule_key in git_submodule_dict.keys():
url = git_submodule_dict[submodule_key]["url"]
path = git_submodule_dict[submodule_key]["path"]
path = os.path.join(git_toplevel, path)
fetchto = os.path.sep.join(path.split(os.path.sep)[:-1])
self.modules['git'].append(
self.action.new_module(parent=self,
url=url,
fetchto=fetchto,
source='git'))
def _process_manifest_makefiles(self): def _process_manifest_makefiles(self):
"""Get the extra makefiles defined in the HDLMake module""" """Get the extra makefiles defined in the HDLMake module"""
# Included Makefiles # Included Makefiles
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment