guix build: Validate that the file passed to ‘-m’ returns a manifest.

* guix/scripts/build.scm (options->things-to-build)[ensure-manifest]:
New procedure.
Use it.

Change-Id: If64c483d7079f441a296d5bd4e06e67f44cbb7bf
This commit is contained in:
Ludovic Courtès 2024-11-26 10:51:20 +01:00
parent 5d6691d33e
commit c6050cce28
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -629,6 +629,12 @@ (define (ensure-list x)
(for-each validate-type lst)
lst))
(define (ensure-manifest x file)
(unless (manifest? x)
(raise (formatted-message (G_ "file '~a' does not return a manifest")
file)))
x)
(define system
(or (assoc-ref opts 'system) (%current-system)))
@ -701,9 +707,11 @@ (define (for-type obj)
(loop tail 'regular
(append (map manifest-entry-item
(manifest-entries
(ensure-manifest
(load* manifest
(make-user-module '((guix profiles)
(gnu))))))
(gnu))))
manifest)))
result)))
(('expression . str)
(loop tail 'regular