From 2cd599f005bb91ae120a66824b8efbac81a27a69 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 29 Sep 2019 13:58:17 +0100 Subject: inferior: Change to use the (guix repl) module. Rather than (guix scripts repl), from which the machine-repl procedure was removed in [1]. 1: 92a4087bf4862d5ba9b77111eba3c68c2a1c4679 * guix/inferior.scm (inferior-pipe): Load (guix repl) rather than (guix scripts repl). --- guix/inferior.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/inferior.scm b/guix/inferior.scm index dcbc954432..d6d2053ab8 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -136,8 +136,8 @@ it's an old Guix." (object->string `(begin (primitive-load ,(search-path %load-path - "guix/scripts/repl.scm")) - ((@ (guix scripts repl) machine-repl)))))) + "guix/repl.scm")) + ((@ (guix repl) machine-repl)))))) pipe))) (define* (port->inferior pipe #:optional (close close-port)) -- cgit v1.2.3 From 13169000f6a1cc8513345542f3bae8978d0c6b1a Mon Sep 17 00:00:00 2001 From: Konrad Hinsen Date: Tue, 1 Oct 2019 17:06:58 +0200 Subject: pull: Do not use '~*', which 'msgfmt' fails to interpret. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Really fixes . This is a followup to f751b4646d3989d76dad9e33e39f9724c7c50be6. * guix/scripts/pull.scm (display-channel-news): Remove second occurrence of '~*' in a format string. Signed-off-by: Ludovic Courtès --- guix/scripts/pull.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index e018985469..04970cf503 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -314,7 +314,7 @@ to display." (removed (let ((count (length removed))) (format (current-error-port) - (N_ " ~*One channel removed:~%" + (N_ " ~a channel removed:~%" " ~a channels removed:~%" count) count) (for-each display-channel removed)))) -- cgit v1.2.3 From f8372932027680a1f2f1b41ea8e19c12bb7d7070 Mon Sep 17 00:00:00 2001 From: Martin Becze Date: Tue, 1 Oct 2019 16:54:56 -0400 Subject: import: crate: Support recursive imports. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/import/crate.scm (crate-recursive-import): New procedure. (crate->guix-package): Return dependencies as a second value. Signed-off-by: Ludovic Courtès --- guix/import/crate.scm | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'guix') diff --git a/guix/import/crate.scm b/guix/import/crate.scm index fd1974eae8..8dc014d232 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -40,6 +40,7 @@ #:use-module (srfi srfi-26) #:export (crate->guix-package guix-package->crate-name + crate-recursive-import %crate-updater)) @@ -218,16 +219,24 @@ latest version of CRATE-NAME." (cargo-development-inputs (sort (map crate-dependency-id dev-dep-crates) string-ci (crate-version-license version*) - string->license))))) + (values + (make-crate-sexp #:name crate-name + #:version (crate-version-number version*) + #:cargo-inputs cargo-inputs + #:cargo-development-inputs cargo-development-inputs + #:home-page (or (crate-home-page crate) + (crate-repository crate)) + #:synopsis (crate-description crate) + #:description (crate-description crate) + #:license (and=> (crate-version-license version*) + string->license)) + (append cargo-inputs cargo-development-inputs))))) + +(define (crate-recursive-import crate-name) + (recursive-import crate-name #f + #:repo->guix-package (lambda (name repo) + (crate->guix-package name)) + #:guix-name crate-name->package-name)) (define (guix-package->crate-name package) "Return the crate name of PACKAGE." -- cgit v1.2.3 From ed661e38d8ce3c4efa5c495b2c34ba86e1e43290 Mon Sep 17 00:00:00 2001 From: Martin Becze Date: Tue, 1 Oct 2019 16:54:57 -0400 Subject: import: crate: Add '--recursive'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/scripts/import/crate.scm (show-help, guix-import-crate): Add '--recursive'. * doc/guix.texi (Invoking guix import): Mention '--recursive'. Co-authored-by: Ludovic Courtès --- guix/scripts/import/crate.scm | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'guix') diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm index 7ae8638911..4690cceb4d 100644 --- a/guix/scripts/import/crate.scm +++ b/guix/scripts/import/crate.scm @@ -28,6 +28,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-37) + #:use-module (srfi srfi-41) #:use-module (ice-9 match) #:use-module (ice-9 format) #:export (guix-import-crate)) @@ -43,6 +44,9 @@ (define (show-help) (display (G_ "Usage: guix import crate PACKAGE-NAME Import and convert the crate.io package for PACKAGE-NAME.\n")) + (display (G_ " + -r, --recursive import packages recursively")) + (newline) (display (G_ " -h, --help display this help and exit")) (display (G_ " @@ -59,6 +63,9 @@ Import and convert the crate.io package for PACKAGE-NAME.\n")) (option '(#\V "version") #f #f (lambda args (show-version-and-exit "guix import crate"))) + (option '(#\r "recursive") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive #t result))) %standard-import-options)) @@ -79,22 +86,31 @@ Import and convert the crate.io package for PACKAGE-NAME.\n")) (let* ((opts (parse-options)) (args (filter-map (match-lambda - (('argument . value) - value) - (_ #f)) + (('argument . value) + value) + (_ #f)) (reverse opts)))) (match args ((spec) (define-values (name version) (package-name->name+version spec)) - (let ((sexp (crate->guix-package name version))) - (unless sexp - (leave (G_ "failed to download meta-data for package '~a'~%") - (if version - (string-append name "@" version) - name))) - sexp)) + (if (assoc-ref opts 'recursive) + (map (match-lambda + ((and ('package ('name name) . rest) pkg) + `(define-public ,(string->symbol name) + ,pkg)) + (_ #f)) + (reverse + (stream->list + (crate-recursive-import name)))) + (let ((sexp (crate->guix-package name version))) + (unless sexp + (leave (G_ "failed to download meta-data for package '~a'~%") + (if version + (string-append name "@" version) + name))) + sexp))) (() (leave (G_ "too few arguments~%"))) ((many ...) -- cgit v1.2.3 From 5a02f8e3842c19d28f39e5b47d804ef70e1b3160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 3 Oct 2019 22:19:11 +0200 Subject: environment: '--container' honors '--preserve'. * guix/scripts/environment.scm (launch-environment/container): Add #:white-list parameter and honor it. (guix-environment): Pass #:white-list to 'launch-environment/container'. * tests/guix-environment-container.sh: Add test. --- guix/scripts/environment.scm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 535f181bfd..4a51654ce6 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -452,7 +452,7 @@ regexps in WHITE-LIST." (define* (launch-environment/container #:key command bash user user-mappings profile manifest link-profile? network? - map-cwd?) + map-cwd? (white-list '())) "Run COMMAND within a container that features the software in PROFILE. Environment variables are set according to the search paths of MANIFEST. The global shell is BASH, a file name for a GNU Bash binary in the @@ -461,7 +461,10 @@ USER-MAPPINGS, a list of file system mappings, contains the user-specified host file systems to mount inside the container. If USER is not #f, each target of USER-MAPPINGS will be re-written relative to '/home/USER', and USER will be used for the passwd entry. LINK-PROFILE? creates a symbolic link from -~/.guix-profile to the environment profile." +~/.guix-profile to the environment profile. + +Preserve environment variables whose name matches the one of the regexps in +WHILE-LIST." (define (optional-mapping->fs mapping) (and (file-exists? (file-system-mapping-source mapping)) (file-system-mapping->bind-mount mapping))) @@ -487,6 +490,11 @@ will be used for the passwd entry. LINK-PROFILE? creates a symbolic link from (group-entry (gid 65534) ;the overflow GID (name "overflow")))) (home-dir (password-entry-directory passwd)) + (environ (filter (match-lambda + ((variable . value) + (find (cut regexp-exec <> variable) + white-list))) + (get-environment-variables))) ;; Bind-mount all requisite store items, user-specified mappings, ;; /bin/sh, the current working directory, and possibly networking ;; configuration files within the container. @@ -555,6 +563,12 @@ will be used for the passwd entry. LINK-PROFILE? creates a symbolic link from (override-user-dir user home cwd) home-dir)) + ;; Set environment variables that match WHITE-LIST. + (for-each (match-lambda + ((variable . value) + (setenv variable value))) + environ) + (primitive-exit/status ;; A container's environment is already purified, so no need to ;; request it be purified again. @@ -759,6 +773,7 @@ message if any test fails." #:user-mappings mappings #:profile profile #:manifest manifest + #:white-list white-list #:link-profile? link-prof? #:network? network? #:map-cwd? (not no-cwd?)))) -- cgit v1.2.3 From cdf9811d24b9c857cb79e0ddd38181862ec34bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 3 Oct 2019 22:54:28 +0200 Subject: gexp: 'load-path-expression' produces an expression that deletes duplicates. Fixes . "herd eval root '(length %load-path)'" on a freshly-booted bare-bones system now returns 8 instead of 119 before. * guix/gexp.scm (load-path-expression): Rewrite expression to that it deletes duplicates. --- guix/gexp.scm | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'guix') diff --git a/guix/gexp.scm b/guix/gexp.scm index e788fc5981..26881ce16c 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -1527,24 +1527,37 @@ are searched for in PATH. Return #f when MODULES and EXTENSIONS are empty." #:module-path path #:system system #:target target))) - (return (gexp (eval-when (expand load eval) - (set! %load-path - (cons (ungexp modules) - (append (map (lambda (extension) - (string-append extension - "/share/guile/site/" - (effective-version))) - '((ungexp-native-splicing extensions))) - %load-path))) - (set! %load-compiled-path - (cons (ungexp compiled) - (append (map (lambda (extension) - (string-append extension - "/lib/guile/" - (effective-version) - "/site-ccache")) - '((ungexp-native-splicing extensions))) - %load-compiled-path))))))))) + (return + (gexp (eval-when (expand load eval) + ;; Augment the load paths and delete duplicates. Do that + ;; without loading (srfi srfi-1) or anything. + (let ((extensions '((ungexp-native-splicing extensions))) + (prepend (lambda (items lst) + ;; This is O(N²) but N is typically small. + (let loop ((items items) + (lst lst)) + (if (null? items) + lst + (loop (cdr items) + (cons (car items) + (delete (car items) lst)))))))) + (set! %load-path + (prepend (cons (ungexp modules) + (map (lambda (extension) + (string-append extension + "/share/guile/site/" + (effective-version))) + extensions)) + %load-path)) + (set! %load-compiled-path + (prepend (cons (ungexp compiled) + (map (lambda (extension) + (string-append extension + "/lib/guile/" + (effective-version) + "/site-ccache")) + extensions)) + %load-compiled-path))))))))) (define* (gexp->script name exp #:key (guile (default-guile)) -- cgit v1.2.3