Skip to content

Commit

Permalink
refactor(docker): replace the multiple rosdep commands with `resolv…
Browse files Browse the repository at this point in the history
…e_rosdep_keys.sh`. (#5424)

* run resolve_rosdep_keys.sh

Signed-off-by: Yutaka Kondo <[email protected]>

* style(pre-commit): autofix

* update .dockerignore

Signed-off-by: Yutaka Kondo <[email protected]>

* chmod +x

Signed-off-by: Yutaka Kondo <[email protected]>

* fix location

Signed-off-by: Yutaka Kondo <[email protected]>

* remove rosdep update

Signed-off-by: Yutaka Kondo <[email protected]>

---------

Signed-off-by: Yutaka Kondo <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
youtalk and pre-commit-ci[bot] authored Nov 12, 2024
1 parent 21aa069 commit e637867
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 60 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Ignore Docker files
docker
!docker/etc
!docker/scripts

# Ignore a part of files under src
src/**/.*
Expand Down
74 changes: 14 additions & 60 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ ARG ROS_DISTRO

COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/
COPY ansible/ /autoware/ansible/
COPY docker/scripts/resolve_rosdep_keys.sh /autoware/resolve_rosdep_keys.sh
RUN chmod +x /autoware/resolve_rosdep_keys.sh
WORKDIR /autoware

RUN rm -f /etc/apt/apt.conf.d/docker-clean \
Expand All @@ -64,21 +66,13 @@ RUN --mount=type=ssh \

# Generate install package lists
COPY src/core /autoware/src/core
RUN rosdep update && rosdep keys --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN rosdep update && /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-core-depend-packages.txt \
&& cat /rosdep-core-depend-packages.txt

COPY src/universe/external /autoware/src/universe/external
COPY src/universe/autoware.universe/common /autoware/src/universe/autoware.universe/common
RUN rosdep keys --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-common-depend-packages.txt \
&& cat /rosdep-universe-common-depend-packages.txt

Expand All @@ -88,18 +82,10 @@ ARG ROS_DISTRO

COPY src/universe/autoware.universe/perception /autoware/src/universe/autoware.universe/perception
COPY src/universe/autoware.universe/sensing /autoware/src/universe/autoware.universe/sensing
RUN rosdep keys --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-sensing-perception-depend-packages.txt \
&& cat /rosdep-universe-sensing-perception-depend-packages.txt
RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-sensing-perception-exec-depend-packages.txt \
&& cat /rosdep-universe-sensing-perception-exec-depend-packages.txt

Expand All @@ -109,18 +95,10 @@ ARG ROS_DISTRO

COPY src/universe/autoware.universe/localization /autoware/src/universe/autoware.universe/localization
COPY src/universe/autoware.universe/map /autoware/src/universe/autoware.universe/map
RUN rosdep keys --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-localization-mapping-depend-packages.txt \
&& cat /rosdep-universe-localization-mapping-depend-packages.txt
RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-localization-mapping-exec-depend-packages.txt \
&& cat /rosdep-universe-localization-mapping-exec-depend-packages.txt

Expand All @@ -135,18 +113,10 @@ COPY src/universe/autoware.universe/map/map_loader /autoware/src/universe/autowa
COPY src/universe/autoware.universe/map/autoware_map_projection_loader /autoware/src/universe/autoware.universe/map/autoware_map_projection_loader
COPY src/universe/autoware.universe/sensing/autoware_pcl_extensions /autoware/src/universe/autoware.universe/sensing/autoware_pcl_extensions
COPY src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor /autoware/src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor
RUN rosdep keys --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-planning-control-depend-packages.txt \
&& cat /rosdep-universe-planning-control-depend-packages.txt
RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-planning-control-exec-depend-packages.txt \
&& cat /rosdep-universe-planning-control-exec-depend-packages.txt

Expand All @@ -158,18 +128,10 @@ COPY src/universe/autoware.universe/vehicle /autoware/src/universe/autoware.univ
COPY src/universe/autoware.universe/system /autoware/src/universe/autoware.universe/system
COPY src/universe/autoware.universe/map/autoware_map_height_fitter /autoware/src/universe/autoware.universe/map/autoware_map_height_fitter
COPY src/universe/autoware.universe/localization/autoware_pose2twist /autoware/src/universe/autoware.universe/localization/autoware_pose2twist
RUN rosdep keys --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-vehicle-system-depend-packages.txt \
&& cat /rosdep-universe-vehicle-system-depend-packages.txt
RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-vehicle-system-exec-depend-packages.txt \
&& cat /rosdep-universe-vehicle-system-exec-depend-packages.txt

Expand All @@ -183,19 +145,11 @@ COPY src/sensor_component /autoware/src/sensor_component
COPY src/sensor_kit /autoware/src/sensor_kit
COPY src/universe /autoware/src/universe
COPY src/vehicle /autoware/src/vehicle
RUN rosdep keys --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-universe-depend-packages.txt \
&& cat /rosdep-universe-depend-packages.txt

RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-exec-depend-packages.txt \
&& cat /rosdep-exec-depend-packages.txt

Expand Down
14 changes: 14 additions & 0 deletions docker/scripts/resolve_rosdep_keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

function resolve_rosdep_keys() {
local src_path=$1
local ros_distro=$2

rosdep keys --ignore-src --from-paths "$src_path" |
xargs rosdep resolve --rosdistro "$ros_distro" |
grep -v '^#' |
sed 's/ \+/\n/g' |
sort
}

resolve_rosdep_keys "$@"

0 comments on commit e637867

Please sign in to comment.