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:
		@@ -229,9 +229,9 @@ def check_dependencies(args, dependency_list):
 | 
			
		||||
        sys.exit(0)
 | 
			
		||||
 | 
			
		||||
# 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:
 | 
			
		||||
        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
 | 
			
		||||
    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
 | 
			
		||||
    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 verbose:
 | 
			
		||||
            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)
 | 
			
		||||
        if parts[0].strip() == "path":
 | 
			
		||||
            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 False
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user