Skip to contentSkip to conversation

crun: honour CRUN_AS_RUNC

PATCH In review Royyan Zahir 2 participants 2 messages Sep 19 – Sep 23 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 1/1 crun: honour CRUN_AS_RUNC

CRUN_AS_RUNC = "false" installs the /usr/bin/runc symlink anyway. Both guards read the string as true: the shell one because -n tests for a non-empty string, the python one because a non-empty str is truthy. The only way to disable the symlink today is to set the variable empty.

Normalize once with bb.utils.to_boolean() and use that in both places.

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

---
v2: drop the RPROVIDES virtual-runc hunk and the RCONFLICTS comment
rewording, per Bruce.

 recipes-containers/crun/crun_git.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
recipes-containers/crun/crun_git.bb +6 -2
index 288c953..97c6603 100644
@@ -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 expansion 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,13 @@ 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 ''}"
+RCONFLICTS:${PN} = "${@'runc' if d.getVar('CRUN_AS_RUNC_ENABLED') else ''}"
 
 REQUIRED_DISTRO_FEATURES:class-native ?= ""
 DEPENDS:class-native += "yajl libcap go-md2man m4 libseccomp"
Signature · 1 line
2.55.0