From 968eb20422a7d38cd893412116704623b2ba2081 Mon Sep 17 00:00:00 2001 From: Emerson Knapp Date: Tue, 28 Mar 2023 13:22:41 -0700 Subject: [PATCH 1/2] Hash all generated files for the fingerprint Signed-off-by: Emerson Knapp --- ...check-copied-type-description-sources.yaml | 33 +------------------ ...py_type_description_generated_sources.bash | 23 +++++++------ scripts/type_description.fingerprint | 28 ++++++++++++++-- 3 files changed, 37 insertions(+), 47 deletions(-) diff --git a/.github/workflows/check-copied-type-description-sources.yaml b/.github/workflows/check-copied-type-description-sources.yaml index 9d0d066e8..a4e6fe8d6 100644 --- a/.github/workflows/check-copied-type-description-sources.yaml +++ b/.github/workflows/check-copied-type-description-sources.yaml @@ -5,7 +5,7 @@ on: pull_request: jobs: - test_copied_sources_changed: + test_copied_sources_changed_with_fingerprint: runs-on: ubuntu-latest outputs: needs_verification: ${{ steps.needs_verification.outputs.changed }} @@ -32,34 +32,3 @@ jobs: run: | echo "Copied sources changed but fingerprint not updated" exit 1 - - id: needs_verification - if: (steps.changed-fingerprint.outputs.any_changed == 'true') && (steps.changed-copied-sources.outputs.any_changed == 'true') - run: echo "changed=true" >> "$GITHUB_OUTPUT" - - test_copied_sources_fingerprint: - needs: test_copied_sources_changed - if: needs.test_copied_sources_changed.outputs.needs_verification - runs-on: ubuntu-latest - steps: - - name: Check out rcl_interfaces - uses: actions/checkout@v3 - with: - repository: ros2/rcl_interfaces - ref: rolling - path: rcl_interfaces - - name: Check out sources - uses: actions/checkout@v3 - with: - path: rosidl - - name: Get latest rcl_interfaces commit - shell: bash - working-directory: rcl_interfaces - run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - id: extract_rcl_interfaces_commit - - name: Compare fingerprint commit hash - run: | - source rosidl/scripts/type_description.fingerprint - if [ "$RCL_INTERFACES_COMMIT" != "${{ steps.extract_rcl_interfaces_commit.outputs.commit }}" ]; then - echo "Commit hash $RCL_INTERFACES_COMMIT in scripts/type_description.fingerprint does not match latest rcl_interfaces commit ${{ steps.extract_rcl_interfaces_commit.outputs.commit }}, but sources were changed." - exit 1 - fi diff --git a/scripts/copy_type_description_generated_sources.bash b/scripts/copy_type_description_generated_sources.bash index ff2c3014f..9027b1a7c 100755 --- a/scripts/copy_type_description_generated_sources.bash +++ b/scripts/copy_type_description_generated_sources.bash @@ -13,22 +13,20 @@ set -euxo pipefail # Set the following environment variables (script will fail if unset): # BUILD_DIR - path to the build output of `type_description_interfaces` # RCL_INTERFACES_SRC_DIR - path to the `rcl_interfaces` repository, where type description interface definitions come from -# ROSIDL_SRC_DIR - path to the `rosidl` repository, where type description files will be placed # # Example: # BUILD_DIR=build/type_description_interfaces ROSIDL_SRC_DIR=src/ros2/rosidl src/ros2/rosidl/scripts/copy_type_description_generated_sources.bash SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -pushd $RCL_INTERFACES_SRC_DIR -RCL_INTERFACES_COMMIT=$(git rev-parse HEAD) -popd +C_DETAIL_SUBPATH=rosidl_generator_c/type_description_interfaces/msg/detail +CPP_DETAIL_SUBPATH=rosidl_generator_cpp/type_description_interfaces/msg/detail -C_DETAIL=$BUILD_DIR/rosidl_generator_c/type_description_interfaces/msg/detail/ -C_INCLUDE_DEST=$ROSIDL_SRC_DIR/rosidl_runtime_c/include/rosidl_runtime_c/type_description/ -C_SRC_DEST=$ROSIDL_SRC_DIR/rosidl_runtime_c/src/type_description/ +C_DETAIL=$BUILD_DIR/$C_DETAIL_SUBPATH +C_INCLUDE_DEST=$ROSIDL_SRC_DIR/rosidl_runtime_c/include/rosidl_runtime_c/type_description +C_SRC_DEST=$ROSIDL_SRC_DIR/rosidl_runtime_c/src/type_description -CPP_DETAIL=$BUILD_DIR/rosidl_generator_cpp/type_description_interfaces/msg/detail/ -CPP_INCLUDE_DEST=$ROSIDL_SRC_DIR/rosidl_runtime_cpp/include/rosidl_runtime_cpp/type_description/ +CPP_DETAIL=$BUILD_DIR/$CPP_DETAIL_SUBPATH +CPP_INCLUDE_DEST=$ROSIDL_SRC_DIR/rosidl_runtime_cpp/include/rosidl_runtime_cpp/type_description # C structs mkdir -p $C_INCLUDE_DEST @@ -81,7 +79,8 @@ popd rm -f $SCRIPT_DIR/type_description.fingerprint cat << EOF > $SCRIPT_DIR/type_description.fingerprint # DO NOT EDIT MANUALLY - managed by scripts/copy_type_description_generated_sources.bash -# INTENTIONALLY CHANGING THIS FILE OUTSIDE THE SCRIPT WILL RESULT IN UNDEFINED BEHAVIOR FOR -# ALL OF ROS 2 CORE -RCL_INTERFACES_COMMIT=$RCL_INTERFACES_COMMIT +# INTENTIONALLY CHANGING THIS FILE OUTSIDE THE SCRIPT WILL RESULT IN UNDEFINED BEHAVIOR FOR ALL OF ROS 2 CORE EOF +pushd $BUILD_DIR +sha256sum --tag $C_DETAIL_SUBPATH/*__struct.h $C_DETAIL_SUBPATH/*__functions.h $C_DETAIL_SUBPATH/*__functions.c $CPP_DETAIL_SUBPATH/*__struct.hpp >> $SCRIPT_DIR/type_description.fingerprint +popd diff --git a/scripts/type_description.fingerprint b/scripts/type_description.fingerprint index e97d62590..dc8ea2d93 100644 --- a/scripts/type_description.fingerprint +++ b/scripts/type_description.fingerprint @@ -1,4 +1,26 @@ # DO NOT EDIT MANUALLY - managed by scripts/copy_type_description_generated_sources.bash -# INTENTIONALLY CHANGING THIS FILE OUTSIDE THE SCRIPT WILL RESULT IN UNDEFINED BEHAVIOR FOR -# ALL OF ROS 2 CORE -RCL_INTERFACES_COMMIT=aafd90e360208d620761e0d813c96a217278c435 +# INTENTIONALLY CHANGING THIS FILE OUTSIDE THE SCRIPT WILL RESULT IN UNDEFINED BEHAVIOR FOR ALL OF ROS 2 CORE +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/field__struct.h) = 8e8d4bda083418457e6672f48d9b40ba6d5874bb6e45b01d1ccbf4b6c00754f6 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/field_type__struct.h) = 464743d024e0b36dd71ea3344ef0fc6a05b160f975336b9d3833fc65882f4d77 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/individual_type_description__struct.h) = 7d137429ca2061199b6fbe328d69c5ae3a8506873c45c0bf27e23939d73161a8 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/key_value__struct.h) = 755b7d58c60a260d2524b962979b7328ba39da663f38f4534034d53ae5d32f6c +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/type_description__struct.h) = 61e682c4b4c2e90a167a0c5aa3016ac5159c85e389747fca0e83b76d1c625975 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/type_source__struct.h) = 97c6161b949400146863f228c51be6dc9e0902d7fb5d5322d81d2dc89f73612b +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/field__functions.h) = 7200d2723bc2afca31e53654537373b9ea579179a838387d4cdf381a8503597d +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/field_type__functions.h) = 9d25952ff75b4091928fe6ed7f25794520db2b772cca518478ecb5cc8c291f50 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/individual_type_description__functions.h) = 1ad5fb69750cdfbf442345f5fa3e8ed62349a3276490f603a38b1c485d1c1f70 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/key_value__functions.h) = e238fe5e1c477314a9a94817bc927bcc10a8bdf1ecb4aa011bd76925e4998a6f +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/type_description__functions.h) = 6992f56d5d8dad46409ee0d92f2e6f9be22c9b263c87d65aea4e61bbfc905d35 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/type_source__functions.h) = f3646278e48d68030d08dc112834f2e3a2fc251b6a49fb6de18ed7c366b6874f +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/field__functions.c) = f88b95cf0f78b0b36ff7c19f7b4bae91b5ca09c5051f43fde0231ac49f72dbbb +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/field_type__functions.c) = bc462cc468f6db949ebcb78a19e864fce8217d06c64f4ce0cc0a12c9c314569c +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/individual_type_description__functions.c) = d0580962fcb537e62c62a837fd98c9063c8882f86af8a07dda8b738786e6ae15 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/key_value__functions.c) = 26c004570511e86490d2fe6fdb52c866264ff6c47e8671052476ca440b2fe705 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/type_description__functions.c) = bfa6460a62d08b9759893f475c4e6e65cd912017ab5e8a984475c13ea94f8018 +SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/type_source__functions.c) = 710482d1bf1dd5c332f07f1c16e7eb8dd3a9b1badd3f6cd47de19132ae934448 +SHA256 (rosidl_generator_cpp/type_description_interfaces/msg/detail/field__struct.hpp) = 68e7ded90c66561698cdc33bcf42d27e18e412bd2187c709c0dff17947124507 +SHA256 (rosidl_generator_cpp/type_description_interfaces/msg/detail/field_type__struct.hpp) = 9157fc0f8c7920a881aa60d76a028bc9439405a52dff8f693ecd443e272cfc9d +SHA256 (rosidl_generator_cpp/type_description_interfaces/msg/detail/individual_type_description__struct.hpp) = 62ba41e7cf88df593e92f56507c4c6034d280a73f4e30cfbad3571f139a8704a +SHA256 (rosidl_generator_cpp/type_description_interfaces/msg/detail/key_value__struct.hpp) = df504d6a50d975be55cb1d94210f58b4be03aa79a6e7c8a026b4fe048159bed0 +SHA256 (rosidl_generator_cpp/type_description_interfaces/msg/detail/type_description__struct.hpp) = e6dccdd0c1feb68f409a95584a6f35e06500219c368cb6d5ef766315cfe694e0 +SHA256 (rosidl_generator_cpp/type_description_interfaces/msg/detail/type_source__struct.hpp) = ec9b144a0c1f244ca425c6aa2c591fb0e240c58a0ee4bb8a50e09e3d02245327 From a07462d47091231c52c4911c6983a2826d9a48f4 Mon Sep 17 00:00:00 2001 From: Emerson Knapp Date: Mon, 27 Mar 2023 17:43:35 -0700 Subject: [PATCH 2/2] Changed the fingerprint manually Signed-off-by: Emerson Knapp --- scripts/type_description.fingerprint | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/type_description.fingerprint b/scripts/type_description.fingerprint index dc8ea2d93..94704d034 100644 --- a/scripts/type_description.fingerprint +++ b/scripts/type_description.fingerprint @@ -1,3 +1,4 @@ +# Evil manual edit # DO NOT EDIT MANUALLY - managed by scripts/copy_type_description_generated_sources.bash # INTENTIONALLY CHANGING THIS FILE OUTSIDE THE SCRIPT WILL RESULT IN UNDEFINED BEHAVIOR FOR ALL OF ROS 2 CORE SHA256 (rosidl_generator_c/type_description_interfaces/msg/detail/field__struct.h) = 8e8d4bda083418457e6672f48d9b40ba6d5874bb6e45b01d1ccbf4b6c00754f6