Skip to content

Commit

Permalink
rpm: add docker-compose-plugin as "recommends" / "requires"
Browse files Browse the repository at this point in the history
This defines the dependency between the docker cli and compose (as a plugin). RHEL8
and CentOS 8 (and up) support weak dependencies;

- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/packaging_and_distributing_software/new-features-in-rhel-8_packaging-and-distributing-software#support-for-weak-dependencies_new-features-in-rhel-8
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/packaging_and_distributing_software/new-features-in-rhel-8_packaging-and-distributing-software#boolean-dependencies-syntax

But CentOS 7 and RHEL 7 do not yet support this, so for those, we use "Requires",
using the `%rhel` macro for detection, which also works on CentOS:

    rpm --eval '%{rhel}'
    7

Making the dependency _recommended_ will install it by default, but users _are_ able
to opt-out explicitly, using `--setopt=install_weak_deps=False`, for example, to
perform a light-weight installation that does not require all features of Docker.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Mar 27, 2022
1 parent a6baa8b commit bb4bd31
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rpm/SPECS/docker-ce-cli.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ Packager: Docker <[email protected]>
# required packages on install
Requires: /bin/sh
Requires: /usr/sbin/groupadd

# CentOS 7 and RHEL 7 do not yet support weak dependencies
#
# Note that we're not using <= 7 here, to account for other RPM distros, such
# as Fedora, which would not have the rhel macro set (so default to 0).
%if 0%{?rhel} == 7
Requires: docker-compose-plugin
%else
Recommends: docker-compose-plugin
%endif

# TODO change once we support scan-plugin on other architectures
%ifarch x86_64
# CentOS 7 and RHEL 7 do not yet support weak dependencies
Expand Down
8 changes: 8 additions & 0 deletions rpm/SPECS/docker-compose-plugin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ URL: https://github.com/docker/compose/
Vendor: Docker
Packager: Docker <[email protected]>

# CentOS 7 and RHEL 7 do not yet support weak dependencies.
#
# Note that we're not using <= 7 here, to account for other RPM distros, such
# as Fedora, which would not have the rhel macro set (so default to 0).
%if 0%{?rhel} != 7
Enhances: docker-ce-cli
%endif

BuildRequires: bash

%description
Expand Down

0 comments on commit bb4bd31

Please sign in to comment.