# topdir: play-motion2-1.8.7 # ROS 2 humble metapackage (single repo, 3 sub-packages): # play_motion2 (ament_cmake_auto, C++ core + embedded python module) # play_motion2_msgs (ament_cmake, rosidl msg/srv/action) # play_motion2_cli (ament_python, ros2cli plugin) # Single spec builds the whole tree in dependency order; one rpm owns the # whole /opt/ros/humble prefix with virtual Provides aliases for the sibling # packages so dependents can resolve ros-humble-play-motion2-msgs. %define ros_distro humble %define RosPkgName play-motion2 Name: ros-%{ros_distro}-%{RosPkgName} Version: 1.8.7 Release: 2%{?dist} Summary: Play a pre-recorded motion on a robot (ROS 2) License: Apache-2.0 URL: https://github.com/pal-robotics/play_motion2 Source0: https://github.com/pal-robotics/play_motion2/archive/%{version}.tar.gz#/play-motion2-%{version}.tar.gz # debug subpackages are meaningless under /opt prefix %global debug_package %{nil} # drop brp-python-bytecompile: /opt python files would otherwise be compiled # into the standard sitelib path %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') # ROS packages do their own dependency model via ament; disable autodeps on /opt %global __provides_exclude_from ^/opt/ros/%{ros_distro}/.*$ %global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$ %global _ros_prefix /opt/ros/%{ros_distro} # Cross-package dependency ordering requires earlier sub-packages to be # installed before later ones can be configured, so all artifacts are staged # under a sibling stage dir during the build phase (not the buildroot). The # install section then copies the staged tree into the freshly cleaned # buildroot -- the standard two-phase RPM install that survives the install # template's rm -rf cleanup. %global stage_root %{_builddir}/stage %global stage_prefix %{stage_root}%{_ros_prefix} BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: make BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-wheel # ROS base environment (provides /opt/ros/humble/setup.sh) BuildRequires: ros-%{ros_distro}-ros-workspace # ament build tools BuildRequires: ros-%{ros_distro}-ament-cmake BuildRequires: ros-%{ros_distro}-ament-cmake-auto BuildRequires: ros-%{ros_distro}-ament-cmake-python # message generation toolchain (play_motion2_msgs) BuildRequires: ros-%{ros_distro}-rosidl-default-generators BuildRequires: ros-%{ros_distro}-builtin-interfaces # build/runtime ROS deps (from package.xml /) BuildRequires: ros-%{ros_distro}-backward-ros BuildRequires: ros-%{ros_distro}-control-msgs BuildRequires: ros-%{ros_distro}-controller-manager-msgs BuildRequires: ros-%{ros_distro}-lifecycle-msgs BuildRequires: ros-%{ros_distro}-moveit-ros-planning-interface BuildRequires: ros-%{ros_distro}-rclcpp BuildRequires: ros-%{ros_distro}-rclcpp-action BuildRequires: ros-%{ros_distro}-rclcpp-components BuildRequires: ros-%{ros_distro}-rclcpp-lifecycle BuildRequires: ros-%{ros_distro}-sensor-msgs BuildRequires: ros-%{ros_distro}-std-msgs BuildRequires: ros-%{ros_distro}-trajectory-msgs # play_motion2_cli (ament_python) runtime deps needed at build for entry points BuildRequires: ros-%{ros_distro}-rclpy BuildRequires: ros-%{ros_distro}-ros2cli Requires: ros-%{ros_distro}-ros-workspace Requires: ros-%{ros_distro}-ament-cmake Requires: ros-%{ros_distro}-rosidl-default-runtime Requires: ros-%{ros_distro}-backward-ros Requires: ros-%{ros_distro}-control-msgs Requires: ros-%{ros_distro}-controller-manager-msgs Requires: ros-%{ros_distro}-lifecycle-msgs Requires: ros-%{ros_distro}-moveit-ros-planning-interface Requires: ros-%{ros_distro}-rclcpp Requires: ros-%{ros_distro}-rclcpp-action Requires: ros-%{ros_distro}-rclcpp-components Requires: ros-%{ros_distro}-rclcpp-lifecycle Requires: ros-%{ros_distro}-sensor-msgs Requires: ros-%{ros_distro}-std-msgs Requires: ros-%{ros_distro}-trajectory-msgs Requires: ros-%{ros_distro}-launch Requires: ros-%{ros_distro}-launch-ros Requires: ros-%{ros_distro}-rclpy Requires: ros-%{ros_distro}-ros2cli # Single rpm owns the whole prefix; provide virtual aliases for the sibling # packages so dependents can resolve ros-humble-play-motion2-msgs / -cli. # play_motion2's package.xml declares a runtime depend on play_motion2_msgs; # since this spec builds that sub-package itself (see Provides below), the # require is self-satisfied. Requires: ros-%{ros_distro}-play-motion2-msgs = %{version}-%{release} Provides: ros-%{ros_distro}-play-motion2-msgs = %{version}-%{release} Provides: ros-%{ros_distro}-play-motion2-cli = %{version}-%{release} Provides: %{name}-devel = %{version}-%{release} Provides: %{name}-doc = %{version}-%{release} Provides: %{name}-runtime = %{version}-%{release} %description PlayMotion2 is a tool to play and handle pre-recorded motions in ROS 2. This package builds the full upstream repository, which contains: * play_motion2 - the C++ motion player node and client library * play_motion2_msgs - the Motion message and PlayMotion2 action interfaces * play_motion2_cli - the ros2cli plugin providing the `ros2 play_motion` verb %prep %autosetup -n play-motion2-%{version} %build # ROS base environment (guard: some buildroots may lack setup.sh) [ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true export PYTHONPATH=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH} export PKG_CONFIG_PATH=/opt/ros/%{ros_distro}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH} export AMENT_PREFIX_PATH=/opt/ros/%{ros_distro}${AMENT_PREFIX_PATH:+:$AMENT_PREFIX_PATH} export CMAKE_PREFIX_PATH=/opt/ros/%{ros_distro}${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH} # --- 1. play_motion2_msgs (ament_cmake, rosidl) --------------------------- # Build first: play_motion2 depends on its generated interfaces. cd play_motion2_msgs mkdir -p build && cd build cmake .. \ -DCMAKE_INSTALL_PREFIX=%{_ros_prefix} \ -DAMENT_PREFIX_PATH=%{_ros_prefix} \ -DCMAKE_PREFIX_PATH=%{_ros_prefix} \ -DBUILD_TESTING=OFF \ -UINCLUDE_INSTALL_DIR -ULIB_INSTALL_DIR -USYSCONF_INSTALL_DIR \ -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \ -DSETUPTOOLS_DEB_LAYOUT=OFF %__make %{?_smp_mflags} %__make install DESTDIR=%{stage_root} cd ../.. # Expose the freshly installed msgs to the subsequent packages via the staged # prefix so ament_cmake_auto can find play_motion2_msgs. export AMENT_PREFIX_PATH=%{stage_prefix}${AMENT_PREFIX_PATH:+:$AMENT_PREFIX_PATH} export CMAKE_PREFIX_PATH=%{stage_prefix}${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH} export PYTHONPATH=%{stage_prefix}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH} # --- 2. play_motion2 (ament_cmake_auto + ament_cmake_python) -------------- cd play_motion2 mkdir -p build && cd build cmake .. \ -DCMAKE_INSTALL_PREFIX=%{_ros_prefix} \ -DAMENT_PREFIX_PATH=%{stage_prefix}:%{_ros_prefix} \ -DCMAKE_PREFIX_PATH=%{stage_prefix}:%{_ros_prefix} \ -DBUILD_TESTING=OFF \ -UINCLUDE_INSTALL_DIR -ULIB_INSTALL_DIR -USYSCONF_INSTALL_DIR \ -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \ -DSETUPTOOLS_DEB_LAYOUT=OFF %__make %{?_smp_mflags} %__make install DESTDIR=%{stage_root} cd ../.. # --- 3. play_motion2_cli (ament_python) ----------------------------------- cd play_motion2_cli %{__python3} setup.py build %{__python3} setup.py install \ --root=%{stage_root} \ --prefix=%{_ros_prefix} \ --single-version-externally-managed \ --record=installed_files.txt cd .. %install # The default install template has already wiped the buildroot (rm -rf + # mkdir). All artifacts were staged during the build phase, so copy the # staged tree into the now-empty buildroot. cp -a %{stage_root}/. %{buildroot}/ %files %license LICENSE %doc README.md %{_ros_prefix}/ %changelog * Thu Sep 24 2026 AI Importer - 1.8.7-2 - Stage build artifacts under a sibling dir during the build phase and copy into the buildroot in the install section, so the install template's rm -rf no longer discards artifacts installed for cross-package dependency ordering. * Thu Sep 24 2026 AI Importer - 1.8.7-1 - Initial package for ROS 2 humble play_motion2 (1.8.7)