Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ROS installation prefix for RPM generator #741

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

christianrauch
Copy link
Contributor

@christianrauch christianrauch commented Dec 16, 2024

The default 'installation_prefix' is '/usr'. This is wrong for 'rosrpm' and has to be prefixed correctly with the default ROS installation.

With a "standard" bloom pipeline for RPM with something like:

# [...] setup ROS repo
dnf install python3-bloom
git clone https://github.com/AprilRobotics/apriltag.git
cd apriltag
bloom-generate rosrpm --ros-distro humble
dnf builddep -y rpm/template.spec
rpmbuild -bb --build-in-place rpm/template.spec

I am getting spec files with @(InstallationPrefix) set to /usr:

%build
# In case we're installing to a non-standard location, look for a setup.sh
# in the install tree and source it.  It will set things like
# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
if [ -f "/usr/setup.sh" ]; then . "/usr/setup.sh"; fi
mkdir -p .obj-%{_target_platform} && cd .obj-%{_target_platform}
%cmake3 \
    -UINCLUDE_INSTALL_DIR \
    -ULIB_INSTALL_DIR \
    -USYSCONF_INSTALL_DIR \
    -USHARE_INSTALL_PREFIX \
    -ULIB_SUFFIX \
    -DCMAKE_INSTALL_PREFIX="/usr" \
    -DAMENT_PREFIX_PATH="/usr" \
    -DCMAKE_PREFIX_PATH="/usr" \
    -DSETUPTOOLS_DEB_LAYOUT=OFF \
%if !0%{?with_tests}
    -DBUILD_TESTING=OFF \
%endif
    ..

Hence, the rpmbuild will fail.

With this PR (pip3 install -U git+https://github.com/christianrauch/bloom.git@fix_rosrpm):

/usr/local/bin/bloom-generate rosrpm --ros-distro humble

generates a spec file with @(InstallationPrefix) correctly set to /opt/ros/humble:

%build
# In case we're installing to a non-standard location, look for a setup.sh
# in the install tree and source it.  It will set things like
# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
if [ -f "/opt/ros/humble/setup.sh" ]; then . "/opt/ros/humble/setup.sh"; fi
mkdir -p .obj-%{_target_platform} && cd .obj-%{_target_platform}
%cmake3 \
    -UINCLUDE_INSTALL_DIR \
    -ULIB_INSTALL_DIR \
    -USYSCONF_INSTALL_DIR \
    -USHARE_INSTALL_PREFIX \
    -ULIB_SUFFIX \
    -DCMAKE_INSTALL_PREFIX="/opt/ros/humble" \
    -DAMENT_PREFIX_PATH="/opt/ros/humble" \
    -DCMAKE_PREFIX_PATH="/opt/ros/humble" \
    -DSETUPTOOLS_DEB_LAYOUT=OFF \
%if !0%{?with_tests}
    -DBUILD_TESTING=OFF \
%endif
    ..

Also, see this equivalent fix for rosdebian from 10y ago: #288 :-)

The default 'installation_prefix' is '/usr'. This is wrong for 'rosrpm'
and has to be prefixed correctly with the default ROS installation.
@codecov-commenter
Copy link

codecov-commenter commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@b42a1dd). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #741   +/-   ##
=========================================
  Coverage          ?   54.58%           
=========================================
  Files             ?       52           
  Lines             ?     6363           
  Branches          ?     1128           
=========================================
  Hits              ?     3473           
  Misses            ?     2551           
  Partials          ?      339           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@christianrauch christianrauch marked this pull request as ready for review December 16, 2024 19:16
Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a slam dunk to me. Thanks for the PR!

@christianrauch
Copy link
Contributor Author

The bug is so obvious, I am wondering if this feature is never used, how does the build farm use bloom to generate RPM packages?

@cottsay
Copy link
Member

cottsay commented Dec 18, 2024

The bug is so obvious, I am wondering if this feature is never used, how does the build farm use bloom to generate RPM packages?

We've been building RPM packages for a very long time now, I think that nobody's been invoking bloom-generate directly to build RPM packages. I typically clone down and use git-bloom-generate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants