diff options
author | Andreas Enge <andreas@enge.fr> | 2016-07-25 21:58:36 +0200 |
---|---|---|
committer | Andreas Enge <andreas@enge.fr> | 2016-07-25 21:58:36 +0200 |
commit | 14656f44959a519239910b88b783fa6adbbd8d40 (patch) | |
tree | 0ece327363bc6ee3d0cacba13c751361091b6ca8 /gnu/packages/java.scm | |
parent | d8eb912132ccdff955e3318fe549c5f7f674adf8 (diff) | |
parent | 424a323e92d92284efcd30cf548d1f41c556d592 (diff) | |
download | guix-14656f44959a519239910b88b783fa6adbbd8d40.tar.gz |
Merge remote-tracking branch 'origin/master' into core-updates
Diffstat (limited to 'gnu/packages/java.scm')
-rw-r--r-- | gnu/packages/java.scm | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 2d50ad84fa..83ffba4f4c 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -535,17 +535,38 @@ build process and its dependencies, whereas Make uses Makefile format.") "/etc/ssl/certs")) (keytool (string-append (assoc-ref outputs "jdk") "/bin/keytool"))) + (define (extract-cert file target) + (call-with-input-file file + (lambda (in) + (call-with-output-file target + (lambda (out) + (let loop ((line (read-line in 'concat)) + (copying? #f)) + (cond + ((eof-object? line) #t) + ((string-prefix? "-----BEGIN" line) + (display line out) + (loop (read-line in 'concat) #t)) + ((string-prefix? "-----END" line) + (display line out) + #t) + (else + (when copying? (display line out)) + (loop (read-line in 'concat) copying?))))))))) (define (import-cert cert) (format #t "Importing certificate ~a\n" (basename cert)) - (let* ((port (open-pipe* OPEN_WRITE keytool - "-import" - "-alias" (basename cert) - "-keystore" keystore - "-storepass" "changeit" - "-file" cert))) - (display "yes\n" port) - (when (not (zero? (status:exit-val (close-pipe port)))) - (error "failed to import" cert)))) + (let ((temp "tmpcert")) + (extract-cert cert temp) + (let ((port (open-pipe* OPEN_WRITE keytool + "-import" + "-alias" (basename cert) + "-keystore" keystore + "-storepass" "changeit" + "-file" temp))) + (display "yes\n" port) + (when (not (zero? (status:exit-val (close-pipe port)))) + (error "failed to import" cert))) + (delete-file temp))) ;; This is necessary because the certificate directory contains ;; files with non-ASCII characters in their names. |