afrl-rq / OpenUxAS

Project for multi-UAV cooperative decision making

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot run `./anod build amase` when cloned as submodule

obicons opened this issue · comments

Hello,

I tried adding this repository as a git submodule of another. However, I found that I am unable to build amase when I do this. This message appears in the build logs:

DEBUG    sync_tree . -> /home/$USER/OpenUxAS/infrastructure/sbx/vcs/openuxas [delete=True, preserve_stmp=False]

This motivated me to investigate sync_tree. It appears that the ignore list is improperly initialized in this case, which causes the directory that appears in the debug message to recursively copy into itself. I tested this by modifying the appropriate call to sync_tree so that this directory is appropriately ignored. That fixed the issue. However, this was really hacky, and I'm not sure how a proper fix should work.

Thanks for letting us know. None of the current OpenUxAS developers use git submodules, so we'll have to investigate this further and see whether we can come up with a proper fix.

I'll see about building a reproducer locally so I can investigate. I suspect this is an issue in e3-core. If I can confirm that it is, I'll open the issue there and propose a fix.

I've reproduced the behavior described. e3.fs.sync_tree is not being given the contents of the .gitignore when OpenUxAS is a submodule rather than a "normal" clone. This is because, in e3.anod.checkout.py we have the following:

        if os.path.isdir(os.path.join(url, ".git")):
            # It seems that this is a git repository. Get the list of files to
            # ignore
            try:
                g = GitRepository(working_tree=url)
                ignore_list_lines = g.git_cmd(
                    [
                        "ls-files",
                        "-o",
                        "--ignored",
                        "--exclude-standard",
                        "--directory",
                    ],
                    output=PIPE,
                ).out
                ignore_list = [
                    "/%s" % f.strip().rstrip("/")
                    for f in ignore_list_lines.splitlines()
                ]
                logger.debug("Ignore in external: %s", ignore_list)
            except Exception:
                # don't crash on exception
                pass

This is too specific - we shouldn't be looking for a .git directory - we should also accept a .git file: a submodule's .git is a regular file that "points to" the parent repository's .git directory. So the isdir should be replaced by exists. I've confirmed this change will solve the problem.

I've opened AdaCore/e3-core/issues/522 to track this. Once a fix is accepted there, I'll confirm this issue is fully resolved and close it.

In the meantime, @obicons using your hacky workaround will be your best bet.

This has been fixed in the upstream, but we're waiting for a new release of AdaCore/e3-core to be available at pypi - we install e3-core through pip, so we won't benefit from the fix until that happens. I'll update and close this ticket when there's a new release.

This is now confirmed to be fixed. @obicons, in your OpenUxAS submodule, you should:

  • git pull to get the latest changes
  • rm -rf .vpython to "uninstall" the anod support - this is needed because the e3-core dependency changed and should be re-fetched from pypi

Then you should be able to anod build uxas and things should work.