From 26b4267a3b00ebedb560169d09f974cd87a6a370 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 27 Jan 2020 13:24:26 +0100 Subject: Handle recursive DEPS Needed to include angle third party dependencies Change-Id: I8b4fada4cac0f90f52d541953ddbdf530b6cdb37 Reviewed-by: Michal Klocek --- tools/scripts/git_submodule.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tools/scripts/git_submodule.py') diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py index 684a8af67..28b92d942 100644 --- a/tools/scripts/git_submodule.py +++ b/tools/scripts/git_submodule.py @@ -61,6 +61,9 @@ class DEPSParser: #result.update(self.custom_vars or {}) return result + def get_recursedeps(self): + return self.local_scope["recursedeps"] + def createSubmodulesFromScope(self, scope, os): submodules = [] for dep in scope: @@ -225,6 +228,9 @@ class Submodule: # The submodule operations should be done relative to the current submodule's # supermodule. if self.topmost_supermodule_path_prefix: + if not os.path.isdir(self.path): + print '-- skipping ' + self.path + ' as dir has been stripped. --' + return os.chdir(self.topmost_supermodule_path_prefix) if os.path.isdir(self.path): @@ -309,22 +315,22 @@ class Submodule: os.chdir(oldCwd) return flattened_submodules - def readSubmodules(self): + def readSubmodules(self, use_deps=False): submodules = [] - if self.ref: + if use_deps: submodules = resolver.readSubmodules() print 'DEPS file provides the following submodules:' for submodule in submodules: print '{:<80}'.format(submodule.pathRelativeToTopMostSupermodule()) + '{:<120}'.format(submodule.url) + submodule.ref - else: # Try .gitmodules since no ref has been specified + else: # Try .gitmodules instead gitmodules_file_name = '.gitmodules' submodules = self.readSubmodulesFromGitModules(self, gitmodules_file_name, self.path) return submodules def initSubmodules(self): + submodules = self.readSubmodules() oldCwd = os.getcwd() os.chdir(self.path) - submodules = self.readSubmodules() for submodule in submodules: submodule.initialize() subprocessCall(['git', 'commit', '-a', '--amend', '--no-edit']) -- cgit v1.2.1