cdi: add container-device-interface commandline utility
PATCH v2 1/1 cdi: add container-device-interface commandline utility
From the upstream description:
The cdi command-line tool is a utility for inspecting and interacting with the CDI (Container Device Interface) cache. It allows developers and system administrators to:
- List CDI Spec files: View all available CDI specification files in the configured directories
- List vendors: Display registered device vendors in the CDI cache
- List device classes: Show available device classes from CDI Specs
- List devices: Enumerate all CDI devices available in the system
- Validate specs: Verify CDI specification files against the JSON schema
- Inject devices: Inject CDI device configurations into OCI runtime specifications
- Monitor cache: Watch for changes in the CDI cache and Spec directories
- Resolve devices: Resolve fully-qualified device names to their configurations
The CLI tool is particularly useful for debugging CDI configurations, validating spec files, and testing device assignments before deploying them in production environments.
---
Changes since v1:
* Buildflags patch went upstream: https://github.com/cncf-tags/container-device-interface/pull/313
recipes-containers/cdi/cdi_git.bb | 42 ++++++++++++++++ recipes-containers/cdi/go-mod-cache.inc | 50 +++++++++++++++++++ recipes-containers/cdi/go-mod-git.inc | 42 ++++++++++++++++ .../cdi/go-mod-hybrid-cache.inc | 10 ++++ recipes-containers/cdi/go-mod-hybrid-git.inc | 7 +++ .../cdi/go-mod-hybrid-gomod.inc | 45 +++++++++++++++++ 6 files changed, 196 insertions(+) create mode 100644 recipes-containers/cdi/cdi_git.bb create mode 100644 recipes-containers/cdi/go-mod-cache.inc create mode 100644 recipes-containers/cdi/go-mod-git.inc create mode 100644 recipes-containers/cdi/go-mod-hybrid-cache.inc create mode 100644 recipes-containers/cdi/go-mod-hybrid-git.inc create mode 100644 recipes-containers/cdi/go-mod-hybrid-gomod.inc
recipes-containers/cdi/cdi_git.bb new file +42 -0
@@ -0,0 +1,42 @@ +DESCRIPTION = "The cdi command-line tool is a utility for inspecting and interacting with the CDI (Container Device Interface) cache." +SUMMARY = "The cdi command-line tool." +HOMEPAGE = "https://github.com/cncf-tags/container-device-interface" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +PV = "1.1.0+git" +SRCREV_cdi = "35765bd41b50a86aa3919eb352bc90321e010e68" +SRCREV_FORMAT = "cdi" +SRC_URI = "git://github.com/cncf-tags/container-device-interface.git;protocol=https;name=cdi;branch=main;destsuffix=${GO_SRCURI_DESTSUFFIX} \ + " +SRCREV_FORMAT = "cdi" + +GO_IMPORT = "tags.cncf.io/container-device-interface/" + +inherit go goarch + +# GO_MOD_FETCH_MODE: "vcs" (all git://) or "hybrid" (gomod:// + git://) +GO_MOD_FETCH_MODE ?= "hybrid" + +# VCS mode: all modules via git:// +include ${@ "go-mod-git.inc" if d.getVar("GO_MOD_FETCH_MODE") == "vcs" else ""} +include ${@ "go-mod-cache.inc" if d.getVar("GO_MOD_FETCH_MODE") == "vcs" else ""} + +# Hybrid mode: gomod:// for most, git:// for selected +include ${@ "go-mod-hybrid-gomod.inc" if d.getVar("GO_MOD_FETCH_MODE") == "hybrid" else ""} +include ${@ "go-mod-hybrid-git.inc" if d.getVar("GO_MOD_FETCH_MODE") == "hybrid" else ""} +include ${@ "go-mod-hybrid-cache.inc" if d.getVar("GO_MOD_FETCH_MODE") == "hybrid" else ""} + +EXTRA_OEMAKE = "GO_EXTRAFLAGS='${GO_BUILDFLAGS}'" + +do_compile() { + cd ${S}/src/${GO_IMPORT} + pwd + oe_runmake +} + +do_install() { + install -d "${D}${bindir}" + install -m 755 ${S}/src/${GO_IMPORT}/bin/* "${D}${bindir}" +}
recipes-containers/cdi/go-mod-cache.inc new file +50 -0
50 lines not on this page · raw message
recipes-containers/cdi/go-mod-git.inc new file +42 -0
42 lines not on this page · raw message
recipes-containers/cdi/go-mod-hybrid-cache.inc new file +10 -0
@@ -0,0 +1,10 @@ +# Generated by oe-go-mod-fetcher-hybrid.py +# Metadata for git-fetched modules (VCS path) +# Used by go-mod-vcs.bbclass to build module cache from git checkouts + +inherit go-mod-vcs + +# Module metadata for cache building (one module per line) +GO_MODULE_CACHE_DATA = '[\ +{"module":"tags.cncf.io/container-device-interface","version":"v1.1.0","vcs_hash":"2a0706ee0554e66b341fabb5c09e62f00336b0a7e6faac981d973f30b4064622","timestamp":"2025-12-10T08:48:20Z","subdir":"","vcs_ref":"refs/tags/v1.1.0"},\ +{"module":"tags.cncf.io/container-device-interface/specs-go","version":"v1.1.0","vcs_hash":"2a0706ee0554e66b341fabb5c09e62f00336b0a7e6faac981d973f30b4064622","timestamp":"2025-12-10T08:48:20Z","subdir":"specs-go","vcs_ref":"refs/tags/specs-go/v1.1.0"}]'
recipes-containers/cdi/go-mod-hybrid-git.inc new file +7 -0
@@ -0,0 +1,7 @@ +# Generated by oe-go-mod-fetcher-hybrid.py +# Go modules fetched from git repositories (VCS path) +# +# These modules are fetched directly from their git repositories. +# They provide full VCS provenance and allow easy SRCREV bumping. + +SRC_URI += "git://github.com/cncf-tags/container-device-interface;protocol=https;nobranch=1;tag=v1.1.0;shallow=1;rev=98a7d735d9592c1ccca0130e06b0709f4b65ecbf;name=git_c2439148_0;destsuffix=vcs_cache/2a0706ee0554e66b341fabb5c09e62f00336b0a7e6faac981d973f30b4064622"
recipes-containers/cdi/go-mod-hybrid-gomod.inc new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.47.3