Guix build builds but errors when given file-like object

  • Open
  • quality assurance status badge
Details
One participant
  • Richard Sent
Owner
unassigned
Submitted by
Richard Sent
Severity
normal
R
R
Richard Sent wrote on 17 Mar 03:48 +0100
(address . bug-guix@gnu.org)
87cyrt376l.fsf@freakingpenguin.com
When running ~$ guix build -f test.scm~, where test.scm returns a file
like object, the output is built but an error is printed. According to
(info (guix) Additional Build Options), file-like objects are supported
by guix build -f.

For example, with the following file:

Toggle snippet (6 lines)
(use-modules
(guix gexp))

(plain-file "hello-world" "HELLO WORLD")

/gnu/store/.....-hello-world is built and contains "HELLO WORLD", but
there is an match error in guix/ui.scm:show-derivation-outputs.

Toggle snippet (15 lines)
...
In guix/scripts/build.scm:
804:26 4 (_)
In srfi/srfi-1.scm:
634:9 3 (for-each #<procedure show-derivation-outputs (derivat?> ?)
In guix/ui.scm:
956:2 2 (show-derivation-outputs _)
In ice-9/boot-9.scm:
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" "/gnu/store/wvr6byljawdlxgxabl6798i0afqgpyiq-hello-world")'.

This error could be fixed with the following patch:

Toggle snippet (17 lines)
diff --git a/guix/ui.scm b/guix/ui.scm
index 962d291d2e..4dc926cbfe 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -958,7 +958,9 @@ (define (show-derivation-outputs derivation)
(show-outputs derivation (derivation-output-names derivation)))
((? derivation-input? input)
(show-outputs (derivation-input-derivation input)
- (derivation-input-sub-derivations input)))))
+ (derivation-input-sub-derivations input)))
+ ((? string?) ;file-like object was built
+ (format #t "~a~%" derivation))))
(define* (check-available-space need
#:optional (directory (%store-prefix)))

However, this brings up another error.

Toggle snippet (13 lines)
...
In guix/scripts/build.scm:
808:49 3 (_ "/gnu/store/wvr6byljawdlxgxabl6798i0afqgpyiq-hello-w?")
In guix/derivations.scm:
709:7 2 (derivation->output-paths "/gnu/store/wvr6byljawdlxgxab?")
In ice-9/boot-9.scm:
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure struct-vtable: Wrong type argument in position 1 (expecting struct): "/gnu/store/wvr6byljawdlxgxabl6798i0afqgpyiq-hello-world"

In my opinion, being able to directly build file-like objects from the
command line is a useful feature and should be better supported. I don't
know if the ideal fix involves changing the guix-build command in
guix/scripts/build.scm to stop assuming everything is a derivation or
changing the logic in guix/derivations.scm to handle strings in addition
to derivation structs.


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