summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-07-02 12:18:58 +0200
committerMarius Bakke <mbakke@fastmail.com>2018-07-02 12:18:58 +0200
commit92af3ce417fdcb932c3f291e0c79106466a40c66 (patch)
tree610d10ca5c4197c1a0ae14f1972dc72fb78a39d3 /guix
parentcb4b508cd68df89bfbd5255a0c5569f8318ad50f (diff)
parent6e65eb3cad1d1148eade9ed2228cdea90d531a94 (diff)
downloadguix-patches-92af3ce417fdcb932c3f291e0c79106466a40c66.tar
guix-patches-92af3ce417fdcb932c3f291e0c79106466a40c66.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/gc.scm10
-rw-r--r--guix/self.scm9
-rw-r--r--guix/store.scm18
-rw-r--r--guix/ui.scm30
4 files changed, 54 insertions, 13 deletions
diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm
index e4ed7227ff..6f37b767ff 100644
--- a/guix/scripts/gc.scm
+++ b/guix/scripts/gc.scm
@@ -199,10 +199,10 @@ Invoke the garbage collector.\n"))
;; Attempt to have at least SPACE bytes available in STORE.
(let ((free (free-disk-space (%store-prefix))))
(if (> free space)
- (info (G_ "already ~h bytes available on ~a, nothing to do~%")
- free (%store-prefix))
+ (info (G_ "already ~h MiBs available on ~a, nothing to do~%")
+ (/ free 1024. 1024.) (%store-prefix))
(let ((to-free (- space free)))
- (info (G_ "freeing ~h bytes~%") to-free)
+ (info (G_ "freeing ~h MiBs~%") (/ to-free 1024. 1024.))
(collect-garbage store to-free)))))
(with-error-handling
@@ -234,10 +234,10 @@ Invoke the garbage collector.\n"))
(ensure-free-space store free-space))
(min-freed
(let-values (((paths freed) (collect-garbage store min-freed)))
- (info (G_ "freed ~h bytes~%") freed)))
+ (info (G_ "freed ~h MiBs~%") (/ freed 1024. 1024.))))
(else
(let-values (((paths freed) (collect-garbage store)))
- (info (G_ "freed ~h bytes~%") freed))))))
+ (info (G_ "freed ~h MiBs~%") (/ freed 1024. 1024.)))))))
((delete)
(delete-paths store (map direct-store-path paths)))
((list-references)
diff --git a/guix/self.scm b/guix/self.scm
index 0ad8c34e2a..89c5428039 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -83,6 +83,7 @@ GUILE-VERSION (\"2.0\" or \"2.2\"), or #f if none of the packages matches."
("guile-ssh" (ref '(gnu packages ssh) 'guile-ssh))
("guile-git" (ref '(gnu packages guile) 'guile-git))
("guile-sqlite3" (ref '(gnu packages guile) 'guile-sqlite3))
+ ("gnutls" (ref '(gnu packages tls) 'gnutls))
("libgcrypt" (ref '(gnu packages gnupg) 'libgcrypt))
("zlib" (ref '(gnu packages compression) 'zlib))
("gzip" (ref '(gnu packages compression) 'gzip))
@@ -92,6 +93,7 @@ GUILE-VERSION (\"2.0\" or \"2.2\"), or #f if none of the packages matches."
("guile2.0-ssh" (ref '(gnu packages ssh) 'guile2.0-ssh))
("guile2.0-git" (ref '(gnu packages guile) 'guile2.0-git))
;; XXX: No "guile2.0-sqlite3".
+ ("guile2.0-gnutls" (ref '(gnu packages tls) 'gnutls/guile-2.0))
(_ #f)))) ;no such package
@@ -459,11 +461,16 @@ assumed to be part of MODULES."
"guile-sqlite3"
"guile2.0-sqlite3"))
+ (define gnutls
+ (package-for-guile guile-version
+ "gnutls" "guile2.0-gnutls"))
+
(define dependencies
(match (append-map (lambda (package)
(cons (list "x" package)
(package-transitive-propagated-inputs package)))
- (list guile-git guile-json guile-ssh guile-sqlite3))
+ (list gnutls guile-git guile-json
+ guile-ssh guile-sqlite3))
(((labels packages _ ...) ...)
packages)))
diff --git a/guix/store.scm b/guix/store.scm
index 773d53e82b..3bf56573bf 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -65,6 +65,7 @@
build-mode
open-connection
+ port->connection
close-connection
with-store
set-build-options
@@ -517,6 +518,23 @@ for this connection will be pinned. Return a server object."
(or done? (process-stderr conn)))
conn)))))))))
+(define* (port->connection port
+ #:key (version %protocol-version))
+ "Assimilate PORT, an input/output port, and return a connection to the
+daemon, assuming the given protocol VERSION.
+
+Warning: this procedure assumes that the initial handshake with the daemon has
+already taken place on PORT and that we're just continuing on this established
+connection. Use with care."
+ (let-values (((output flush)
+ (buffering-output-port port (make-bytevector 8192))))
+ (%make-nix-server port
+ (protocol-major version)
+ (protocol-minor version)
+ output flush
+ (make-hash-table 100)
+ (make-hash-table 100))))
+
(define (write-buffered-output server)
"Flush SERVER's output port."
(force-output (nix-server-output-port server))
diff --git a/guix/ui.scm b/guix/ui.scm
index 31830ee850..6996b7f1c4 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -421,8 +421,21 @@ report them in a user-friendly way."
(lambda _
(setlocale LC_ALL ""))
(lambda args
- (warning (G_ "failed to install locale: ~a~%")
- (strerror (system-error-errno args))))))
+ (cond-expand
+ ;; Guile 2.2 already emits a warning, so let's not add a second one.
+ (guile-2.2 #t)
+ (else (warning (G_ "failed to install locale: ~a~%")
+ (strerror (system-error-errno args)))))
+ (display-hint (G_ "Consider installing the @code{glibc-utf8-locales} or
+@code{glibc-locales} package and defining @code{GUIX_LOCPATH}, along these
+lines:
+
+@example
+guix package -i glibc-utf8-locales
+export GUIX_LOCPATH=\"$HOME/.guix-profile/lib/locale\"
+@end example
+
+See the \"Application Setup\" section in the manual, for more info.\n")))))
(define (initialize-guix)
"Perform the usual initialization for stand-alone Guix commands."
@@ -1209,11 +1222,14 @@ field in the final score.
A score of zero means that OBJ does not match any of REGEXPS. The higher the
score, the more relevant OBJ is to REGEXPS."
(define (score str)
- (let ((counts (filter-map (lambda (regexp)
- (match (regexp-exec regexp str)
- (#f #f)
- (m (match:count m))))
- regexps)))
+ (let ((counts (map (lambda (regexp)
+ (match (fold-matches regexp str '() cons)
+ (() 0)
+ ((m) (if (string=? (match:substring m) str)
+ 5 ;exact match
+ 1))
+ (lst (length lst))))
+ regexps)))
;; Compute a score that's proportional to the number of regexps matched
;; and to the number of matches for each regexp.
(* (length counts) (reduce + 0 counts))))