diff options
| -rw-r--r-- | play-motion2.spec | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/play-motion2.spec b/play-motion2.spec index 265a063..24c597a 100644 --- a/play-motion2.spec +++ b/play-motion2.spec @@ -12,7 +12,7 @@ Name: ros-%{ros_distro}-%{RosPkgName} Version: 1.8.7 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Play a pre-recorded motion on a robot (ROS 2) License: Apache-2.0 @@ -30,6 +30,15 @@ Source0: https://github.com/pal-robotics/play_motion2/archive/%{version}. %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 @@ -86,6 +95,10 @@ 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} @@ -123,45 +136,45 @@ cmake .. \ -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \ -DSETUPTOOLS_DEB_LAYOUT=OFF %__make %{?_smp_mflags} -%__make install DESTDIR=%{buildroot} +%__make install DESTDIR=%{stage_root} cd ../.. -# Expose the freshly installed msgs to the subsequent packages via the -# buildroot prefix so ament_cmake_auto can find play_motion2_msgs. -export AMENT_PREFIX_PATH=%{buildroot}%{_ros_prefix}${AMENT_PREFIX_PATH:+:$AMENT_PREFIX_PATH} -export CMAKE_PREFIX_PATH=%{buildroot}%{_ros_prefix}${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH} -export PYTHONPATH=%{buildroot}%{_ros_prefix}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH} +# 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=%{buildroot}%{_ros_prefix}:%{_ros_prefix} \ - -DCMAKE_PREFIX_PATH=%{buildroot}%{_ros_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=%{buildroot} +%__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=%{buildroot} \ + --root=%{stage_root} \ --prefix=%{_ros_prefix} \ --single-version-externally-managed \ --record=installed_files.txt cd .. %install -# All artifacts already installed into the buildroot during the build phase -# (dependency ordering requires earlier sub-packages to be installed before -# later ones can be configured). -: +# 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 @@ -169,5 +182,10 @@ cd .. %{_ros_prefix}/ %changelog +* Thu Sep 24 2026 AI Importer <ai-importer@openeuler.org> - 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 <ai-importer@openeuler.org> - 1.8.7-1 - Initial package for ROS 2 humble play_motion2 (1.8.7) |
