[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mysterious error while refactoring guix/scripts/system.scm
From: |
Andy Wingo |
Subject: |
Re: Mysterious error while refactoring guix/scripts/system.scm |
Date: |
Thu, 04 Aug 2016 09:56:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
On Thu 04 Aug 2016 08:20, Chris Marusich <address@hidden> writes:
> 1038: 3 [thunk]
> In gnu/packages/bootstrap.scm:
> 191: 2 [raw-build #<build-daemon 256.15 43c72c0> "guile-bootstrap-2.0" ...]
> In gnu/packages.scm:
> 91: 1 [search-bootstrap-binary "tar" #<procedure system (#:optional _)>]
> In unknown file:
> ?: 0 [string-append #<procedure system (#:optional _)> "/" "tar"]
>
> ERROR: In procedure string-append:
> ERROR: In procedure string-append: Wrong type (expecting string): #<procedure
> system (#:optional _)>
This is because you moved some code around:
> --- a/guix/scripts/system.scm
> +++ b/guix/scripts/system.scm
> @@ -785,47 +785,46 @@ resulting from command-line parsing."
> (grub-configuration-device
> (operating-system-bootloader os)))))
>
> - (with-store store
> - (set-build-options-from-command-line store opts)
> -
> - (run-with-store store
> - (mbegin %store-monad
> - (set-guile-for-build (default-guile))
> - (case action
> - ((extension-graph)
> - (export-extension-graph os (current-output-port)))
> - ((shepherd-graph)
> - (export-shepherd-graph os (current-output-port)))
> - (else
> - (perform-action action os
> - #:dry-run? dry?
> - #:derivations-only? (assoc-ref opts
> -
> 'derivations-only?)
> - #:use-substitutes? (assoc-ref opts
> 'substitutes?)
> - #:image-size (assoc-ref opts 'image-size)
> - #:full-boot? (assoc-ref opts 'full-boot?)
> - #:mappings (filter-map (match-lambda
> - (('file-system-mapping
> . m)
> - m)
> - (_ #f))
> - opts)
> - #:grub? grub?
> - #:target target #:device device))))
> - #:system system))))
> + (case action
> + ((extension-graph)
> + (export-extension-graph os (current-output-port)))
> + ((shepherd-graph)
> + (export-shepherd-graph os (current-output-port)))
> + (else
> + (perform-action action os
> + #:dry-run? dry?
> + #:derivations-only? (assoc-ref opts
> + 'derivations-only?)
> + #:use-substitutes? (assoc-ref opts 'substitutes?)
> + #:image-size (assoc-ref opts 'image-size)
> + #:full-boot? (assoc-ref opts 'full-boot?)
> + #:mappings (filter-map (match-lambda
> + (('file-system-mapping . m)
> + m)
> + (_ #f))
> + opts)
> + #:grub? grub?
> + #:target target #:device device)))))
Here the #:system system was taking the `system' binding from within the
function -- it was lexically bound.
> (define (process-command command args opts)
> "Process COMMAND, one of the 'guix system' sub-commands. ARGS is its
> argument list and OPTS is the option alist."
> - (case command
> - ((list-generations)
> - ;; List generations. No need to connect to the daemon, etc.
> - (let ((pattern (match args
> - (() "")
> - ((pattern) pattern)
> - (x (leave (_ "wrong number of arguments~%"))))))
> - (list-generations pattern)))
> - (else
> - (process-action command args opts))))
> + (with-store store
> + (set-build-options-from-command-line store opts)
> +
> + (run-with-store store
> + (mbegin %store-monad
> + (set-guile-for-build (default-guile))
> + (case command
> + ((list-generations)
> + (let ((pattern (match args
> + (() "")
> + ((pattern) pattern)
> + (x (leave (_ "wrong number of arguments~%"))))))
> + (list-generations pattern)))
> + (else
> + (process-action command args opts))))
> + #:system system)))
Here it's not bound in the function so we take the top-level binding,
which is the `system' library call, a function.
Andy