On Mon, Jan 8, 2024 at 1:09 PM Ming Liu <[email protected]> wrote: > > From: Ming Liu <[email protected]> > > Generate podman bash completion script with qemu wrapper. > > When docker pkgconfig is enabled, also generate bash completion script > for docker.
Just to get bash-completions, this is too complicated and brittle. In this situation, we need to figure out what it is generating, do it once, and capture the output (or otherwise simulate it). Bruce > > Signed-off-by: Ming Liu <[email protected]> > --- > recipes-containers/podman/podman_git.bb | 29 +++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/recipes-containers/podman/podman_git.bb > b/recipes-containers/podman/podman_git.bb > index 33d437a3..1c64272a 100644 > --- a/recipes-containers/podman/podman_git.bb > +++ b/recipes-containers/podman/podman_git.bb > @@ -68,6 +68,18 @@ EXTRA_OEMAKE = " \ > # packageconfig, the podman package will rconfict with docker. > PACKAGECONFIG ?= "docker" > > +# podman builds bash completion with the help of podman binary, only the > machines > +# that support qemu usermode can enable this pkgconfig. > +PACKAGECONFIG:append = " ${@bb.utils.contains('MACHINE_FEATURES', > 'qemu-usermode', 'completion', '', d)}" > +DEPENDS:append = " ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', > 'qemu-native', '', d)}" > + > +inherit qemu bash-completion > + > +# To avoid breaking the recipes without 'completion' enabled. > +ALLOW_EMPTY:${PN}-bash-completion = "1" > + > +QEMU_OPTIONS = "" > + > do_compile() { > cd ${S}/src > rm -rf .gopath > @@ -116,6 +128,23 @@ do_install() { > install -d "${D}${sysconfdir}/sysctl.d" > install -m 0644 "${WORKDIR}/50-podman-rootless.conf" > "${D}${sysconfdir}/sysctl.d" > fi > + > + if ${@bb.utils.contains('PACKAGECONFIG', 'completion', 'true', > 'false', d)}; then > + qemu_binary="${@qemu_wrapper_cmdline(d, > '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}" > + cat > ${WORKDIR}/podman-qemuwrapper << EOF > +#!/bin/sh > + > +$qemu_binary "\$@" > +EOF > + chmod +x ${WORKDIR}/podman-qemuwrapper > + ${WORKDIR}/podman-qemuwrapper ./bin/podman completion bash > > ${B}/podman-bash-completion > + install -d ${D}${datadir}/bash-completion/completions > + install -m 0644 ${B}/podman-bash-completion > ${D}${datadir}/bash-completion/completions/podman > + if ${@bb.utils.contains('PACKAGECONFIG', 'docker', 'true', > 'false', d)}; then > + sed "s/podman/docker/g" ${B}/podman-bash-completion > > ${B}/docker-bash-completion > + install -m 0644 ${B}/docker-bash-completion > ${D}${datadir}/bash-completion/completions/docker > + fi > + fi > } > > do_install_ptest () { > -- > 2.34.1 > > > > -- - Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#8532): https://lists.yoctoproject.org/g/meta-virtualization/message/8532 Mute This Topic: https://lists.yoctoproject.org/mt/103603296/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/leave/6693005/21656/1014668956/xyzzy [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
