diff options
author | David Thompson <dthompson2@worcester.edu> | 2018-02-15 20:54:28 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2018-02-21 22:16:38 -0500 |
commit | 267379f852f9d6d00c76120963711d54357ba53d (patch) | |
tree | d50040e19049c99d9d0c799183384cb3ec4abc3a /guix | |
parent | ea6b1baec7515ec941f35c186ab314ec1c844250 (diff) | |
download | gnu-guix-267379f852f9d6d00c76120963711d54357ba53d.tar gnu-guix-267379f852f9d6d00c76120963711d54357ba53d.tar.gz |
environment: Add --manifest option.
* guix/scripts/environment.scm (show-help, %options): Add -m/--manifest.
(options/resolve-packages): Handle manifests.
* tests/guix-envronment.sh: Add a test.
* doc/guix.texi (Invoking guix environment): Document it.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/scripts/environment.scm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index d2568e6a7d..67da6fc3bf 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org> +;;; Copyright © 2014, 2015, 2018 David Thompson <davet@gnu.org> ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. @@ -142,6 +142,8 @@ COMMAND or an interactive shell in that environment.\n")) -l, --load=FILE create environment for the package that the code within FILE evaluates to")) (display (G_ " + -m, --manifest=FILE create environment with the manifest from FILE")) + (display (G_ " --ad-hoc include all specified packages in the environment instead of only their inputs")) (display (G_ " @@ -220,6 +222,11 @@ COMMAND or an interactive shell in that environment.\n")) (alist-cons 'expression (tag-package-arg result arg) result))) + (option '(#\m "manifest") #t #f + (lambda (opt name arg result) + (alist-cons 'manifest + arg + result))) (option '("ad-hoc") #f #f (lambda (opt name arg result) (alist-cons 'ad-hoc? #t result))) @@ -286,6 +293,16 @@ packages." (((? package-or-package+output?) ...) ; many packages (map (cut package->output <> mode) packages)))) + (define (manifest->outputs manifest) + (map (lambda (entry) + (cons 'ad-hoc-package ; manifests are implicitly ad-hoc + (if (package? (manifest-entry-item entry)) + (list (manifest-entry-item entry) + (manifest-entry-output entry)) + ;; Direct store paths have no output. + (list (manifest-entry-item entry))))) + (manifest-entries manifest))) + (compact (append-map (match-lambda (('package mode (? string? spec)) @@ -299,6 +316,9 @@ packages." ;; Add all the outputs of the package defined in FILE. (let ((module (make-user-module '()))) (packages->outputs (load* file module) mode))) + (('manifest . file) + (let ((module (make-user-module '()))) + (manifest->outputs (load* file module)))) (_ '(#f))) opts))) |