help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cuirass custom jobs module syntax?


From: Richard Sent
Subject: Cuirass custom jobs module syntax?
Date: Fri, 01 Mar 2024 13:25:56 -0500

Hi all,

I'm trying to build operating-system declarations as part of a LAN
substitute server, but I can't seem to get Cuirass's custom build type
working.

My Cuirass specification looks like this:

--8<---------------cut here---------------start------------->8---
(define %rsent-cuirass-specs
  #~(list (specification
           (name "rsent-systems")
           ;; TODO: Find out option here to build operating-systems
           ;; (not images) in rsent channel.
           (build '(custom (rsent machines lan gibraltar)))
           (channels
            (cons #$rsent-channel-gexp
                  %default-channels)))))
--8<---------------cut here---------------end--------------->8---

gibraltar has code that looks like

--8<---------------cut here---------------start------------->8---
(define-module (rsent machines lan gibraltar)
;; ...
  #:export (cuirass-jobs))

(define* (gibraltar-jobs store systems #:key source commit)
  (map (lambda (system)
         (let ((name (string->symbol
                      (string-append "gibraltar." system))))
           (deriviation->job name
                             (operating-system-derivation
                              gibraltar-system))))))

(define (cuirass-jobs store arguments)
  "Register Cuirass jobs."
  (define systems
    (arguments->systems arguments))
  
  ;; Turn off grafts.  Grafting is meant to happen on the user's machines.
  (parameterize ((%graft? #f))
    (gibraltar-jobs store systems)))
--8<---------------cut here---------------end--------------->8---

When Cuirass evaluates the specification, this error is printed in the
logs:

--8<---------------cut here---------------start------------->8---
;; building path(s) `/gnu/store/9rpjz153hxfknlmywyipxcz5yaiag8nw-profile'
;; In thread:
;; uncaught throw to %exception: (#<&inferior-exception arguments: 
(wrong-type-arg "symbol->string" "Wrong type argument in position ~A (expecting 
~A): ~S" (1 "symbol" (rsent machines lan gibraltar)) ((rsent machines lan 
gibraltar)))
;; inferior: #<inferior pipe (0 1 1) 7fc6d310a380>
;; stack: ((#f ("ice-9/boot-9.scm" 1779 13))
;;        (raise-exception ("ice-9/boot-9.scm" 1682 16))
;;        (raise-exception ("ice-9/boot-9.scm" 1684 16))
;;        (symbol->string (#f #f #f))
;;        (try-module-autoload ("ice-9/boot-9.scm" 3526 15))
;;        (#f ("ice-9/boot-9.scm" 3252 13))
;;        (#f ("ice-9/threads.scm" 389 8))
;;        (resolve-interface ("ice-9/boot-9.scm" 3326 17))
;;        (#f ("gnu/ci.scm" 559 27))
;;        (map1 ("srfi/srfi-1.scm" 585 17))
;;        (append-map ("srfi/srfi-1.scm" 672 15))
;;        (map1 ("srfi/srfi-1.scm" 585 17))
;;        (append-map ("srfi/srfi-1.scm" 672 15))
;;        (cuirass-jobs ("gnu/ci.scm" 499 4))
;;        (#f ("ice-9/eval.scm" 158 9))
;;        (with-exception-handler ("ice-9/boot-9.scm" 1751 10))
;;        (call-with-prompt ("ice-9/boot-9.scm" 723 2))
;;        (#f (#f #f #f))
;;        (#f ("guix/repl.scm" 98 21))
;;        (with-exception-handler ("ice-9/boot-9.scm" 1751 10))
;;        (with-exception-handler ("ice-9/boot-9.scm" 1746 15))
;;        (#f ("guix/repl.scm" 125 7)))>)
--8<---------------cut here---------------end--------------->8---

I assume it's angry that my list of symbols isn't a symbol, ergo it
can't convert it into a string. However, if I take the code from
guix/ci.scm:555 and run it, the module does resolve successfully.

--8<---------------cut here---------------start------------->8---
;; This runs just fine. Code taken from cuirass-jobs in guix/ci.scm:555
(use-modules
 (srfi srfi-1)
 (ice-9 match))

(let ((subset '(custom (rsent machines lan gibraltar))))
    (match subset
      (('custom . modules)
          ;; Build custom modules jobs only.
          (append-map
           (lambda (module)
             (let ((proc (module-ref
                          (resolve-interface module)
                          'cuirass-jobs)))
               proc ;no store for testing, just return proc if found
               ))
           modules))))
--8<---------------cut here---------------end--------------->8---

Why would (resolve-interface) work with (rsent machines lan gibraltar)
in one setting but not in another? Running Guix pull locally with the
same channel list works just fine, although the hash of the output
profile is different for reasons I don't understand.

Just for funsies I did try double quoting, e.g. '(custom '(rsent
machines lan gibraltar)), but that didn't help.

Appreciate any help or examples on this!

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]