Skip to content

Commit

Permalink
all tests passing, issue ESCOMP#50 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Jul 4, 2024
1 parent 62a338b commit ded91fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
15 changes: 8 additions & 7 deletions git_fleximod/git_fleximod.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,13 @@ def git_toplevelroot(root_dir, logger):
superroot = rgit.git_operation("rev-parse", "--show-superproject-working-tree")
return superroot

def submodules_update(gitmodules, root_dir, requiredlist, force):
submodules = {}
def submodules_update(gitmodules, root_dir, requiredlist, force, submodules=None):
if not submodules:
submodules = {}
for name in gitmodules.sections():
if not submodules or name not in submodules:
submodules[name] = init_submodule_from_gitmodules(gitmodules, name, root_dir, logger)

_, needsupdate, localmods, testfails = submodules[name].status()
if not submodules[name].fxrequired:
submodules[name].fxrequired = "AlwaysRequired"
Expand All @@ -235,24 +237,23 @@ def submodules_update(gitmodules, root_dir, requiredlist, force):
or fxrequired not in requiredlist)
):
if "Optional" in fxrequired and "Optional" not in requiredlist:
print(f"Skipping optional component {name:>20}")
if fxrequired.startswith("Always"):
print(f"Skipping optional component {name:>20}")
continue
optional = "AlwaysOptional" in requiredlist
print(f"1 Required list is {requiredlist} optional is {optional}")

if fxrequired in requiredlist:
submodules[name].update()
repodir = os.path.join(root_dir, submodules[name].path)
if os.path.exists(os.path.join(repodir, ".gitmodules")):
# recursively handle this checkout
print(f"Recursively checking out submodules of {name}")
gitmodules = GitModules(submodules[name].logger, confpath=repodir)
gitsubmodules = GitModules(submodules[name].logger, confpath=repodir)
requiredlist = ["AlwaysRequired"]
if optional:
requiredlist.append("AlwaysOptional")
print(f"2 Required list is {requiredlist}")
submodules_update(gitmodules, repodir, requiredlist, force=force)

submodules_update(gitsubmodules, repodir, requiredlist, force=force, submodules=submodules)


def local_mods_output():
Expand Down
13 changes: 11 additions & 2 deletions git_fleximod/submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ def status(self):
needsupdate = True
return result, needsupdate, localmods, testfails
rurl = git.git_operation("ls-remote","--get-url").rstrip()
atag = git.git_operation("describe", "--tags", "--always").rstrip()
ahash = git.git_operation("rev-list", "HEAD").partition("\n")[0]
line = git.git_operation("log", "--pretty=format:\"%h %d").partition('\n')[0]
parts = line.split()
ahash = parts[0][1:]
if len(parts) > 3:
atag = parts[3][:-1]
else:
atag = None

#print(f"line is {line} ahash is {ahash} atag is {atag}")
# atag = git.git_operation("describe", "--tags", "--always").rstrip()
# ahash = git.git_operation("rev-list", "HEAD").partition("\n")[0]

recurse = False
if rurl != self.url:
Expand Down

0 comments on commit ded91fd

Please sign in to comment.