Skip to content

Commit

Permalink
remove obsolete escaping logic to deal with trailing double dashes
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Apr 11, 2018
1 parent b9daaa2 commit cd30776
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 59 deletions.
64 changes: 6 additions & 58 deletions job_templates/ci_job.xml.em
Original file line number Diff line number Diff line change
Expand Up @@ -150,38 +150,10 @@ if [ "$CI_ENABLE_C_COVERAGE" = "true" ]; then
export CI_ARGS="$CI_ARGS --coverage"
fi
if [ -n "${CI_AMENT_BUILD_ARGS+x}" ]; then
ESCAPE=""
for arg in ${CI_AMENT_BUILD_ARGS}; do
# These are arguments that the user wants to pass through to ament.
# Before they get there, they will first be passed through and parsed by
# run_ros2_batch.py. In order to retain their original meaning, make
# sure to "escape" lone dash sequences that the user put onto the line.
# This ensures that these make it through to ament in the way the user intended.
case "${arg}" in
*-- )
arg="${arg}-"
;;
esac
ESCAPE="${ESCAPE}${arg} "
done
export CI_ARGS="${CI_ARGS} --ament-build-args ${ESCAPE%?} --"
export CI_ARGS="${CI_ARGS} --ament-build-args ${CI_AMENT_BUILD_ARGS}"
fi
if [ -n "${CI_AMENT_TEST_ARGS+x}" ]; then
ESCAPE=""
for arg in ${CI_AMENT_TEST_ARGS}; do
# These are arguments that the user wants to pass through to ament.
# Before they get there, they will first be passed through and parsed by
# run_ros2_batch.py. In order to retain their original meaning, make
# sure to "escape" lone dash sequences that the user put onto the line.
# This ensures that these make it through to ament in the way the user intended.
case "${arg}" in
*-- )
arg="${arg}-"
;;
esac
ESCAPE="${ESCAPE}${arg} "
done
export CI_ARGS="${CI_ARGS} --ament-test-args ${ESCAPE%?} --"
export CI_ARGS="${CI_ARGS} --ament-test-args ${CI_AMENT_TEST_ARGS}"
fi
@[if os_name in ['linux', 'linux-aarch64'] and turtlebot_demo]@
export CI_ARGS="$CI_ARGS --ros1-path /opt/ros/kinetic"
Expand Down Expand Up @@ -288,35 +260,11 @@ if "!CI_CMAKE_BUILD_TYPE!" == "Debug" (
if "!CI_ENABLE_C_COVERAGE!" == "true" (
set "CI_ARGS=!CI_ARGS! --coverage"
)
if "%CI_AMENT_BUILD_ARGS%" NEQ "" (
set ESCAPE=
set PARSER=%CI_AMENT_BUILD_ARGS%
:build-loop
for /f "tokens=1* delims= " %%a in ("!PARSER!") do (
set substring=%%a
if "!substring:~-2!" EQU "--" (
set substring=%%a-
)
set "ESCAPE=!ESCAPE!!substring! "
set PARSER=%%b
)
if defined PARSER goto build-loop
set "CI_ARGS=!CI_ARGS! --ament-build-args !ESCAPE:~0,-1! --"
if "!CI_AMENT_BUILD_ARGS!" NEQ "" (
set "CI_ARGS=!CI_ARGS! --ament-build-args !CI_AMENT_BUILD_ARGS!"
)
if "%CI_AMENT_TEST_ARGS%" NEQ "" (
set ESCAPE=
set PARSER=%CI_AMENT_TEST_ARGS%
:test-loop
for /f "tokens=1* delims= " %%a in ("!PARSER!") do (
set substring=%%a
if "!substring:~-2!" EQU "--" (
set substring=%%a-
)
set "ESCAPE=!ESCAPE!!substring! "
set PARSER=%%b
)
if defined PARSER goto test-loop
set "CI_ARGS=!CI_ARGS! --ament-test-args !ESCAPE:~0,-1! --"
if "!CI_AMENT_TEST_ARGS!" NEQ "" (
set "CI_ARGS=!CI_ARGS! --ament-test-args !CI_AMENT_TEST_ARGS!"
)
echo Using args: !CI_ARGS!
echo "# END SECTION"
Expand Down
7 changes: 6 additions & 1 deletion ros2_batch_job/windows_batch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ def with_vendors(cmd, **kwargs):
# Ensure shell is on since we're using &&
kwargs['shell'] = True
# Use the env file to call the commands
cmd = ['env.bat'] + cmd
print('cmd', cmd)
# ensure that quoted arguments are passed through as quoted arguments
cmd = ['env.bat'] + [
'"%s"' % c if ' ' in c and not (c.startswith('"') and c.endswith('"')) else c
for c in cmd]
print('cmd', cmd)
# Pass along to the original runner
return current_run(cmd, **kwargs)

Expand Down

0 comments on commit cd30776

Please sign in to comment.