-
Notifications
You must be signed in to change notification settings - Fork 178
Apply client workspace compatibility patches for newer ROS 2 interface packages #815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
EugenioCollado
wants to merge
6
commits into
jazzy
Choose a base branch
from
5.0.2-vulcanexus
base: jazzy
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3abe6f0
Fix jazzy interfaces && Apply patches to msgs
EugenioCollado 167fdd1
Invoke apply_patches.sh via bash
EugenioCollado 7501c76
Print search location for patch when not found
EugenioCollado d86a169
Apply patch if file exists
EugenioCollado 59815fd
tmp CI commit
EugenioCollado ee67511
Fix cyclic dependency
EugenioCollado File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| diff --git a/ros2/rcl_interfaces/action_msgs/CMakeLists.txt b/ros2/rcl_interfaces/action_msgs/CMakeLists.txt | ||
| index b5f34b9..65db062 100644 | ||
| --- a/ros2/rcl_interfaces/action_msgs/CMakeLists.txt | ||
| +++ b/ros2/rcl_interfaces/action_msgs/CMakeLists.txt | ||
| @@ -15,7 +15,7 @@ find_package(ament_cmake REQUIRED) | ||
| find_package(builtin_interfaces REQUIRED) | ||
| # Depend on "core" generators instead of "default" generators | ||
| # because ROS actions depend on this package | ||
| -find_package(rosidl_core_generators REQUIRED) | ||
| +find_package(rosidl_default_generators REQUIRED) | ||
| find_package(unique_identifier_msgs REQUIRED) | ||
|
|
||
| set(msg_files | ||
| diff --git a/ros2/rcl_interfaces/builtin_interfaces/CMakeLists.txt b/ros2/rcl_interfaces/builtin_interfaces/CMakeLists.txt | ||
| index 282d38e..67c1339 100644 | ||
| --- a/ros2/rcl_interfaces/builtin_interfaces/CMakeLists.txt | ||
| +++ b/ros2/rcl_interfaces/builtin_interfaces/CMakeLists.txt | ||
| @@ -14,7 +14,7 @@ endif() | ||
| find_package(ament_cmake REQUIRED) | ||
| # Depend on "core" generators instead of "default" generators | ||
| # because ROS actions depend on this package | ||
| -find_package(rosidl_core_generators REQUIRED) | ||
| +find_package(rosidl_default_generators REQUIRED) | ||
| diff --git a/ros2/rcl_interfaces/type_description_interfaces/CMakeLists.txt b/ros2/rcl_interfaces/type_description_interfaces/CMakeLists.txt | ||
| index c3ac72b..4374456 100644 | ||
| --- a/ros2/rcl_interfaces/type_description_interfaces/CMakeLists.txt | ||
| +++ b/ros2/rcl_interfaces/type_description_interfaces/CMakeLists.txt | ||
| @@ -13,7 +13,7 @@ endif() | ||
| find_package(ament_cmake REQUIRED) | ||
| # Depend on "core" generators instead of "default" generators | ||
| # because other generators depend on this. | ||
| -find_package(rosidl_core_generators REQUIRED) | ||
| +find_package(rosidl_default_generators REQUIRED) | ||
| diff --git a/ros2/unique_identifier_msgs/CMakeLists.txt b/ros2/unique_identifier_msgs/CMakeLists.txt | ||
| index 382b8ec..00498c3 100644 | ||
| --- a/ros2/unique_identifier_msgs/CMakeLists.txt | ||
| +++ b/ros2/unique_identifier_msgs/CMakeLists.txt | ||
| @@ -15,7 +15,7 @@ endif() | ||
| find_package(ament_cmake REQUIRED) | ||
| # Depend on "core" generators instead of "default" generators | ||
| # because ROS actions depend on this package | ||
| -find_package(rosidl_core_generators REQUIRED) | ||
| +find_package(rosidl_default_generators REQUIRED) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| diff --git a/ros2/example_interfaces/CMakeLists.txt b/ros2/example_interfaces/CMakeLists.txt | ||
| index e7dae2c..033eda0 100644 | ||
| --- a/ros2/example_interfaces/CMakeLists.txt | ||
| +++ b/ros2/example_interfaces/CMakeLists.txt | ||
| @@ -12,7 +12,10 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| endif() | ||
|
|
||
| find_package(ament_cmake REQUIRED) | ||
| +find_package(action_msgs REQUIRED) | ||
| +find_package(builtin_interfaces REQUIRED) | ||
| find_package(rosidl_default_generators REQUIRED) | ||
| +find_package(unique_identifier_msgs REQUIRED) | ||
|
|
||
| rosidl_generate_interfaces(${PROJECT_NAME} | ||
| "action/Fibonacci.action" | ||
| @@ -48,6 +51,7 @@ rosidl_generate_interfaces(${PROJECT_NAME} | ||
| "srv/AddTwoInts.srv" | ||
| "srv/SetBool.srv" | ||
| "srv/Trigger.srv" | ||
| + DEPENDENCIES builtin_interfaces unique_identifier_msgs | ||
| ) | ||
|
|
||
| install(FILES mapping_rules.yaml DESTINATION share/${PROJECT_NAME}) | ||
| diff --git a/ros2/example_interfaces/package.xml b/ros2/example_interfaces/package.xml | ||
| index f127a53..31f8653 100644 | ||
| --- a/ros2/example_interfaces/package.xml | ||
| +++ b/ros2/example_interfaces/package.xml | ||
| @@ -17,6 +17,10 @@ | ||
|
|
||
| <buildtool_depend>rosidl_default_generators</buildtool_depend> | ||
|
|
||
| + <depend>action_msgs</depend> | ||
| + <depend>builtin_interfaces</depend> | ||
| + <depend>unique_identifier_msgs</depend> | ||
| + | ||
| <exec_depend>rosidl_default_runtime</exec_depend> | ||
|
|
||
| <member_of_group>rosidl_interface_packages</member_of_group> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| diff --git a/ros2/rcl_interfaces/test_msgs/CMakeLists.txt b/ros2/rcl_interfaces/test_msgs/CMakeLists.txt | ||
| index 433833b..b2472b8 100644 | ||
| --- a/ros2/rcl_interfaces/test_msgs/CMakeLists.txt | ||
| +++ b/ros2/rcl_interfaces/test_msgs/CMakeLists.txt | ||
| @@ -17,9 +17,11 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| endif() | ||
|
|
||
| find_package(ament_cmake REQUIRED) | ||
| +find_package(action_msgs REQUIRED) | ||
| find_package(builtin_interfaces REQUIRED) | ||
| find_package(rosidl_default_generators REQUIRED) | ||
| find_package(test_interface_files REQUIRED) | ||
| +find_package(unique_identifier_msgs REQUIRED) | ||
|
|
||
| # TODO(sloretz) Change to test_msgs_interfaces when ros2/rosidl_typesupport#120 is fixed | ||
| rosidl_generate_interfaces(test_msgs | ||
| @@ -29,7 +31,7 @@ rosidl_generate_interfaces(test_msgs | ||
| ${test_interface_files_IDL_FILES} | ||
| "msg/Builtins.msg" | ||
| "action/NestedMessage.action" | ||
| - DEPENDENCIES builtin_interfaces | ||
| + DEPENDENCIES builtin_interfaces unique_identifier_msgs | ||
| ADD_LINTER_TESTS | ||
| ) | ||
|
|
||
| diff --git a/ros2/rcl_interfaces/test_msgs/package.xml b/ros2/rcl_interfaces/test_msgs/package.xml | ||
| index 67fe631..0f76490 100644 | ||
| --- a/ros2/rcl_interfaces/test_msgs/package.xml | ||
| +++ b/ros2/rcl_interfaces/test_msgs/package.xml | ||
| @@ -17,8 +17,10 @@ | ||
|
|
||
| <buildtool_depend>rosidl_default_generators</buildtool_depend> | ||
|
|
||
| + <depend>action_msgs</depend> | ||
| <build_depend>builtin_interfaces</build_depend> | ||
| <build_depend>test_interface_files</build_depend> | ||
| + <depend>unique_identifier_msgs</depend> | ||
|
|
||
| <exec_depend>builtin_interfaces</exec_depend> | ||
| <exec_depend>rosidl_default_runtime</exec_depend> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
| set -o nounset | ||
| set -o pipefail | ||
|
|
||
| if [ $# -ne 1 ]; then | ||
| echo "Syntax: $0 <workspace_dir>" | ||
| exit 255 | ||
| fi | ||
|
|
||
| WORKSPACE_DIR=$1 | ||
| SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) | ||
| PATCH_DIR="" | ||
|
|
||
| for candidate in \ | ||
| "${SCRIPT_DIR}/../../share/micro_ros_setup/patches" \ | ||
| "${SCRIPT_DIR}/../share/micro_ros_setup/patches" \ | ||
| "${SCRIPT_DIR}/../patches" | ||
| do | ||
| if [ -d "${candidate}" ]; then | ||
| PATCH_DIR="${candidate}" | ||
| break | ||
| fi | ||
| done | ||
|
|
||
| if [ ! -d "${WORKSPACE_DIR}" ]; then | ||
| echo "Error: Workspace '${WORKSPACE_DIR}' does not exist" | ||
| exit 255 | ||
| fi | ||
|
|
||
| if [ -z "${PATCH_DIR}" ]; then | ||
| echo "Error: Patch directory not found (searched: ${SCRIPT_DIR}/../../share/micro_ros_setup/patches, ${SCRIPT_DIR}/../share/micro_ros_setup/patches, ${SCRIPT_DIR}/../patches)" | ||
| exit 255 | ||
| fi | ||
|
|
||
| patch_targets_workspace() { | ||
| local patch_file=$1 | ||
| local candidate_path="" | ||
| local repo_path="" | ||
| local saw_diff=0 | ||
|
|
||
| while read -r _ _ old_path new_path; do | ||
| saw_diff=1 | ||
| old_path=${old_path#a/} | ||
| new_path=${new_path#b/} | ||
|
|
||
| for candidate_path in "${old_path}" "${new_path}"; do | ||
| repo_path=$(printf '%s\n' "${candidate_path}" | cut -d/ -f1-2) | ||
| if [ -n "${repo_path}" ] && [ -d "${WORKSPACE_DIR}/${repo_path}" ]; then | ||
| return 0 | ||
| fi | ||
| done | ||
| done < <(grep '^diff --git a/' "${patch_file}" || true) | ||
|
|
||
| if [ "${saw_diff}" -eq 0 ]; then | ||
| return 0 | ||
| fi | ||
|
|
||
| return 1 | ||
| } | ||
|
|
||
| apply_patch_file() { | ||
| local patch_file=$1 | ||
|
|
||
| if ! patch_targets_workspace "${patch_file}"; then | ||
| echo "Skipping $(basename "${patch_file}") (workspace does not contain the patched repository)" | ||
| return | ||
| fi | ||
|
|
||
| if patch --batch --forward -p1 -d "${WORKSPACE_DIR}" --dry-run < "${patch_file}" >/dev/null 2>&1; then | ||
| echo "Applying $(basename "${patch_file}")" | ||
| patch --batch --forward -p1 -d "${WORKSPACE_DIR}" < "${patch_file}" >/dev/null | ||
| return | ||
| fi | ||
|
|
||
| if patch --batch --reverse -p1 -d "${WORKSPACE_DIR}" --dry-run < "${patch_file}" >/dev/null 2>&1; then | ||
| echo "Skipping $(basename "${patch_file}") (already applied)" | ||
| return | ||
| fi | ||
|
|
||
| echo "Warning: Failed to apply $(basename "${patch_file}") in ${WORKSPACE_DIR}" >&2 | ||
| } | ||
|
|
||
| shopt -s nullglob | ||
| for patch_file in "${PATCH_DIR}"/*.patch; do | ||
| apply_patch_file "${patch_file}" | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.