From a6baa8b026ab7d07fedbf2b0163577e29c1ea793 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 3 Jul 2021 13:08:37 +0200 Subject: [PATCH 1/2] deb: add docker-compose-plugin as "recommends" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a "weak" dependency on the docker-compose-plugin, per the recommendations in https://debian-handbook.info/browse/stable/sect.package-meta-information.html#id-1.8.6.7.10.10 The "recommends" dependency will be installed by default, but does allow users to opt-out using `--no-install-recommends` to perform a lightweight installation for setups that only need basic functionality of docker; > (...) the “recommended” dependencies, the most important, considerably improve > the functionality offered by the package but are not indispensable to its operation. > (...) You should always install the “recommended” packages, unless you know exactly > why you do not need them. This is now also the default for APT unless configured > otherwise. Signed-off-by: Sebastiaan van Stijn --- deb/common/control | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deb/common/control b/deb/common/control index a9cd38b1ed..c74791decf 100644 --- a/deb/common/control +++ b/deb/common/control @@ -63,7 +63,8 @@ Package: docker-ce-cli Architecture: linux-any Depends: ${shlibs:Depends} # TODO change once we support scan-plugin on other architectures -Recommends: docker-scan-plugin [amd64] +Recommends: docker-compose-plugin, + docker-scan-plugin [amd64] Conflicts: docker (<< 1.5~), docker-engine, docker-engine-cs, From bb4bd31ab60fe5bc496021d2606882db913c5bad Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 3 Jul 2021 13:46:30 +0200 Subject: [PATCH 2/2] rpm: add docker-compose-plugin as "recommends" / "requires" 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 --- rpm/SPECS/docker-ce-cli.spec | 11 +++++++++++ rpm/SPECS/docker-compose-plugin.spec | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/rpm/SPECS/docker-ce-cli.spec b/rpm/SPECS/docker-ce-cli.spec index 254c2f4390..e9e55f25e3 100644 --- a/rpm/SPECS/docker-ce-cli.spec +++ b/rpm/SPECS/docker-ce-cli.spec @@ -16,6 +16,17 @@ Packager: Docker # 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 diff --git a/rpm/SPECS/docker-compose-plugin.spec b/rpm/SPECS/docker-compose-plugin.spec index a4a583a0bf..017c3fb6d5 100644 --- a/rpm/SPECS/docker-compose-plugin.spec +++ b/rpm/SPECS/docker-compose-plugin.spec @@ -12,6 +12,14 @@ URL: https://github.com/docker/compose/ Vendor: Docker Packager: Docker +# 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