All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-virtualization][PATCH] crun: provide virtual-runc and honour CRUN_AS_RUNC
@ 2026-09-19 17:35 Royyan Zahir
  2026-09-19 18:24 ` Bruce Ashfield
  0 siblings, 1 reply; 2+ messages in thread
From: Royyan Zahir @ 2026-09-19 17:35 UTC (permalink / raw)
  To: meta-virtualization

runc.inc declares the provider abstraction the layer builds on:

  PROVIDES += "virtual/runc"
  RPROVIDES:${PN} = "virtual-runc"

crun declares neither, even though it already stands in for runc: with
CRUN_AS_RUNC it installs the /usr/bin/runc symlink and takes RCONFLICTS on
the runc package. So PREFERRED_RPROVIDER_virtual-runc = "crun" cannot
resolve, and every consumer that wants crun as its OCI runtime carries the
same bbappend adding the RPROVIDES by hand.

Join the virtual when the symlink is installed, which is the case where crun
actually substitutes for runc.

While here, make CRUN_AS_RUNC mean what it says. Both guards treat the string
"false" as true, the shell one because -n tests for a non-empty string and the
python one because a non-empty str is truthy, so the only way to turn the
symlink off today is to set the variable to the empty string. Normalize once
with bb.utils.to_boolean() and use that everywhere.

Note that to_boolean() rejects values outside the y/yes/1/true and n/no/0/false
sets, so a recipe or config setting CRUN_AS_RUNC to something else now fails to
parse instead of silently enabling the symlink.

Signed-off-by: Royyan Zahir <royzah@gmail.com>
---
 recipes-containers/crun/crun_git.bb | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/recipes-containers/crun/crun_git.bb b/recipes-containers/crun/crun_git.bb
index 288c953..67e67e9 100644
--- a/recipes-containers/crun/crun_git.bb
+++ b/recipes-containers/crun/crun_git.bb
@@ -31,6 +31,10 @@ CLEANBROKEN = "1"
 # with container stacks
 CRUN_AS_RUNC ?= "true"
 
+# Normalized once: a bare "false" is a non-empty string and would otherwise
+# read as true in both the shell test and the python expansions below.
+CRUN_AS_RUNC_ENABLED = "${@'1' if bb.utils.to_boolean(d.getVar('CRUN_AS_RUNC')) else ''}"
+
 PACKAGECONFIG ??= " \
     caps external-yajl man \
     ${@bb.utils.contains('DISTRO_FEATURES', 'seccomp', 'seccomp', '', d)} \
@@ -56,13 +60,15 @@ do_configure:prepend () {
 
 do_install() {
     oe_runmake 'DESTDIR=${D}' install
-    if [ -n "${CRUN_AS_RUNC}" ]; then
+    if [ -n "${CRUN_AS_RUNC_ENABLED}" ]; then
         ln -sr "${D}/${bindir}/crun" "${D}${bindir}/runc"
     fi
 }
 
-# When crun provides /usr/bin/runc symlink, it conflicts with the runc package
-RCONFLICTS:${PN} = "${@'runc' if d.getVar('CRUN_AS_RUNC') else ''}"
+# When crun provides the /usr/bin/runc symlink it replaces the runc package,
+# so it conflicts with it and stands in for it as the virtual-runc provider.
+RCONFLICTS:${PN} = "${@'runc' if d.getVar('CRUN_AS_RUNC_ENABLED') else ''}"
+RPROVIDES:${PN} += "${@'virtual-runc' if d.getVar('CRUN_AS_RUNC_ENABLED') else ''}"
 
 REQUIRED_DISTRO_FEATURES:class-native ?= ""
 DEPENDS:class-native += "yajl libcap go-md2man m4 libseccomp"
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-19 18:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-19 17:35 [meta-virtualization][PATCH] crun: provide virtual-runc and honour CRUN_AS_RUNC Royyan Zahir
2026-09-19 18:24 ` Bruce Ashfield

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.