Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c9d3761
[jsk_fetch_startup] catkin clean libcmt before build in daily update_…
708yamaguchi Jan 6, 2022
e747d20
[jsk_fetch_startup] update workspace script
sktometometo Apr 15, 2022
a9f851f
[jsk_fetch_startup] remove redundant section
sktometometo Apr 16, 2022
b168bf0
[jsk_fetch_startup] parameterize workspace path and make it as argument
sktometometo Apr 18, 2022
92a8a9e
[jsk_fetch_startup] update update_workspace.sh
sktometometo Apr 18, 2022
4b68ffa
[jsk_fetch_startup] update workspace script
sktometometo Apr 19, 2022
c0a3e60
[jsk_fetch_startup] fix default workspace path
sktometometo Apr 20, 2022
3bfc466
[jsk_fetch_startup] rename update_workspace.sh to update_workspace_ma…
sktometometo Apr 27, 2022
c6f9882
[jsk_fetch_startup] remove /tmp/update_workspace.sh after updating
sktometometo Jul 4, 2022
a104f74
[jsk_fetch_startup] fix mailbody in update_workspace script
sktometometo Sep 15, 2022
edbb495
[jsk_fetch_startup] fix mailbody in update_workspace script
sktometometo Sep 15, 2022
f5fb1fc
[jsk_fetch_startup] Fix email body topic by jsk_robot_startup/EmailBody
tkmtnt7000 Sep 15, 2022
788e390
[jsk_fetch_startup] add comment to update_workspace_main.sh
sktometometo Sep 18, 2022
ba9cfa4
[jsk_fetch_startup, jsk_robot_startup] move update_workspace_main.sh …
knorth55 Sep 30, 2022
a6a5c2e
[jsk_pr2_startup] add update_workspace.sh for pr2
knorth55 Sep 30, 2022
ac3368a
[jsk_robot_startup] add option to disable rosdep install
knorth55 Sep 30, 2022
1c962a7
[jsk_pr2_startup] do not run rosdep in pr2
knorth55 Sep 30, 2022
bafddb9
Apply suggestions from code review
knorth55 Sep 30, 2022
e3aec6b
[jsk_robot_startup] fix typo in update_workspace_main.sh
knorth55 Sep 30, 2022
7ada0eb
Merge branch 'master' into common-update-workspace
k-okada Mar 5, 2025
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
48 changes: 7 additions & 41 deletions jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh
Original file line number Diff line number Diff line change
@@ -1,43 +1,9 @@
#!/usr/bin/env bash

. $HOME/ros/melodic/devel/setup.bash
# Filename should end with .txt to preview the contents in a web browser
LOGFILE=$HOME/ros/melodic/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
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 init
catkin config -DCMAKE_BUILD_TYPE=Release
catkin build
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 [ $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:
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_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
5 changes: 5 additions & 0 deletions jsk_pr2_robot/jsk_pr2_startup/scripts/update_workspace.sh
Original file line number Diff line number Diff line change
@@ -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 -u
rm /tmp/update_workspace.sh
142 changes: 142 additions & 0 deletions jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/usr/bin/env bash

function usage()
{
echo "Usage: $0 [-w workspace_directory] [-r rosinstall_path] [-t robot_type] [-s skip keys] [-h] [-u] [-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
-u do not run apt-get upgrade and rosdep install
-l do not send a mail
"
}

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:ulh 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
;;
u)
ROSDEP_INSTALL=false
;;
l)
SEND_MAIL=false
;;
h)
usage
exit 1
;;
*)
usage
exit 1
;;
esac
done

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

TMP_MAIL_BODY_FILE=/tmp/update_workspace_mailbody.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 --delete-changed-uris
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'
wstool update -t $WORKSPACE/src
WSTOOL_UPDATE_RESULT=$?
# Rosdep Install
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
catkin init
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
echo "Please wstool update workspace manually.\n" >> $TMP_MAIL_BODY_FILE
fi
if [ $ROSDEP_INSTALL_RESULT -ne 0 ]; then
echo "Please install dependencies manually.\n" >> $TMP_MAIL_BODY_FILE
fi
if [ $CATKIN_BUILD_RESULT -ne 0 ]; then
echo "Please catkin build workspace manually.\n" >> $TMP_MAIL_BODY_FILE
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"

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:
- {type: 'text', message: '${MAIL_BODY}', file_path: '', img_data: '', img_size: 0}
sender_address: '$(hostname)@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']"
fi