diff --git a/tools/abi_check.py b/tools/abi_check.py index bd3ba8dc..a77372c5 100644 --- a/tools/abi_check.py +++ b/tools/abi_check.py @@ -209,10 +209,12 @@ def headers(prefix): def _is_compatibility_package(rec: dict) -> bool: - """vinca's ros-- packages (package_name_mode: both) are empty and - only depend on ros2- of the same version.""" + """vinca's ros-- packages (package_name_mode: both) are empty and only + depend on ros2- of the same version (and, since RoboStack/vinca#171, on the + distribution's mutex).""" deps = rec.get("depends", []) - return len(deps) == 1 and deps[0].startswith("ros2-") and "==" in deps[0] + return (bool(deps) and deps[0].startswith("ros2-") and "==" in deps[0] + and all(d.startswith("ros2-distro-mutex") for d in deps[1:])) def short_name(name: str, distro: str) -> str | None: diff --git a/tools/tests/test_abi_check.py b/tools/tests/test_abi_check.py index 6352cd23..f8b13009 100644 --- a/tools/tests/test_abi_check.py +++ b/tools/tests/test_abi_check.py @@ -42,3 +42,13 @@ def test_next_build_number_is_above_vinca_and_every_published_build(tmp_path, mo monkeypatch.setattr(rs, "DISTROS", tmp_path) assert abi_check.next_build_number({"a": {"1": {"build_number": 30}}, "b": {"2": {"build_number": 7}}}, "jazzy") == 31 assert abi_check.next_build_number({"a": {"1": {"build_number": 3}}}, "jazzy") == 26 + + +def test_compatibility_packages_with_and_without_the_mutex(): + assert abi_check._is_compatibility_package({"depends": ["ros2-rclcpp ==28.1.22"]}) + assert abi_check._is_compatibility_package( + {"depends": ["ros2-rclcpp ==28.1.22", "ros2-distro-mutex 0.19.* jazzy_*"]}) + assert not abi_check._is_compatibility_package( + {"depends": ["ros2-rclcpp ==28.1.22", "libboost >=1.90"]}) + assert not abi_check._is_compatibility_package({"depends": ["ros2-distro-mutex 0.19.* jazzy_*", "libfoo"]}) + assert not abi_check._is_compatibility_package({"depends": []})