hw: lxbuildenv: fix uninitialized repo issue
We would get stuck in a loop. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
3df59a866d
commit
f34601df98
@ -229,9 +229,9 @@ def check_dependencies(args, dependency_list):
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# Return True if the given tree needs to be initialized
|
# Return True if the given tree needs to be initialized
|
||||||
def check_module_recursive(root_path, depth, verbose=False):
|
def check_module_recursive(root_path, depth, verbose=False, breadcrumbs=[]):
|
||||||
if verbose:
|
if verbose:
|
||||||
print('git-dep: checking if "{}" requires updating...'.format(root_path))
|
print('git-dep: checking if "{}" requires updating (depth: {})...'.format(root_path, depth))
|
||||||
|
|
||||||
# If the directory isn't a valid git repo, initialization is required
|
# If the directory isn't a valid git repo, initialization is required
|
||||||
git_dir_cmd = subprocess.Popen(["git", "rev-parse", "--show-toplevel"],
|
git_dir_cmd = subprocess.Popen(["git", "rev-parse", "--show-toplevel"],
|
||||||
@ -245,6 +245,12 @@ def check_module_recursive(root_path, depth, verbose=False):
|
|||||||
return True
|
return True
|
||||||
git_dir = git_stdout.decode().strip()
|
git_dir = git_stdout.decode().strip()
|
||||||
|
|
||||||
|
if git_dir in breadcrumbs:
|
||||||
|
if verbose:
|
||||||
|
print('git-dep: root path {} is not in git path'.format(root_path))
|
||||||
|
return True
|
||||||
|
breadcrumbs.append(git_dir)
|
||||||
|
|
||||||
if not os.path.exists(git_dir + os.path.sep + '.git'):
|
if not os.path.exists(git_dir + os.path.sep + '.git'):
|
||||||
if verbose:
|
if verbose:
|
||||||
print('git-dep: .git not found in "{}"'.format(git_dir))
|
print('git-dep: .git not found in "{}"'.format(git_dir))
|
||||||
@ -262,7 +268,7 @@ def check_module_recursive(root_path, depth, verbose=False):
|
|||||||
parts = line.split("=", 2)
|
parts = line.split("=", 2)
|
||||||
if parts[0].strip() == "path":
|
if parts[0].strip() == "path":
|
||||||
path = parts[1].strip()
|
path = parts[1].strip()
|
||||||
if check_module_recursive(git_dir + os.path.sep + path, depth + 1, verbose=verbose):
|
if check_module_recursive(git_dir + os.path.sep + path, depth + 1, verbose=verbose, breadcrumbs=breadcrumbs):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user