Fixes situations where the remote 'guix build' is invoked before the
.drv has been completely copied, as reported at
<https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00174.html>.
In some cases 'send-files' would return before the other end is done
importing the files, and so the subsequent 'guix build' invocation would
just miss the .drv file it refers to.
* guix/utils.scm (call-with-decompressed-port): Don't close PORT.
(call-with-compressed-output-port): Likewise.
* tests/utils.scm ("compressed-output-port + decompressed-port"): Adjust
accordingly.
* guix/scripts/offload.scm (send-files): Add explicit (close-pipe pipe)
call.
(retrieve-files): Likewise.
Partially fixes <http://bugs.gnu.org/17212>.
* tests/utils.scm ("fcntl-flock wait", "fcntl-flock non-blocking"): Open
files in binary mode, with no buffering.
* guix/utils.scm (call-with-decompressed-port,
call-with-compressed-output-port): New procedures.
* tests/utils.scm ("compressed-output-port + decompressed-port"):
Rewrite to use them.
* guix/utils.scm (decompressed-port, compressed-port): New procedures.
* guix/scripts/substitute-binary.scm (decompressed-port): Remove.
(guix-substitute-binary): Pass a symbol or #f as the first argument to
'decompress-port'.
* tests/utils.scm ("compressed-port, decompressed-port, non-file"): New
test.
* guix/utils.scm (filtered-port): Make sure the 'execl' child process
always exits, and does (primitive-_exit 1) upon execution failure.
Use 'primitive-_exit' in the 'dump-port' child process.
* tests/utils.scm ("filtered-port, does not exist"): New test.
* tests/utils.scm (temp-file): New variable.
("fcntl-flock"): Rewrite to actually test whether the child process
waits for the lock to be released. The previous test was wrong
because (1) it expected F_SETLK semantics, not F_SETLKW, and (2) it
got EBADF because of a mismatch between the open mode and the lock
style.
This fixes Guile version comparisons when (version) has a
vendor-specific suffix.
Reported by Andreas Enge <andreas@enge.fr>.
* guix/utils.scm (guile-version>?): New procedure.
* tests/utils.scm ("guile-version>? 1.8", "guile-version>? 10.5"): New
tests.
* guix/scripts/substitute-binary.scm (fetch, progress-report-port): Use
`guile-version>?' instead of `version>?'.
* guix/http-client.scm (when-guile<=2.0.5, http-fetch): Likewise.
* guix/scripts/substitute-binary.scm (fetch): In the `file' case, open
with the `b' flag, so that the coding cookie reading thing doesn't
lead to buffering some of the data (on 2.0.5).
* tests/utils.scm ("filtered-port, file"): Open with `r0b'. Fixes a
test failure with Guile 2.0.5 whereby the first byte of FILE would be
missing from DECOMPRESSED.
This fixes a bug whereby `read-response' would read more than just the
response, with the extra data going into the port's buffer; the
"bzip2 -dc" process spawned by `filtered-port' would not see the those
buffered data, which are definitely lost, and would bail out with
"bzip2: (stdin) is not a bzip2 file."
* guix/utils.scm (filtered-port): Document that INPUT must be
unbuffered.
* guix/web.scm (http-fetch): Add `buffered?' parameter. Call
`open-socket-for-uri' explicitly, and call `setvbuf' when BUFFERED? is
false. Pass the port to `http-get'. Close it upon 301/302.
* guix/scripts/substitute-binary.scm (fetch): Add `buffered?'
parameter. Pass it to `http-fetch'; honor it for `file' URIs.
(guix-substitute-binary): Call `fetch' with #:buffered? #f for port RAW.
* tests/utils.scm ("filtered-port, file"): Open FILE as unbuffered.
* guix/scripts/substitute-binary.scm (filtered-port): Move to utils.scm.
(decompressed-port): Upon "none", return '() as the second value.
(guix-substitute-binary): Expect `decompressed-port' to return a list
of PIDs as its second value.
* guix/utils.scm (filtered-port): New procedure. Add case for when
INPUT is not `file-port?'.
* tests/utils.scm ("filtered-port, file", "filtered-port, non-file"):
New tests.
* gnu/packages.scm (fold2): Remove.
* guix/utils.scm (fold2): New procedure. Generalization of the above to
one and two lists.
* tests/utils.scm ("fold2, 1 list", "fold2, 2 lists"): New tests.
* guix/utils.scm (define-record-type*)[make-syntactic-constructor]: Add
a `thunked' parameter.
(thunked-field?, field-bindings): New procedures. Use the latter when
generating `letrec*' bindings.
[thunked-field?, thunked-field-accessor-name, field-spec->srfi-9,
thunked-field-accessor-name]: New procedures.
Use them when generating the `define-record-type' form, and to
generated thunk field accessors, along call to
`make-syntactic-constructor' with the new argument.
* tests/utils.scm ("define-record-type* & thunked",
"define-record-type* & thunked & default",
"define-record-type* & thunked & inherited"): New tests.
* guix/utils.scm (package-name->name+version): New procedure.
* guix-package.in (guix-package)[find-package]: Use it.
* tests/utils.scm ("package-name->name+version"): New test.
* Makefile.am (.scm.go): Define $NIX_INSTANTIATE.
(TESTS_ENVIRONMENT): Likewise, and define $NIX_HASH.
* guix/utils.scm (nixpkgs-derivation): Use $NIX_INSTANTIATE when
defined.
* tests/utils.scm (%nix-hash): New variable.
("sha256 & bytevector->nix-base32-string"): Use it.
* guix/utils.scm (define-record-type*)[make-syntactic-constructor]: Bind
all the ((FIELD VALUE) ...) in a `letrec*'. Adjust `field-value'
accordingly.
* tests/utils.scm ("define-record-type* with letrec* behavior"): New
test.
* guix/utils.scm (gnu-triplet->nix-system): New procedure.
(%current-system): New variable.
* tests/utils.scm ("gnu-triplet->nix-system"): New test.
* tests/derivations.scm (%current-system): Remove. Update users to
use (%current-system) instead.
* guix/utils.scm (bytevector-quintet-ref-right,
bytevector-quintet-fold): New procedures.
(bytevector-quintet-fold-right): Add `quintet-fold' parameter; use it
instead of `bytevector-quintet-fold'.
(bytevector->base32-string): Pass BYTEVECTOR-QUINTET-FOLD as the
first parameter.
(bytevector->nix-base32-string): Pass BYTEVECTOR-QUINTET-FOLD-RIGHT as
the first parameter.
* tests/utils.scm ("sha256 & bytevector->nix-base32-string"): New test.