From c9d3761058ae0742cbe5e218281bddce2162f51a Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Fri, 7 Jan 2022 08:17:05 +0900 Subject: [PATCH 01/19] [jsk_fetch_startup] catkin clean libcmt before build in daily update_workspace.sh --- jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index f27e401366..bd90be1d83 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -13,7 +13,7 @@ wstool foreach --git 'git stash' wstool update --delete-changed-uris WSTOOL_UPDATE_RESULT=$? cd $HOME/ros/melodic -catkin clean aques_talk collada_urdf_jsk_patch -y +catkin clean aques_talk collada_urdf_jsk_patch libcmt -y catkin init catkin config -DCMAKE_BUILD_TYPE=Release catkin build From e747d201eb8ba8b0f5aef74ac7942dc2e2eda1e9 Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Fri, 15 Apr 2022 18:15:21 +0900 Subject: [PATCH 02/19] [jsk_fetch_startup] update workspace script --- .../jsk_fetch_startup/scripts/update_workspace.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index bd90be1d83..58ed7b710b 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -8,10 +8,16 @@ LOGFILE=$HOME/ros/melodic/update_workspace.txt set -x # Update workspace cd $HOME/ros/melodic/src +if [ -e $HOME/ros/melodic/src/.rosinstall]; then + rm $HOME/ros/melodic/src/.rosinstall +fi ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $HOME/ros/melodic/src/.rosinstall wstool foreach --git 'git stash' wstool update --delete-changed-uris +wstool foreach --git 'branch-name=$(git rev-parse --abbrev-ref HEAD) && git reset --hard HEAD && git checkout origin/$branch-name && git branch -D $branch-name && git checkout $branch-name' # Forcefully checkout specified branch +wstool update WSTOOL_UPDATE_RESULT=$? +# Build workspace cd $HOME/ros/melodic catkin clean aques_talk collada_urdf_jsk_patch libcmt -y catkin init From a9f851f15e918ddc02c71905357f79bc84e232f5 Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Sat, 16 Apr 2022 20:34:21 +0900 Subject: [PATCH 03/19] [jsk_fetch_startup] remove redundant section --- jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index 58ed7b710b..4035e45eb6 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -8,9 +8,6 @@ LOGFILE=$HOME/ros/melodic/update_workspace.txt set -x # Update workspace cd $HOME/ros/melodic/src -if [ -e $HOME/ros/melodic/src/.rosinstall]; then - rm $HOME/ros/melodic/src/.rosinstall -fi ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $HOME/ros/melodic/src/.rosinstall wstool foreach --git 'git stash' wstool update --delete-changed-uris From b168bf0cf4ac5674146f150cb931824dd638b366 Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Mon, 18 Apr 2022 14:39:53 +0900 Subject: [PATCH 04/19] [jsk_fetch_startup] parameterize workspace path and make it as argument --- .../scripts/update_workspace.sh | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index 4035e45eb6..a2d9892cf5 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -1,21 +1,46 @@ #!/usr/bin/env bash -. $HOME/ros/melodic/devel/setup.bash +function usage() +{ + echo "Usage: $0 [-w workspace_directory] [-h]" +} + +WORKSPACE=$HOME/ros/melodic/ + +while getopts hw: OPT +do + case $OPT in + w) + WORKSPACE=$(cd $(dirname $OPTARG) && pwd)/$(basename $OPTARG) + ;; + h) + usage + exit 1 + ;; + esac +done + +if [ ! -e $WORKSPACE ]; then + echo "No workspace $WORKSPACE" + exit 1 +fi + +. $WORKSPACE/devel/setup.bash # Filename should end with .txt to preview the contents in a web browser -LOGFILE=$HOME/ros/melodic/update_workspace.txt +LOGFILE=$WORKSPACE/update_workspace.txt { set -x # Update workspace -cd $HOME/ros/melodic/src -ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $HOME/ros/melodic/src/.rosinstall +cd $WORKSPACE/src +ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $WORKSPACE/src/.rosinstall wstool foreach --git 'git stash' wstool update --delete-changed-uris wstool foreach --git 'branch-name=$(git rev-parse --abbrev-ref HEAD) && git reset --hard HEAD && git checkout origin/$branch-name && git branch -D $branch-name && git checkout $branch-name' # Forcefully checkout specified branch wstool update WSTOOL_UPDATE_RESULT=$? # Build workspace -cd $HOME/ros/melodic +cd $WORKSPACE catkin clean aques_talk collada_urdf_jsk_patch libcmt -y catkin init catkin config -DCMAKE_BUILD_TYPE=Release From 92a8a9e9a161a61ba8e0a69c1f267c1f29f1014e Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Mon, 18 Apr 2022 15:02:37 +0900 Subject: [PATCH 05/19] [jsk_fetch_startup] update update_workspace.sh --- .../jsk_fetch_startup/scripts/update_workspace.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index a2d9892cf5..fe716ed534 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -32,12 +32,12 @@ LOGFILE=$WORKSPACE/update_workspace.txt { set -x # Update workspace -cd $WORKSPACE/src +wstool -t $WORKSPACE/src foreach --git 'git stash' +wstool -t $WORKSPACE/src update jsk-ros-pkg/jsk_robot ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $WORKSPACE/src/.rosinstall -wstool foreach --git 'git stash' -wstool update --delete-changed-uris -wstool foreach --git 'branch-name=$(git rev-parse --abbrev-ref HEAD) && git reset --hard HEAD && git checkout origin/$branch-name && git branch -D $branch-name && git checkout $branch-name' # Forcefully checkout specified branch -wstool update +wstool -t $WORKSPACE/src update --delete-changed-uris +wstool -t $WORKSPACE/src foreach --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout $branchname' # Forcefully checkout specified branch +wstool -t $WORKSPACE/src update WSTOOL_UPDATE_RESULT=$? # Build workspace cd $WORKSPACE From 4b68ffa5342d9d3bb9c66e68ec1254a2d4f60cda Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Tue, 19 Apr 2022 09:44:46 +0900 Subject: [PATCH 06/19] [jsk_fetch_startup] update workspace script --- .../scripts/update_workspace.sh | 56 +++++++++++++++---- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index fe716ed534..d0ce39357f 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -2,21 +2,35 @@ function usage() { - echo "Usage: $0 [-w workspace_directory] [-h]" + echo "Usage: $0 [-w workspace_directory] [-h] [-l] + +optional arguments: + -h show this help + -w WORKSPACE_PATH specify target workspace + -l do not send a mail +" } +SEND_MAIL=true WORKSPACE=$HOME/ros/melodic/ -while getopts hw: OPT +while getopts hlw: OPT do case $OPT in w) WORKSPACE=$(cd $(dirname $OPTARG) && pwd)/$(basename $OPTARG) ;; + l) + SEND_MAIL=false + ;; h) usage exit 1 ;; + *) + usage + exit 1 + ;; esac done @@ -32,32 +46,52 @@ LOGFILE=$WORKSPACE/update_workspace.txt { set -x # Update workspace -wstool -t $WORKSPACE/src foreach --git 'git stash' -wstool -t $WORKSPACE/src update jsk-ros-pkg/jsk_robot +wstool foreach -t $WORKSPACE/src --git 'git stash' +wstool update -t $WORKSPACE/src jsk-ros-pkg/jsk_robot ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $WORKSPACE/src/.rosinstall -wstool -t $WORKSPACE/src update --delete-changed-uris -wstool -t $WORKSPACE/src foreach --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout $branchname' # Forcefully checkout specified branch -wstool -t $WORKSPACE/src update +wstool update -t $WORKSPACE/src --delete-changed-uris +wstool foreach -t $WORKSPACE/src --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout $branchname' # Forcefully checkout specified branch +wstool update -t $WORKSPACE/src WSTOOL_UPDATE_RESULT=$? +# Rosdep Install +sudo apt-get update -y +rosdep update +# jsk_footstep_planner is not released for melodic +# jsk_footstep_controller is not released for melodic +# librealsense2 should not be installed from ROS repository +# realsense-ros should not be installed from ROS repository +rosdep install --from-paths $WORKSPACE/src --ignore-src -y -r --skip-keys \ +"\ +jsk_footstep_controller \ +jsk_footstep_planner \ +librealsense2 \ +realsense2_camera \ +realsense2_description \ +" +ROSDEP_INSTALL_RESULT=$? # Build workspace cd $WORKSPACE catkin clean aques_talk collada_urdf_jsk_patch libcmt -y catkin init catkin config -DCMAKE_BUILD_TYPE=Release -catkin build +catkin build --continue-on-failure CATKIN_BUILD_RESULT=$? # Send mail MAIL_BODY="" if [ $WSTOOL_UPDATE_RESULT -ne 0 ]; then MAIL_BODY=$MAIL_BODY"Please wstool update workspace manually. " fi +if [ $ROSDEP_INSTALL_RESULT -ne 0 ]; then + MAIL_BODY=$MAIL_BODY"Please install dependencies manually. " +fi if [ $CATKIN_BUILD_RESULT -ne 0 ]; then MAIL_BODY=$MAIL_BODY"Please catkin build workspace manually." fi set +x -} > $LOGFILE 2>&1 -if [ -n "$MAIL_BODY" ]; then - rostopic pub -1 /email jsk_robot_startup/Email "header: +} 2>&1 | tee $LOGFILE +if [ -n "$MAIL_BODY" ] && [ "${SEND_MAIL}" == "true" ]; then + echo "Sent a mail" + rostopic pub -1 /email jsk_robot_startup/Email "header: seq: 0 stamp: {secs: 0, nsecs: 0} frame_id: '' From c0a3e602bd9b6598b1ad1c58d1ef46970cb7b9cc Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Wed, 20 Apr 2022 09:11:59 +0900 Subject: [PATCH 07/19] [jsk_fetch_startup] fix default workspace path --- .../jsk_fetch_startup/scripts/update_workspace.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index d0ce39357f..7786444579 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -11,14 +11,19 @@ optional arguments: " } +function get_full_path() +{ + echo "$(cd $(dirname $1) && pwd)/$(basename $1)" +} + SEND_MAIL=true -WORKSPACE=$HOME/ros/melodic/ +WORKSPACE=$(get_full_path $HOME/ros/melodic) while getopts hlw: OPT do case $OPT in w) - WORKSPACE=$(cd $(dirname $OPTARG) && pwd)/$(basename $OPTARG) + WORKSPACE=$(get_full_path $OPTARG) ;; l) SEND_MAIL=false @@ -46,11 +51,14 @@ LOGFILE=$WORKSPACE/update_workspace.txt { set -x # Update workspace + wstool foreach -t $WORKSPACE/src --git 'git stash' +wstool foreach -t $WORKSPACE/src --git 'git fetch --all --prune' wstool update -t $WORKSPACE/src jsk-ros-pkg/jsk_robot ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $WORKSPACE/src/.rosinstall wstool update -t $WORKSPACE/src --delete-changed-uris -wstool foreach -t $WORKSPACE/src --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout $branchname' # Forcefully checkout specified branch +# Forcefully checkout specified branch +wstool foreach -t $WORKSPACE/src --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); if [ $branchname != "HEAD" ]; then git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout -b $branchname --track origin/$branchname; fi' wstool update -t $WORKSPACE/src WSTOOL_UPDATE_RESULT=$? # Rosdep Install From 3bfc466deedeed2590810280dc48ef0b7bb9c737 Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Wed, 27 Apr 2022 17:24:14 +0900 Subject: [PATCH 08/19] [jsk_fetch_startup] rename update_workspace.sh to update_workspace_main.sh and call it from update_workspace.sh --- .../scripts/update_workspace.sh | 113 +----------------- .../scripts/update_workspace_main.sh | 113 ++++++++++++++++++ 2 files changed, 115 insertions(+), 111 deletions(-) create mode 100755 jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index 7786444579..868f0cd1b2 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -1,113 +1,4 @@ #!/usr/bin/env bash -function usage() -{ - echo "Usage: $0 [-w workspace_directory] [-h] [-l] - -optional arguments: - -h show this help - -w WORKSPACE_PATH specify target workspace - -l do not send a mail -" -} - -function get_full_path() -{ - echo "$(cd $(dirname $1) && pwd)/$(basename $1)" -} - -SEND_MAIL=true -WORKSPACE=$(get_full_path $HOME/ros/melodic) - -while getopts hlw: OPT -do - case $OPT in - w) - WORKSPACE=$(get_full_path $OPTARG) - ;; - l) - SEND_MAIL=false - ;; - h) - usage - exit 1 - ;; - *) - usage - exit 1 - ;; - esac -done - -if [ ! -e $WORKSPACE ]; then - echo "No workspace $WORKSPACE" - exit 1 -fi - -. $WORKSPACE/devel/setup.bash -# Filename should end with .txt to preview the contents in a web browser -LOGFILE=$WORKSPACE/update_workspace.txt - -{ -set -x -# Update workspace - -wstool foreach -t $WORKSPACE/src --git 'git stash' -wstool foreach -t $WORKSPACE/src --git 'git fetch --all --prune' -wstool update -t $WORKSPACE/src jsk-ros-pkg/jsk_robot -ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $WORKSPACE/src/.rosinstall -wstool update -t $WORKSPACE/src --delete-changed-uris -# Forcefully checkout specified branch -wstool foreach -t $WORKSPACE/src --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); if [ $branchname != "HEAD" ]; then git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout -b $branchname --track origin/$branchname; fi' -wstool update -t $WORKSPACE/src -WSTOOL_UPDATE_RESULT=$? -# Rosdep Install -sudo apt-get update -y -rosdep update -# jsk_footstep_planner is not released for melodic -# jsk_footstep_controller is not released for melodic -# librealsense2 should not be installed from ROS repository -# realsense-ros should not be installed from ROS repository -rosdep install --from-paths $WORKSPACE/src --ignore-src -y -r --skip-keys \ -"\ -jsk_footstep_controller \ -jsk_footstep_planner \ -librealsense2 \ -realsense2_camera \ -realsense2_description \ -" -ROSDEP_INSTALL_RESULT=$? -# Build workspace -cd $WORKSPACE -catkin clean aques_talk collada_urdf_jsk_patch libcmt -y -catkin init -catkin config -DCMAKE_BUILD_TYPE=Release -catkin build --continue-on-failure -CATKIN_BUILD_RESULT=$? -# Send mail -MAIL_BODY="" -if [ $WSTOOL_UPDATE_RESULT -ne 0 ]; then - MAIL_BODY=$MAIL_BODY"Please wstool update workspace manually. " -fi -if [ $ROSDEP_INSTALL_RESULT -ne 0 ]; then - MAIL_BODY=$MAIL_BODY"Please install dependencies manually. " -fi -if [ $CATKIN_BUILD_RESULT -ne 0 ]; then - MAIL_BODY=$MAIL_BODY"Please catkin build workspace manually." -fi -set +x -} 2>&1 | tee $LOGFILE -if [ -n "$MAIL_BODY" ] && [ "${SEND_MAIL}" == "true" ]; then - echo "Sent a mail" - rostopic pub -1 /email jsk_robot_startup/Email "header: - seq: 0 - stamp: {secs: 0, nsecs: 0} - frame_id: '' -subject: 'Daily workspace update fails' -body: '$MAIL_BODY' -sender_address: '$(hostname)@jsk.imi.i.u-tokyo.ac.jp' -receiver_address: 'fetch@jsk.imi.i.u-tokyo.ac.jp' -smtp_server: '' -smtp_port: '' -attached_files: ['$LOGFILE']" -fi +cp $(rospack find jsk_fetch_startup)/scripts/update_workspace_main.sh /tmp/update_workspace.sh +/tmp/update_workspace.sh $@ diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh new file mode 100755 index 0000000000..74eb47693b --- /dev/null +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +function usage() +{ + echo "Usage: $0 [-w workspace_directory] [-h] [-l] + +optional arguments: + -h show this help + -w WORKSPACE_PATH specify target workspace + -l do not send a mail +" +} + +function get_full_path() +{ + echo "$(cd $(dirname $1) && pwd)/$(basename $1)" +} + +SEND_MAIL=true +WORKSPACE=$(get_full_path $HOME/ros/melodic) + +while getopts hlw: OPT +do + case $OPT in + w) + WORKSPACE=$(get_full_path $OPTARG) + ;; + l) + SEND_MAIL=false + ;; + h) + usage + exit 1 + ;; + *) + usage + exit 1 + ;; + esac +done + +if [ ! -e $WORKSPACE ]; then + echo "No workspace $WORKSPACE" + exit 1 +fi + +. $WORKSPACE/devel/setup.bash +# Filename should end with .txt to preview the contents in a web browser +LOGFILE=$WORKSPACE/update_workspace.txt + +{ +set -x +# Update workspace + +wstool foreach -t $WORKSPACE/src --git 'git stash' +wstool foreach -t $WORKSPACE/src --git 'git fetch origin --prune' +wstool update -t $WORKSPACE/src jsk-ros-pkg/jsk_robot +ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $WORKSPACE/src/.rosinstall +wstool update -t $WORKSPACE/src --delete-changed-uris +# Forcefully checkout specified branch +wstool foreach -t $WORKSPACE/src --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); if [ $branchname != "HEAD" ]; then git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout -b $branchname --track origin/$branchname; fi' +wstool update -t $WORKSPACE/src +WSTOOL_UPDATE_RESULT=$? +# Rosdep Install +sudo apt-get update -y +rosdep update +# jsk_footstep_planner is not released for melodic +# jsk_footstep_controller is not released for melodic +# librealsense2 should not be installed from ROS repository +# realsense-ros should not be installed from ROS repository +rosdep install --from-paths $WORKSPACE/src --ignore-src -y -r --skip-keys \ +"\ +jsk_footstep_controller \ +jsk_footstep_planner \ +librealsense2 \ +realsense2_camera \ +realsense2_description \ +" +ROSDEP_INSTALL_RESULT=$? +# Build workspace +cd $WORKSPACE +catkin clean aques_talk collada_urdf_jsk_patch libcmt -y +catkin init +catkin config -DCMAKE_BUILD_TYPE=Release +catkin build --continue-on-failure +CATKIN_BUILD_RESULT=$? +# Send mail +MAIL_BODY="" +if [ $WSTOOL_UPDATE_RESULT -ne 0 ]; then + MAIL_BODY=$MAIL_BODY"Please wstool update workspace manually. " +fi +if [ $ROSDEP_INSTALL_RESULT -ne 0 ]; then + MAIL_BODY=$MAIL_BODY"Please install dependencies manually. " +fi +if [ $CATKIN_BUILD_RESULT -ne 0 ]; then + MAIL_BODY=$MAIL_BODY"Please catkin build workspace manually." +fi +set +x +} 2>&1 | tee $LOGFILE +if [ -n "$MAIL_BODY" ] && [ "${SEND_MAIL}" == "true" ]; then + echo "Sent a mail" + rostopic pub -1 /email jsk_robot_startup/Email "header: + seq: 0 + stamp: {secs: 0, nsecs: 0} + frame_id: '' +subject: 'Daily workspace update fails' +body: '$MAIL_BODY' +sender_address: '$(hostname)@jsk.imi.i.u-tokyo.ac.jp' +receiver_address: 'fetch@jsk.imi.i.u-tokyo.ac.jp' +smtp_server: '' +smtp_port: '' +attached_files: ['$LOGFILE']" +fi From c6f9882fa8327ff244a46025af30288879326339 Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Mon, 4 Jul 2022 19:05:33 +0900 Subject: [PATCH 09/19] [jsk_fetch_startup] remove /tmp/update_workspace.sh after updating --- jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index 868f0cd1b2..5646eb2875 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -2,3 +2,4 @@ cp $(rospack find jsk_fetch_startup)/scripts/update_workspace_main.sh /tmp/update_workspace.sh /tmp/update_workspace.sh $@ +rm /tmp/update_workspace.sh From a104f74c17699240e802c62e74ac08c0f398abbf Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Thu, 15 Sep 2022 14:07:56 +0900 Subject: [PATCH 10/19] [jsk_fetch_startup] fix mailbody in update_workspace script --- .../jsk_fetch_startup/scripts/update_workspace_main.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh index 74eb47693b..041c18fd5d 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh @@ -48,6 +48,8 @@ fi # Filename should end with .txt to preview the contents in a web browser LOGFILE=$WORKSPACE/update_workspace.txt +MAIL_BODY="" + { set -x # Update workspace @@ -85,7 +87,6 @@ catkin config -DCMAKE_BUILD_TYPE=Release catkin build --continue-on-failure CATKIN_BUILD_RESULT=$? # Send mail -MAIL_BODY="" if [ $WSTOOL_UPDATE_RESULT -ne 0 ]; then MAIL_BODY=$MAIL_BODY"Please wstool update workspace manually. " fi @@ -97,6 +98,7 @@ if [ $CATKIN_BUILD_RESULT -ne 0 ]; then fi set +x } 2>&1 | tee $LOGFILE + if [ -n "$MAIL_BODY" ] && [ "${SEND_MAIL}" == "true" ]; then echo "Sent a mail" rostopic pub -1 /email jsk_robot_startup/Email "header: From edbb495996dec03eee808ffd4af01d8a54096166 Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Thu, 15 Sep 2022 14:17:35 +0900 Subject: [PATCH 11/19] [jsk_fetch_startup] fix mailbody in update_workspace script --- .../scripts/update_workspace_main.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh index 041c18fd5d..abb10dc24e 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh @@ -48,7 +48,7 @@ fi # Filename should end with .txt to preview the contents in a web browser LOGFILE=$WORKSPACE/update_workspace.txt -MAIL_BODY="" +TMP_MAIL_BODY_FILE=/tmp/update_workspace_mailbody.txt { set -x @@ -87,18 +87,22 @@ catkin config -DCMAKE_BUILD_TYPE=Release catkin build --continue-on-failure CATKIN_BUILD_RESULT=$? # Send mail +echo "" > $TMP_MAIL_BODY_FILE if [ $WSTOOL_UPDATE_RESULT -ne 0 ]; then - MAIL_BODY=$MAIL_BODY"Please wstool update workspace manually. " + echo "Please wstool update workspace manually.\n" >> $TMP_MAIL_BODY_FILE fi if [ $ROSDEP_INSTALL_RESULT -ne 0 ]; then - MAIL_BODY=$MAIL_BODY"Please install dependencies manually. " + echo "Please install dependencies manually.\n" >> $TMP_MAIL_BODY_FILE fi if [ $CATKIN_BUILD_RESULT -ne 0 ]; then - MAIL_BODY=$MAIL_BODY"Please catkin build workspace manually." + echo "Please catkin build workspace manually.\n" >> $TMP_MAIL_BODY_FILE fi set +x } 2>&1 | tee $LOGFILE +MAIL_BODY=$(cat $TMP_MAIL_BODY_FILE) +echo "MAIL_BODY: $MAIL_BODY" + if [ -n "$MAIL_BODY" ] && [ "${SEND_MAIL}" == "true" ]; then echo "Sent a mail" rostopic pub -1 /email jsk_robot_startup/Email "header: From f5fb1fc2113c1ab234aed4069b716c3f6646dd8a Mon Sep 17 00:00:00 2001 From: Naoto Tsukamoto Date: Thu, 15 Sep 2022 22:17:02 +0900 Subject: [PATCH 12/19] [jsk_fetch_startup] Fix email body topic by jsk_robot_startup/EmailBody --- .../jsk_fetch_startup/scripts/update_workspace_main.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh index abb10dc24e..ccae05598c 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh @@ -110,7 +110,8 @@ if [ -n "$MAIL_BODY" ] && [ "${SEND_MAIL}" == "true" ]; then stamp: {secs: 0, nsecs: 0} frame_id: '' subject: 'Daily workspace update fails' -body: '$MAIL_BODY' +body: +- {type: 'text', message: '${MAIL_BODY}', file_path: '', img_data: '', img_size: 0} sender_address: '$(hostname)@jsk.imi.i.u-tokyo.ac.jp' receiver_address: 'fetch@jsk.imi.i.u-tokyo.ac.jp' smtp_server: '' From 788e3903cfcf08b29c3831ac28db96556dffeb61 Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Sun, 18 Sep 2022 11:23:43 +0900 Subject: [PATCH 13/19] [jsk_fetch_startup] add comment to update_workspace_main.sh --- .../jsk_fetch_startup/scripts/update_workspace_main.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh index ccae05598c..fd02428eee 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh @@ -100,6 +100,9 @@ fi set +x } 2>&1 | tee $LOGFILE +# MAIL_BODY variable cannot be set directly in a subshell. So it is set from temporary mail body text file. +# The mail body text is put as $TMP_MAIL_BODY_FILE. +# See https://github.com/jsk-ros-pkg/jsk_robot/issues/1569 MAIL_BODY=$(cat $TMP_MAIL_BODY_FILE) echo "MAIL_BODY: $MAIL_BODY" From ba9cfa47731532b82605c778d586687511c23d67 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Fri, 30 Sep 2022 17:29:04 +0900 Subject: [PATCH 14/19] [jsk_fetch_startup, jsk_robot_startup] move update_workspace_main.sh to jsk_robot_startup --- .../scripts/update_workspace.sh | 8 +++- .../scripts/update_workspace_main.sh | 48 +++++++++++-------- 2 files changed, 35 insertions(+), 21 deletions(-) rename {jsk_fetch_robot/jsk_fetch_startup => jsk_robot_common/jsk_robot_startup}/scripts/update_workspace_main.sh (76%) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index 5646eb2875..6fd0ba00d2 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash -cp $(rospack find jsk_fetch_startup)/scripts/update_workspace_main.sh /tmp/update_workspace.sh -/tmp/update_workspace.sh $@ +cp $(rospack find jsk_robot_startup)/scripts/update_workspace_main.sh /tmp/update_workspace.sh +# jsk_footstep_planner is not released for melodic +# jsk_footstep_controller is not released for melodic +# librealsense2 should not be installed from ROS repository +# realsense-ros should not be installed from ROS repository +/tmp/update_workspace.sh -r $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO -t fetch -s "jsk_footstep_controller jsk_footstep_planner librealsense2 realsense2_camera realsense2_description" rm /tmp/update_workspace.sh diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh similarity index 76% rename from jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh rename to jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh index fd02428eee..0dc6176331 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace_main.sh +++ b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh @@ -2,11 +2,14 @@ function usage() { - echo "Usage: $0 [-w workspace_directory] [-h] [-l] + echo "Usage: $0 [-w workspace_directory] [-r rosinstall_path] [-t robot_type] [-s skip keys] [-h] [-l] optional arguments: -h show this help -w WORKSPACE_PATH specify target workspace + -r ROSINTALL_PATH rosinstall path + -t ROBOT robot type + -s SKIP_KEYS rosdep install skip keys -l do not send a mail " } @@ -17,14 +20,23 @@ function get_full_path() } SEND_MAIL=true -WORKSPACE=$(get_full_path $HOME/ros/melodic) +WORKSPACE=$(get_full_path $HOME/ros/$ROS_DISTRO) -while getopts hlw: OPT +while getopts w:r:t:s:lh OPT do case $OPT in w) WORKSPACE=$(get_full_path $OPTARG) ;; + r) + ROSINSTALL=$(get_full_path $OPTARG) + ;; + t) + ROBOT_TYPE=$OPTARG + ;; + s) + SKIP_KEYS=$OPTARG + ;; l) SEND_MAIL=false ;; @@ -39,11 +51,20 @@ do esac done -if [ ! -e $WORKSPACE ]; then - echo "No workspace $WORKSPACE" +if [ "$WORKSPACE" = "" ]; then + echo "Please set valid workspace -w $WORKSPACE" + exit 1 +fi +if [ "$ROSINSTALL" = "" ]; then + echo "Please set valid rosinstall -r $ROSINSTALL" + exit 1 +fi +if [ "$ROBOT_TYPE" = "" ]; then + echo "Please set valid robot type -t $ROBOT_TYPE" exit 1 fi + . $WORKSPACE/devel/setup.bash # Filename should end with .txt to preview the contents in a web browser LOGFILE=$WORKSPACE/update_workspace.txt @@ -57,7 +78,7 @@ set -x wstool foreach -t $WORKSPACE/src --git 'git stash' wstool foreach -t $WORKSPACE/src --git 'git fetch origin --prune' wstool update -t $WORKSPACE/src jsk-ros-pkg/jsk_robot -ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $WORKSPACE/src/.rosinstall +ln -sf $ROSINSTALL $WORKSPACE/src/.rosinstall wstool update -t $WORKSPACE/src --delete-changed-uris # Forcefully checkout specified branch wstool foreach -t $WORKSPACE/src --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); if [ $branchname != "HEAD" ]; then git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout -b $branchname --track origin/$branchname; fi' @@ -66,18 +87,7 @@ WSTOOL_UPDATE_RESULT=$? # Rosdep Install sudo apt-get update -y rosdep update -# jsk_footstep_planner is not released for melodic -# jsk_footstep_controller is not released for melodic -# librealsense2 should not be installed from ROS repository -# realsense-ros should not be installed from ROS repository -rosdep install --from-paths $WORKSPACE/src --ignore-src -y -r --skip-keys \ -"\ -jsk_footstep_controller \ -jsk_footstep_planner \ -librealsense2 \ -realsense2_camera \ -realsense2_description \ -" +rosdep install --from-paths $WORKSPACE/src --ignore-src -y -r --skip-keys $SKIP_KEYS ROSDEP_INSTALL_RESULT=$? # Build workspace cd $WORKSPACE @@ -116,7 +126,7 @@ subject: 'Daily workspace update fails' body: - {type: 'text', message: '${MAIL_BODY}', file_path: '', img_data: '', img_size: 0} sender_address: '$(hostname)@jsk.imi.i.u-tokyo.ac.jp' -receiver_address: 'fetch@jsk.imi.i.u-tokyo.ac.jp' +receiver_address: '$ROBOT_TYPE@jsk.imi.i.u-tokyo.ac.jp' smtp_server: '' smtp_port: '' attached_files: ['$LOGFILE']" From a6a5c2e8e72c688cc5f01dc43c8bf1a1f4602996 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Fri, 30 Sep 2022 17:31:16 +0900 Subject: [PATCH 15/19] [jsk_pr2_startup] add update_workspace.sh for pr2 --- jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh diff --git a/jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh b/jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh new file mode 100755 index 0000000000..a1ebc5cfc0 --- /dev/null +++ b/jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cp $(rospack find jsk_robot_startup)/scripts/update_workspace_main.sh /tmp/update_workspace.sh +/tmp/update_workspace.sh -w $HOME/ros/indigo -r $(rospack find jsk_pr2_startup)/jsk_pr2.rosinstall -t pr2 +rm /tmp/update_workspace.sh From ac3368a6a5b6ae38df52487a1b219dd59873f3e7 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Fri, 30 Sep 2022 17:55:01 +0900 Subject: [PATCH 16/19] [jsk_robot_startup] add option to disable rosdep install --- .../scripts/update_workspace_main.sh | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh index 0dc6176331..2443db885a 100755 --- a/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh +++ b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh @@ -2,7 +2,7 @@ function usage() { - echo "Usage: $0 [-w workspace_directory] [-r rosinstall_path] [-t robot_type] [-s skip keys] [-h] [-l] + echo "Usage: $0 [-w workspace_directory] [-r rosinstall_path] [-t robot_type] [-s skip keys] [-h] [-u] [-l] optional arguments: -h show this help @@ -10,6 +10,7 @@ optional arguments: -r ROSINTALL_PATH rosinstall path -t ROBOT robot type -s SKIP_KEYS rosdep install skip keys + -u do not run apt-get upgrade and rosdep install -l do not send a mail " } @@ -19,10 +20,11 @@ function get_full_path() echo "$(cd $(dirname $1) && pwd)/$(basename $1)" } +ROSDEP_INSTALL=true SEND_MAIL=true WORKSPACE=$(get_full_path $HOME/ros/$ROS_DISTRO) -while getopts w:r:t:s:lh OPT +while getopts w:r:t:s:ulh OPT do case $OPT in w) @@ -37,6 +39,9 @@ do s) SKIP_KEYS=$OPTARG ;; + u) + ROSDEP_INSTALL=false + ;; l) SEND_MAIL=false ;; @@ -85,10 +90,14 @@ wstool foreach -t $WORKSPACE/src --git --shell 'branchname=$(git rev-parse --abb wstool update -t $WORKSPACE/src WSTOOL_UPDATE_RESULT=$? # Rosdep Install -sudo apt-get update -y -rosdep update -rosdep install --from-paths $WORKSPACE/src --ignore-src -y -r --skip-keys $SKIP_KEYS -ROSDEP_INSTALL_RESULT=$? +if [ "${ROSDEP_INSTALL}" == "true" ]; then + sudo apt-get update -y; + rosdep update; + rosdep install --from-paths $WORKSPACE/src --ignore-src -y -r --skip-keys $SKIP_KEYS; + ROSDEP_INSTALL_RESULT=$?; +else + ROSDEP_INSTALL_RESULT=0; +fi # Build workspace cd $WORKSPACE catkin clean aques_talk collada_urdf_jsk_patch libcmt -y From 1c962a712603e6cd54473788688f31f42812fe1d Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Fri, 30 Sep 2022 17:56:50 +0900 Subject: [PATCH 17/19] [jsk_pr2_startup] do not run rosdep in pr2 --- jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh b/jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh index a1ebc5cfc0..3dbf85dd09 100755 --- a/jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh +++ b/jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash cp $(rospack find jsk_robot_startup)/scripts/update_workspace_main.sh /tmp/update_workspace.sh -/tmp/update_workspace.sh -w $HOME/ros/indigo -r $(rospack find jsk_pr2_startup)/jsk_pr2.rosinstall -t pr2 +/tmp/update_workspace.sh -w $HOME/ros/indigo -r $(rospack find jsk_pr2_startup)/jsk_pr2.rosinstall -t pr2 -u rm /tmp/update_workspace.sh From bafddb9a0acf1005dd82d57f7788abdb0e2377db Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Fri, 30 Sep 2022 19:09:36 +0900 Subject: [PATCH 18/19] Apply suggestions from code review Co-authored-by: Koki Shinjo --- .../jsk_robot_startup/scripts/update_workspace_main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh index 2443db885a..f653cd8934 100755 --- a/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh +++ b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh @@ -82,7 +82,7 @@ set -x wstool foreach -t $WORKSPACE/src --git 'git stash' wstool foreach -t $WORKSPACE/src --git 'git fetch origin --prune' -wstool update -t $WORKSPACE/src jsk-ros-pkg/jsk_robot +wstool update -t $WORKSPACE/src jsk-ros-pkg/jsk_robot --delete-changed-uris ln -sf $ROSINSTALL $WORKSPACE/src/.rosinstall wstool update -t $WORKSPACE/src --delete-changed-uris # Forcefully checkout specified branch From e3aec6b3c0399cc0806fc371831f29e182efc135 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Fri, 30 Sep 2022 22:29:59 +0900 Subject: [PATCH 19/19] [jsk_robot_startup] fix typo in update_workspace_main.sh --- .../jsk_robot_startup/scripts/update_workspace_main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh index f653cd8934..053f0fcfd3 100755 --- a/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh +++ b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh @@ -93,7 +93,7 @@ WSTOOL_UPDATE_RESULT=$? if [ "${ROSDEP_INSTALL}" == "true" ]; then sudo apt-get update -y; rosdep update; - rosdep install --from-paths $WORKSPACE/src --ignore-src -y -r --skip-keys $SKIP_KEYS; + rosdep install --from-paths $WORKSPACE/src --ignore-src -y -r --skip-keys "$SKIP_KEYS"; ROSDEP_INSTALL_RESULT=$?; else ROSDEP_INSTALL_RESULT=0;