Skip to contentSkip to conversation

docker/podman: add alternative link for docker

PATCH In review [email protected] 2 participants 7 messages Dec 11, 2023

lore
Share & tools
lore
#0 lore raw

cover docker/podman: add alternative link for docker

From: Ming Liu <[email protected]>

Ming Liu (2):
docker: add alternative link for docker
podman: add alternative link for docker

 recipes-containers/docker/docker.inc    |  6 +++++-
 recipes-containers/podman/podman_git.bb | 12 ++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 docker: add alternative link for docker

From: Ming Liu <[email protected]>

This allows other recipes also install docker tool, for instance, when 'docker' pkgconfig being enabled in podman.

---
 recipes-containers/docker/docker.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
recipes-containers/docker/docker.inc +5 -1
index 48f7d3ec..861b4839 100644
@@ -36,11 +36,15 @@ GO_IMPORT = "import"
 S = "${WORKDIR}/git"
 
 
-inherit systemd update-rc.d
+inherit systemd update-rc.d update-alternatives
 inherit go
 inherit goarch
 inherit pkgconfig
 
+ALTERNATIVE_PRIORITY = "60"
+ALTERNATIVE:${PN}-cli = "docker"
+ALTERNATIVE_LINK_NAME[docker] = "${bindir}/docker"
+
 do_configure[noexec] = "1"
 
 # Export for possible use in Makefiles, default value comes from go.bbclass
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/2 podman: add alternative link for docker

In reply to [email protected]

From: Ming Liu <[email protected]>

Add alternative link for docker when 'docker' pkgconfig is enabled, this allows it could be installed together with docker-cli package.

---
 recipes-containers/podman/podman_git.bb | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
recipes-containers/podman/podman_git.bb +8 -4
index 7634ac85..e021dcd4 100644
@@ -63,11 +63,16 @@ EXTRA_OEMAKE = " \
      SYSTEMDDIR=${systemd_unitdir}/system USERSYSTEMDDIR=${systemd_unitdir}/user \
 "
 
-# remove 'docker' from the packageconfig if you don't want podman to
-# build and install the docker wrapper. If docker is enabled in the
-# packageconfig, the podman package will rconfict with docker.
 PACKAGECONFIG ?= "docker"
 
+UPDATE_ALTERNATIVES_BBCLASS = "${@bb.utils.contains('PACKAGECONFIG', 'docker', 'update-alternatives', '', d)}"
+
+inherit ${UPDATE_ALTERNATIVES_BBCLASS}
+
+ALTERNATIVE_PRIORITY = "50"
+ALTERNATIVE:${PN} = "docker"
+ALTERNATIVE_LINK_NAME[docker] = "${bindir}/docker"
+
 do_compile() {
 	cd ${S}/src
 	rm -rf .gopath
@@ -151,7 +156,6 @@ RDEPENDS:${PN} += "\
 	${@bb.utils.contains('PACKAGECONFIG', 'rootless', 'fuse-overlayfs slirp4netns', '', d)} \
 "
 RRECOMMENDS:${PN} += "slirp4netns kernel-module-xt-masquerade kernel-module-xt-comment"
-RCONFLICTS:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'docker', 'docker', '', d)}"
 
 RDEPENDS:${PN}-ptest += " \
 	bash \
Signature · 1 line
2.34.1
#3 lore raw

Re: [meta-virtualization] [PATCH 2/2] podman: add alternative link for docker

I'm going to keep these as rconflicts.

There's simply no compelling reason to have both installed at the same time.

And the alternatives and the links they create are simply complexity we don't need.

Bruce

Quoted 55 lines · Ming Liu

From: Ming Liu <[email protected]>

Add alternative link for docker when 'docker' pkgconfig is enabled, this allows it could be installed together with docker-cli package.

---
 recipes-containers/podman/podman_git.bb | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
recipes-containers/podman/podman_git.bb +8 -5
index 7634ac85..e021dcd4 100644
@@ -63,11 +63,16 @@ EXTRA_OEMAKE = " \
      SYSTEMDDIR=${systemd_unitdir}/system USERSYSTEMDDIR=${systemd_unitdir}/user \
 "
 
-# remove 'docker' from the packageconfig if you don't want podman to
-# build and install the docker wrapper. If docker is enabled in the
-# packageconfig, the podman package will rconfict with docker.
 PACKAGECONFIG ?= "docker"
 
+UPDATE_ALTERNATIVES_BBCLASS = "${@bb.utils.contains('PACKAGECONFIG', 'docker', 'update-alternatives', '', d)}"
+
+inherit ${UPDATE_ALTERNATIVES_BBCLASS}
+
+ALTERNATIVE_PRIORITY = "50"
+ALTERNATIVE:${PN} = "docker"
+ALTERNATIVE_LINK_NAME[docker] = "${bindir}/docker"
+
 do_compile() {
        cd ${S}/src
        rm -rf .gopath
@@ -151,7 +156,6 @@ RDEPENDS:${PN} += "\
        ${@bb.utils.contains('PACKAGECONFIG', 'rootless', 'fuse-overlayfs slirp4netns', '', d)} \
 "
 RRECOMMENDS:${PN} += "slirp4netns kernel-module-xt-masquerade kernel-module-xt-comment"
-RCONFLICTS:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'docker', 'docker', '', d)}"
 
 RDEPENDS:${PN}-ptest += " \
        bash \
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8497): https://lists.yoctoproject.org/g/meta-virtualization/message/8497
Mute This Topic: https://lists.yoctoproject.org/mt/103107328/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
author
#4 lore raw

Re: [meta-virtualization] [PATCH 2/2] podman: add alternative link for docker

Hi, Bruce:

They are both being added in packagegroup-container? If I install that packagegroup from the current code base, I will get a conflict error?

the best,
thank you

#5 lore raw

Re: [meta-virtualization] [PATCH 2/2] podman: add alternative link for docker

Quoted 4 lines · Ming Liu

Hi, Bruce:

They are both being added in packagegroup-container? If I install that packagegroup from the current code base, I will get a conflict error?

That packagegroup is used as a build test, versus something that is installed (and that distinction isn't clear, I've been meaning to improve it for quite some time).

We can split the packagegroup to make it more useful, that's definitely a patch that I would accept.

Bruce

Quoted 3 lines

the best,
thank you

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
author
#6 lore raw

Re: [meta-virtualization] [PATCH 2/2] podman: add alternative link for docker

OK, understood, thanks for the explanation.

the best,
thank you

Quoted 26 lines · Ming Liu
Quoted 4 lines

Hi, Bruce:

They are both being added in packagegroup-container? If I install that

packagegroup from the current code base, I will get a conflict error?

That packagegroup is used as a build test, versus something that is installed (and that distinction isn't clear, I've been meaning to improve it for quite some time).

We can split the packagegroup to make it more useful, that's definitely a patch that I would accept.

Bruce

Quoted 3 lines

the best,
thank you

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II