Skip to content

Commit

Permalink
Now supporting skipping compilation and rosdep checks (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
gstavrinos committed May 29, 2023
1 parent f9a4715 commit 0e7c942
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ or
* [For versions >= `v1.2.3`] The installer script now checks if the user is in the docker group, and if not adds them and prompts for reboot at the end of the installation.
* [For versions >= `v1.3.0`] A ROS Melodic version is now available (with the `rosezm` command) and a much more robust locking mechanism is now in effect. If you experienced frequent lockouts or race conditions, this version should be more stable.
* [For versions >= `v1.4.0`] All supported ROS versions (melodic/noetic/humble) now work on a completely persistent filesystem to save apt, library and other installations + all other user-defined changes on the container. Additionally, this version also supports audio, enabling users to play sounds through the `rosez` containers.
* [For versions >= `v1.5.0`] The `sc` or `skip-compilation` flag is now supported, which completely bypasses rosdep and catkin/colcon builds for faster startup.

## Tested platforms
* EndeavourOS
Expand Down
27 changes: 16 additions & 11 deletions internal/entrypoint.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
lock_file=$LOCKFILE
skip_compilation=$SKIPCOMPILATION
rosversion="unknown"
lockation=""
wstxt="ros2_ws.txt"
Expand Down Expand Up @@ -30,24 +31,28 @@ if [ "$rosversion" != "unknown" ]; then
while read -r line; do
bl="$(basename $line)"
cd /opt/ros/$bl
# Check if -r is better here instead of -i (rosdep check/install -r)
# I think I should just add both (-ir)
if rosdep check -ir --from-path src --rosdistro $rosversion -y | grep -q 'System dependencies have not been satisfied'; then
intermediate_error_handler $?
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "sudo apt update" | tee /dev/fd/2)
if [ $skip_compilation -ne 1 ]; then
if rosdep check -ir --from-path src --rosdistro $rosversion -y | grep -q 'System dependencies have not been satisfied'; then
intermediate_error_handler $?
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "sudo apt update" | tee /dev/fd/2)

intermediate_error_handler $?
fi
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "rosdep install -ir --from-path src --rosdistro $rosversion -y" | tee /dev/fd/2)
intermediate_error_handler $?
fi
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "rosdep install -ir --from-path src --rosdistro $rosversion -y" | tee /dev/fd/2)
intermediate_error_handler $?
if [ "$rosversion" == "humble" ]; then
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo" | tee /dev/fd/2)
intermediate_error_handler $?
if [ $skip_compilation -ne 1 ]; then
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo" | tee /dev/fd/2)
intermediate_error_handler $?
fi
. /opt/ros/$bl/install/setup.bash
intermediate_error_handler $?
else
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "catkin_make" | tee /dev/fd/2)
intermediate_error_handler $?
if [ $skip_compilation -ne 1 ]; then
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "catkin_make" | tee /dev/fd/2)
intermediate_error_handler $?
fi
. /opt/ros/$bl/devel/setup.bash
intermediate_error_handler $?
fi
Expand Down
10 changes: 7 additions & 3 deletions internal/rosez_exec.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ uptime_date="$(uptime -s | sed "s/[: ]/_/g")"
# This should enable the "a reboot should fix it" behaviour
earliest_possible_lock_file="$lock_prefix$uptime_date$lock_suffix"
lock_file="$lock_prefix$now$lock_suffix"
known_params=("force-integrated" "clear-locks")
known_params_short=("fi" "cl")
known_params=("force-integrated" "clear-locks" "skip-compilation")
known_params_short=("fi" "cl" "sc")
rosws_file="ros2_ws.txt"
rosez_vol="ros2ez-volume"
ros="humble"
ros_image="ros2_ez"
gpu_string=$(lspci | grep VGA)
gpu_param=""
clear_locks=0
skip_compilation=0
lockdir=""
if [ "$1" == "1" ]; then
rosws_file="ros_ws.txt"
Expand Down Expand Up @@ -55,6 +56,9 @@ for i in "${!known_params[@]}"; do
elif [ "${known_params[1]}" == "$1" ] || [ "${known_params_short[1]}" == "$1" ]; then
clear_locks=1
shift
elif [ "${known_params[2]}" == "$1" ] || [ "${known_params_short[2]}" == "$1" ]; then
skip_compilation=1
shift
else
break
fi
Expand Down Expand Up @@ -126,7 +130,7 @@ intermediate_error_handler $?
/bin/bash -c "xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $xauthf nmerge -"
intermediate_error_handler $?
cl=""
extras="env $ENV LOCKFILE=$lock_file /bin/bash"
extras="env $ENV LOCKFILE=$lock_file SKIPCOMPILATION=$skip_compilation /bin/bash"
if [ $# -gt 0 ]; then
extras=$extras" -c \"source /home/rosez_user/.bashrc && $* \""
fi
Expand Down

0 comments on commit 0e7c942

Please sign in to comment.