From 51d5508dd785f5113e1c3efa11aac083825576c0 Mon Sep 17 00:00:00 2001 From: Jacob Minshall Date: Fri, 10 Apr 2020 12:09:42 -0700 Subject: [PATCH 1/3] adding in console to use dev shell --- scripts/bootstrap | 5 +++++ scripts/console | 24 ++++++++++++++++++++++++ scripts/init_workspace | 10 +++++----- scripts/update | 4 ++++ 4 files changed, 38 insertions(+), 5 deletions(-) create mode 100755 scripts/bootstrap create mode 100755 scripts/console create mode 100755 scripts/update diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 000000000..510e80fd7 --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +./scripts/init_workspace + +[ -e ../appctl/appctl ] && ./scripts/init_workspace -x ${PWD}/../appctl/appctl diff --git a/scripts/console b/scripts/console new file mode 100755 index 000000000..40795e1e3 --- /dev/null +++ b/scripts/console @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")/.." + +./scripts/bootstrap + +[[ "$(docker images | grep -c lg_ros_nodes.*latest)" == 0 ]] && ./scripts/update + +MOUNTS="" + +for rosnode in $(ls catkin/src/* -d | grep -v CMake); do + # $rosnode is catkin/src/package_name + MOUNTS="${MOUNTS} -v $(readlink ${rosnode}):/src/lg_ros_nodes/${rosnode}" +done + +echo ${MOUNTS} + +docker run ${MOUNTS} -it lg_ros_nodes:latest /bin/bash -c " + cd /src/lg_ros_nodes/catkin + source devel/setup.bash + source ../scripts/docker_xvfb_add.sh + echo 'run catkin_make before anything' + /bin/bash +" diff --git a/scripts/init_workspace b/scripts/init_workspace index eb7c25738..1538ec521 100755 --- a/scripts/init_workspace +++ b/scripts/init_workspace @@ -1,9 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import argparse from subprocess import Popen -from ConfigParser import RawConfigParser, NoSectionError, NoOptionError +from configparser import RawConfigParser, NoSectionError, NoOptionError # make sure to set the root directory ROOT_DIR = os.path.realpath(os.curdir) @@ -37,7 +37,7 @@ def parse_config(): """ config_file = 'scripts/init.cfg' if not os.path.exists(config_file): - print 'WARNING, no %s found, using possibly outdated configuration' % config_file + print('WARNING, no %s found, using possibly outdated configuration' % config_file) return # rely on hard coded values... maybe an exception would work # setting these globals global IGNORE_DIRS @@ -186,9 +186,9 @@ def check_validity(): for needed in NEEDED_DIRS: if needed not in links: passed = False - print "############## WARNING catkin/src SHOULD HAVE %s LINK ##############" % needed + print("############## WARNING catkin/src SHOULD HAVE %s LINK ##############" % needed) if passed: - print "Successfully completed workspace initialization" + print("Successfully completed workspace initialization") def main(): diff --git a/scripts/update b/scripts/update new file mode 100755 index 000000000..c41bbbe56 --- /dev/null +++ b/scripts/update @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")/.." +docker build . -t lg_ros_nodes From c111d524fbf13653f8a071796b1a3d8e526e8d8e Mon Sep 17 00:00:00 2001 From: Jacob Minshall Date: Wed, 16 Mar 2022 08:15:55 -0700 Subject: [PATCH 2/3] made changes --- scripts/bootstrap | 3 +++ scripts/init_workspace | 4 ++-- scripts/update | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index 510e80fd7..3715350cd 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -1,5 +1,8 @@ #!/usr/bin/env bash +set -e + ./scripts/init_workspace +# if there's an appctl directory behind us, link it in [ -e ../appctl/appctl ] && ./scripts/init_workspace -x ${PWD}/../appctl/appctl diff --git a/scripts/init_workspace b/scripts/init_workspace index 1538ec521..159e74d5c 100755 --- a/scripts/init_workspace +++ b/scripts/init_workspace @@ -37,7 +37,7 @@ def parse_config(): """ config_file = 'scripts/init.cfg' if not os.path.exists(config_file): - print('WARNING, no %s found, using possibly outdated configuration' % config_file) + print(f"WARNING, no {config_file} found, using possibly outdated configuration") return # rely on hard coded values... maybe an exception would work # setting these globals global IGNORE_DIRS @@ -186,7 +186,7 @@ def check_validity(): for needed in NEEDED_DIRS: if needed not in links: passed = False - print("############## WARNING catkin/src SHOULD HAVE %s LINK ##############" % needed) + print(f"############## WARNING catkin/src SHOULD HAVE {needed} LINK ##############") if passed: print("Successfully completed workspace initialization") diff --git a/scripts/update b/scripts/update index c41bbbe56..3b0946684 100755 --- a/scripts/update +++ b/scripts/update @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e cd "$(dirname "$0")/.." docker build . -t lg_ros_nodes From 20c4a3006fdb7971d8359084f417ef71704f7d98 Mon Sep 17 00:00:00 2001 From: Jacob Minshall Date: Wed, 16 Mar 2022 08:20:50 -0700 Subject: [PATCH 3/3] care about directory --- scripts/bootstrap | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/bootstrap b/scripts/bootstrap index 3715350cd..43a2b6622 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -2,6 +2,7 @@ set -e +cd "$(dirname "$0")/.." ./scripts/init_workspace # if there's an appctl directory behind us, link it in