From 2f608c14893a025b471bcd993096f92331a45a12 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 25 Jun 2018 18:40:10 +0200 Subject: store: Add 'port->connection'. * guix/store.scm (port->connection): New procedure. --- guix/store.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'guix') 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)) -- cgit v1.2.3 From 26db747a863b08ebcfd630cce635be86c23d829d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 27 Jun 2018 15:36:03 +0200 Subject: ui: Hint at the installation of locale packages and 'GUIX_LOCPATH'. * guix/ui.scm (install-locale): Hide the "warning: failed to install locale" on Guile 2.2. Add a hint about 'glibc-utf8-locales' and 'GUIX_LOCPATH'. --- guix/ui.scm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/ui.scm b/guix/ui.scm index 31830ee850..ec709450d8 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." -- cgit v1.2.3 From 0925c0ea771b949d58be084444fa2c2370f6d74e Mon Sep 17 00:00:00 2001 From: Taylan Kammer Date: Fri, 22 Jun 2018 21:55:26 +0200 Subject: scripts: gc: Report size in MiBs instead of bytes. * guix/scripts/gc.scm (guix-gc): Show info in MiBs not bytes. --- guix/scripts/gc.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'guix') 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) -- cgit v1.2.3 From 108015df6d03e82ac9a6a0a92dcfa389fa702e72 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 27 Jun 2018 22:33:36 +0200 Subject: self: Add dependency on GnuTLS. Fixes . Reported by Fis Trivial . * guix/self.scm (specification->package): Add "gnutls" and "guile2.0-gnutls". (compiled-guix)[gnutls]: New variable. [dependencies]: Add it. --- guix/self.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'guix') 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))) -- cgit v1.2.3 From fd1395c4982dd8cf7fe9843317d1ebb1e5d78bee Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 29 Jun 2018 12:17:41 +0200 Subject: ui: Increase relevance score for exact matches. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously "guix package -s python" would have 'python2-zope-interface' as its first result (relevance: 10), followed by many other python-* packages with the same score, while 'python' itself would come later (relevance: 7). This change makes 'python' the first result (relevance: 27). Reported by Gábor Boskovits. * guix/ui.scm (relevance)[score]: Use 'fold-matches' instead of 'match:count' to counter the number of maches. Give more weight to exact matches. --- guix/ui.scm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'guix') diff --git a/guix/ui.scm b/guix/ui.scm index ec709450d8..6996b7f1c4 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1222,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)))) -- cgit v1.2.3