From: Royyan Zahir <royzah@gmail.com>
To: meta-virtualization@lists.yoctoproject.org
Subject: [meta-virtualization][PATCH] crun: provide virtual-runc and honour CRUN_AS_RUNC
Date: Sat, 19 Sep 2026 21:35:39 +0400 [thread overview]
Message-ID: <20260919173540.1602199-1-royzah@gmail.com> (raw)
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
next reply other threads:[~2026-09-19 17:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 17:35 Royyan Zahir [this message]
2026-09-19 18:24 ` [meta-virtualization][PATCH] crun: provide virtual-runc and honour CRUN_AS_RUNC Bruce Ashfield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260919173540.1602199-1-royzah@gmail.com \
--to=royzah@gmail.com \
--cc=meta-virtualization@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.