Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to skip .repo files in the cloned repository #10

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ COPY docker/docker-ros/docker/recursive_vcs_import.py /usr/local/bin
RUN apt-get update && \
apt-get install -y python-is-python3 && \
rm -rf /var/lib/apt/lists/*
RUN /usr/local/bin/recursive_vcs_import.py src src/upstream
ARG ENABLE_RECURSIVE_CLONED="True"
RUN /usr/local/bin/recursive_vcs_import.py src src/upstream ${ENABLE_RECURSIVE_CLONED}
Comment on lines +59 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to fall back to just calling vcs import directly, if recursion is disabled. Somewhat goes against the naming of recursive_vcs_import.py otherwise.

Suggested change
ARG ENABLE_RECURSIVE_CLONED="True"
RUN /usr/local/bin/recursive_vcs_import.py src src/upstream ${ENABLE_RECURSIVE_CLONED}
ARG ENABLE_RECURSIVE_CLONED="true"
RUN if [[ $ENABLE_RECURSIVE_ADDITIONAL_DEBS == 'true' ]]; then \
/usr/local/bin/recursive_vcs_import.py src src/upstream ; \
else \
# vcs import ... ; \
fi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to include every *.repo files in the current directory just using the vcs import command? I could see the benefit of a repository having for instance "hardware.repo", "vision.repo", etc. Thus, when I added the flag I was still interested in the recursive search, just not for the cloned packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @lreiher

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have discussed this with my peers and we don't really see the necessity for multiple top-level .repo files that are all found. Either there is one that you would like to include, or you want to search recursively. The only additional argument that we could see being integrated is to have a variable for configuring the script to search for another filename, e.g., vision.repo instead of .repos. Similar to how you can configure CUSTOM_SCRIPT_FILE.


# create install script with list of rosdep dependencies
RUN echo "set -e" >> $WORKSPACE/.install-dependencies.sh && \
Expand Down
7 changes: 5 additions & 2 deletions docker/recursive_vcs_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import List, Optional


def findDotRepos(search_path: str, clone_path: Optional[str]=None) -> List[pathlib.Path]:
def findDotRepos(search_path: str, clone_path: Optional[str] = None) -> List[pathlib.Path]:

repos = list(pathlib.Path(search_path).glob("**/*.repos"))
if clone_path is not None:
Expand All @@ -17,11 +17,14 @@ def main():

search_path = sys.argv[1] if len(sys.argv) > 1 else "."
clone_path = sys.argv[2] if len(sys.argv) > 2 else "."
recursive_cloned = sys.argv[3].lower() == "true" if len(sys.argv) > 3 else True
cloned_repos = []
found_repos = []

while True:

found_repos = findDotRepos(search_path, clone_path)
if recursive_cloned or not found_repos:
found_repos = findDotRepos(search_path, clone_path)
remaining_repos = set(found_repos) - set(cloned_repos)

if not remaining_repos:
Expand Down
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build_image() {
$(if [[ -n "${ENABLE_RECURSIVE_ADDITIONAL_PIP}" ]]; then echo "--build-arg ENABLE_RECURSIVE_ADDITIONAL_PIP=${ENABLE_RECURSIVE_ADDITIONAL_PIP}"; fi) \
$(if [[ -n "${CUSTOM_SCRIPT_FILE}" ]]; then echo "--build-arg CUSTOM_SCRIPT_FILE=${CUSTOM_SCRIPT_FILE}"; fi) \
$(if [[ -n "${ENABLE_RECURSIVE_CUSTOM_SCRIPT}" ]]; then echo "--build-arg ENABLE_RECURSIVE_CUSTOM_SCRIPT=${ENABLE_RECURSIVE_CUSTOM_SCRIPT}"; fi) \
$(if [[ -n "${ENABLE_RECURSIVE_CLONED}" ]]; then echo "--build-arg ENABLE_RECURSIVE_CLONED=${ENABLE_RECURSIVE_CLONED}"; fi) \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to name the variable ENABLE_RECURSIVE_VCS_IMPORT.

It also still needs to be added to the README.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new variable must also be added to action.yml and .gitlab-ci.yml.

.
echo "Successfully built stage '${TARGET}' for platform '${PLATFORM}' as '${IMAGE}'"
}
Expand Down