Skip to content

Commit

Permalink
Add option to disable weak RPM dependencies (#574)
Browse files Browse the repository at this point in the history
Rather than hard-code the circumstances under which weak RPM
dependencies are not supported, allow the RPM build configuration to
disable them by passing `--without weak_deps` during the RPM build.
  • Loading branch information
cottsay authored Feb 27, 2020
1 parent 7578ef7 commit b590f55
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
8 changes: 3 additions & 5 deletions bloom/generators/rosrpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,9 @@ def fallback_resolver(key, peer_packages, rosdistro=self.rosdistro):
subs['Provides'].extend(
sanitize_package_name(rosify_package_name(g.name, self.rosdistro)) +
'(member)' for g in package.member_of_groups)
if self.os_name != 'rhel' or not rpm_distro.isnumeric() or int(rpm_distro) >= 8:
# Weak dependencies are not supported in RHEL < 8 and will break the package.
subs['Supplements'].extend(
sanitize_package_name(rosify_package_name(g.name, self.rosdistro)) +
'(all)' for g in package.member_of_groups)
subs['Supplements'].extend(
sanitize_package_name(rosify_package_name(g.name, self.rosdistro)) +
'(all)' for g in package.member_of_groups)

# ROS 2 specific bloom extensions.
ros2_distros = [
Expand Down
4 changes: 4 additions & 0 deletions bloom/generators/rpm/templates/ament_cmake/template.spec.em
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%bcond_without weak_deps

%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __provides_exclude_from ^@(InstallationPrefix)/.*$
%global __requires_exclude_from ^@(InstallationPrefix)/.*$
Expand All @@ -17,7 +19,9 @@ Source0: %{name}-%{version}.tar.gz
@[for p in Conflicts]Conflicts: @p@\n@[end for]@
@[for p in Replaces]Obsoletes: @p@\n@[end for]@
@[for p in Provides]Provides: @p@\n@[end for]@
@[if Supplements]@\n%if 0%{?with_weak_deps}
@[for p in Supplements]Supplements: @p@\n@[end for]@
%endif@\n@[end if]@

%description
@(Description)
Expand Down
4 changes: 4 additions & 0 deletions bloom/generators/rpm/templates/ament_python/template.spec.em
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%bcond_without weak_deps

%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __provides_exclude_from ^@(InstallationPrefix)/.*$
%global __requires_exclude_from ^@(InstallationPrefix)/.*$
Expand All @@ -17,7 +19,9 @@ Source0: %{name}-%{version}.tar.gz
@[for p in Conflicts]Conflicts: @p@\n@[end for]@
@[for p in Replaces]Obsoletes: @p@\n@[end for]@
@[for p in Provides]Provides: @p@\n@[end for]@
@[if Supplements]@\n%if 0%{?with_weak_deps}
@[for p in Supplements]Supplements: @p@\n@[end for]@
%endif@\n@[end if]@

%description
@(Description)
Expand Down
4 changes: 4 additions & 0 deletions bloom/generators/rpm/templates/catkin/template.spec.em
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%bcond_without weak_deps

%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __provides_exclude_from ^@(InstallationPrefix)/.*$
%global __requires_exclude_from ^@(InstallationPrefix)/.*$
Expand All @@ -17,7 +19,9 @@ Source0: %{name}-%{version}.tar.gz
@[for p in Conflicts]Conflicts: @p@\n@[end for]@
@[for p in Replaces]Obsoletes: @p@\n@[end for]@
@[for p in Provides]Provides: @p@\n@[end for]@
@[if Supplements]@\n%if 0%{?with_weak_deps}
@[for p in Supplements]Supplements: @p@\n@[end for]@
%endif@\n@[end if]@

%description
@(Description)
Expand Down
4 changes: 4 additions & 0 deletions bloom/generators/rpm/templates/cmake/template.spec.em
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%bcond_without weak_deps

%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __provides_exclude_from ^@(InstallationPrefix)/.*$
%global __requires_exclude_from ^@(InstallationPrefix)/.*$
Expand All @@ -17,7 +19,9 @@ Source0: %{name}-%{version}.tar.gz
@[for p in Conflicts]Conflicts: @p@\n@[end for]@
@[for p in Replaces]Obsoletes: @p@\n@[end for]@
@[for p in Provides]Provides: @p@\n@[end for]@
@[if Supplements]@\n%if 0%{?with_weak_deps}
@[for p in Supplements]Supplements: @p@\n@[end for]@
%endif@\n@[end if]@

%description
@(Description)
Expand Down

0 comments on commit b590f55

Please sign in to comment.