|  | @@ -21,16 +21,20 @@ def main():
 | 
	
		
			
				|  |  |          clone_repo_cached( args.output_dir, source_url.geturl(), args.tag,
 | 
	
		
			
				|  |  |              cache_dir=args.cache_dir, fetch_origin=(not args.no_fetch_origin))
 | 
	
		
			
				|  |  |      for ret in recurse_abe_submodules( args.output_dir, source_url, args.tag):
 | 
	
		
			
				|  |  | -        if args.execute_command:
 | 
	
		
			
				|  |  | +        if args.abe_command:
 | 
	
		
			
				|  |  |              executeAbeCommand( ret.path, args.execute_command )
 | 
	
		
			
				|  |  |          else:
 | 
	
		
			
				|  |  |              clone_repo_cached( ret.path, ret.remote, ret.ref,
 | 
	
		
			
				|  |  |                  cache_dir=args.cache_dir, fetch_origin=(not args.no_fetch_origin))
 | 
	
		
			
				|  |  | +        if args.execute_command:
 | 
	
		
			
				|  |  | +            from subprocess import run
 | 
	
		
			
				|  |  | +            run(args.execute_command, shell=True,check=True, cwd=ret.path)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  def parser():
 | 
	
		
			
				|  |  |      import argparse
 | 
	
		
			
				|  |  |      p = argparse.ArgumentParser()
 | 
	
		
			
				|  |  | +    p.add_argument('-a', '--abe_command', default=None)
 | 
	
		
			
				|  |  |      p.add_argument('-d', '--debug', action='count', default=1)
 | 
	
		
			
				|  |  |      p.add_argument('-q', '--quiet', action='store_true')
 | 
	
		
			
				|  |  |      p.add_argument('-o', '--output_dir', default='.')
 | 
	
	
		
			
				|  | @@ -58,13 +62,12 @@ def recurse_abe_submodules(path, remote, ref, parent=None):
 | 
	
		
			
				|  |  |      sub = AbeSubmodule([path, url.geturl(), ref], AbeSubType.SUBMODULE, parent)
 | 
	
		
			
				|  |  |      yield sub
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    subm = get_abe_tree( path )
 | 
	
		
			
				|  |  | +    subm = get_abe_subtree( path )
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      for su in subm:
 | 
	
		
			
				|  |  | -        newpath = os.path.normpath(os.path.join( sub.path, su.path))
 | 
	
		
			
				|  |  | -        newurl = su.urlparse(url)
 | 
	
		
			
				|  |  | -        print(f"Repo: \"{path}\" has Submodule: \"{newpath}\" Type: \"{su.subtype}\" From: \"{newurl.geturl()}\"") if DEBUG else None
 | 
	
		
			
				|  |  | -        for ret in recurse_abe_submodules( newpath, newurl, su.ref, sub):
 | 
	
		
			
				|  |  | +        su.parent = sub
 | 
	
		
			
				|  |  | +        for ret in recurse_abe_submodules( su.fullpath, su.url, su.ref, sub):
 | 
	
		
			
				|  |  | +            print(f"Repo: \"{path}\" has Submodule: \"{su.fullpath}\" Type: \"{su.subtype}\" From: \"{su.url.geturl()}\"") if DEBUG else None
 | 
	
		
			
				|  |  |              yield ret
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -207,17 +210,28 @@ class AbeSubmodule():
 | 
	
		
			
				|  |  |      def __repr__(self):
 | 
	
		
			
				|  |  |          return f"AbeSubmodule(['{self.path}','{self.remote}','{self.ref}'], {self.subtype}, {self.parent})"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    def urlparse(self, parent_url):
 | 
	
		
			
				|  |  | +    @property
 | 
	
		
			
				|  |  | +    def url(self):
 | 
	
		
			
				|  |  |          from urllib.parse import urlparse
 | 
	
		
			
				|  |  | -        suurl = urlparse(self.remote)
 | 
	
		
			
				|  |  | -        newurl = parent_url._replace(path=suurl.path)
 | 
	
		
			
				|  |  | -        if suurl.netloc:
 | 
	
		
			
				|  |  | -            newurl = newurl._replace(netloc=suurl.netloc)
 | 
	
		
			
				|  |  | -        if suurl.scheme:
 | 
	
		
			
				|  |  | -            newurl = newurl._replace(scheme=suurl.scheme)
 | 
	
		
			
				|  |  | +        if not self.parent:
 | 
	
		
			
				|  |  | +            return urlparse(self.remote)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        surl = urlparse(self.remote)
 | 
	
		
			
				|  |  | +        newurl = self.parent.url._replace(path=surl.path)
 | 
	
		
			
				|  |  | +        if surl.netloc:
 | 
	
		
			
				|  |  | +            newurl = newurl._replace(netloc=surl.netloc)
 | 
	
		
			
				|  |  | +        if surl.scheme:
 | 
	
		
			
				|  |  | +            newurl = newurl._replace(scheme=surl.scheme)
 | 
	
		
			
				|  |  |          return newurl
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -def get_abe_tree(repo_dir):
 | 
	
		
			
				|  |  | +    @property
 | 
	
		
			
				|  |  | +    def fullpath(self):
 | 
	
		
			
				|  |  | +        if not self.parent:
 | 
	
		
			
				|  |  | +            return self.path
 | 
	
		
			
				|  |  | +        import os.path
 | 
	
		
			
				|  |  | +        return os.path.normpath(os.path.join( self.parent.path, self.path))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +def get_abe_subtree(repo_dir):
 | 
	
		
			
				|  |  |      import itertools
 | 
	
		
			
				|  |  |      subfile_generators = [
 | 
	
		
			
				|  |  |          get_abe_bsps(repo_dir),
 |