From fcf0bb686b41a75b260b5e16f6de5d284d0416b1 Mon Sep 17 00:00:00 2001 From: Andrea Bernasconi Date: Wed, 18 Nov 2026 15:28:39 +0100 Subject: [PATCH] build(containers): use native astyle in the ROS images astyle-py 1.1.0 requires PyYAML~=6.0.1, which conflicts with the distro PyYAML 5.4.1 that the ROS humble image pins as a pip constraint, so the image build fails with ResolutionImpossible. Install the distro astyle (3.1 on jammy and noble, accepted by fix_code_style.sh) and leave astyle-py out of the requirements installed in the ROS images. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Andrea Bernasconi --- .../containers/ros2-install-dependencies.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Tools/packaging/containers/ros2-install-dependencies.sh b/Tools/packaging/containers/ros2-install-dependencies.sh index b2b0822f9c5..f03e79b6d0c 100644 --- a/Tools/packaging/containers/ros2-install-dependencies.sh +++ b/Tools/packaging/containers/ros2-install-dependencies.sh @@ -18,10 +18,18 @@ apt-get install -y --no-install-recommends /ros2-apt-source.deb rm /ros2-apt-source.deb apt-get update apt-get install -y --no-install-recommends \ - build-essential ccache cmake git ninja-build \ + astyle build-essential ccache cmake git ninja-build \ python3-empy python3-pip ros-dev-tools "ros-${ROS_DISTRO}-ros-base" \ "ros-${ROS_DISTRO}-rmw-zenoh-cpp" +# astyle-py requires PyYAML 6, which conflicts with the distro PyYAML pinned +# below (5.4.1 on jammy). Rely on the distro astyle 3.1 installed above, which +# Tools/astyle/fix_code_style.sh accepts. /px4-setup is a read-only bind mount, +# so filter a copy of it. +px4_setup_dir=$(mktemp -d) +cp -r /px4-setup/. "${px4_setup_dir}" +sed -i '/^astyle-py/d' "${px4_setup_dir}/requirements.txt" + # Keep Ubuntu/ROS Python packages while satisfying PX4's shared requirements. # Distro-only versions (e.g. ubuntu suffixes) cannot be pip constraints. python3 - <<'PY' > /px4-python-constraints.txt @@ -43,8 +51,8 @@ else extra_args="" fi RUNS_IN_DOCKER=true PIP_CONSTRAINT=/px4-python-constraints.txt PIP_NO_CACHE_DIR=1 \ - bash /px4-setup/ubuntu.sh --no-nuttx ${extra_args} -rm /px4-python-constraints.txt + bash "${px4_setup_dir}/ubuntu.sh" --no-nuttx ${extra_args} +rm -rf /px4-python-constraints.txt "${px4_setup_dir}" rosdep init rosdep update --rosdistro "${ROS_DISTRO}"