~ruther/guix-local

94b26ff2841b90826968386de0b71a46284d2ee0 — Owen T. Heisler 2 months ago 24d0c0a
services: oci: Fix oci-image value field handling.

* gnu/services/containers.scm (lower-oci-image-state, oci-lowerable-image?):
Remove support for gexps and correctly lower file-like objects.
* doc/guix.texi: Remove gexp from oci-image value field description.

Fixes: guix/guix#3818
Change-Id: Ib812d65b32dd68f8572fcb371ab4521d22e5336c
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #3819
2 files changed, 7 insertions(+), 8 deletions(-)

M doc/guix.texi
M gnu/services/containers.scm
M doc/guix.texi => doc/guix.texi +1 -1
@@ 45481,7 45481,7 @@ A string representing the OCI image tag.  Defaults to @code{latest}.
@item @code{value} (type: oci-lowerable-image)
A @code{manifest} or @code{operating-system} record that will be lowered
into an OCI compatible tarball.  Otherwise this field's value can be a
gexp or a file-like object that evaluates to an OCI compatible tarball.
file-like object that evaluates to an OCI compatible tarball.

@item @code{pack-options} (default: @code{'()}) (type: list)
An optional set of keyword arguments that will be passed to the

M gnu/services/containers.scm => gnu/services/containers.scm +6 -7
@@ 1,5 1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2024, 2025 Giacomo Leidi <therewasa@fishinthecalculator.me>
;;; Copyright © 2025 Owen T. Heisler <writer@owenh.net>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 523,7 524,6 @@ but ~a was found") el))))
(define (oci-lowerable-image? image)
  (or (manifest? image)
      (operating-system? image)
      (gexp? image)
      (file-like? image)))

(define (string-or-oci-image? image)


@@ 558,8 558,8 @@ the OCI image.")
  (value
   (oci-lowerable-image)
   "A @code{manifest} or @code{operating-system} record that will be lowered
into an OCI compatible tarball.  Otherwise this field's value can be a gexp
or a file-like object that evaluates to an OCI compatible tarball.")
into an OCI compatible tarball.  Otherwise this field's value can be a
file-like object that evaluates to an OCI compatible tarball.")
  (pack-options
   (list '())
   "An optional set of keyword arguments that will be passed to the


@@ 1080,14 1080,13 @@ for the OCI runtime volume create command."
                        target system grafts?))
       ((? operating-system? value)
        (lower-operating-system value target system))
       ((or (? gexp? value)
            (? file-like? value))
        value)
       ((? file-like? value)
        (lower-object value))
       (_
        (raise
         (formatted-message
          (G_ "oci-image value must contain only manifest,
operating-system, gexp or file-like records but ~a was found")
operating-system, or file-like records but ~a was found")
          value))))
     #:target target
     #:system system)))