profiles: Add 'package->development-manifest'.
* guix/profiles.scm (package->development-manifest): New procedure. * guix/scripts/environment.scm (input->manifest-entry) (package-environment-inputs): Remove. * guix/scripts/environment.scm (options/resolve-packages): Use 'package->development-manifest' instead of 'package-environment-inputs'. * tests/profiles.scm ("package->development-manifest"): New test.master
parent
fb368f4e76
commit
23f99f1a29
|
@ -3341,6 +3341,17 @@ objects, like this:
|
||||||
'("emacs" "guile@@2.2" "guile@@2.2:debug"))
|
'("emacs" "guile@@2.2" "guile@@2.2:debug"))
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
@findex package->development-manifest
|
||||||
|
You might also want to create a manifest for all the dependencies of a
|
||||||
|
package, rather than the package itself:
|
||||||
|
|
||||||
|
@lisp
|
||||||
|
(package->development-manifest (specification->package "emacs"))
|
||||||
|
@end lisp
|
||||||
|
|
||||||
|
The example above gives you all the software required to develop Emacs,
|
||||||
|
similar to what @command{guix environment emacs} provides.
|
||||||
|
|
||||||
@xref{export-manifest, @option{--export-manifest}}, to learn how to
|
@xref{export-manifest, @option{--export-manifest}}, to learn how to
|
||||||
obtain a manifest file from an existing profile.
|
obtain a manifest file from an existing profile.
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,7 @@
|
||||||
|
|
||||||
profile-manifest
|
profile-manifest
|
||||||
package->manifest-entry
|
package->manifest-entry
|
||||||
|
package->development-manifest
|
||||||
packages->manifest
|
packages->manifest
|
||||||
ca-certificate-bundle
|
ca-certificate-bundle
|
||||||
%default-profile-hooks
|
%default-profile-hooks
|
||||||
|
@ -400,6 +401,24 @@ file name."
|
||||||
(properties properties))))
|
(properties properties))))
|
||||||
entry))
|
entry))
|
||||||
|
|
||||||
|
(define* (package->development-manifest package
|
||||||
|
#:optional
|
||||||
|
(system (%current-system))
|
||||||
|
#:key target)
|
||||||
|
"Return a manifest for the \"development inputs\" of PACKAGE for SYSTEM,
|
||||||
|
optionally when cross-compiling to TARGET. Development inputs include both
|
||||||
|
explicit and implicit inputs of PACKAGE."
|
||||||
|
(manifest
|
||||||
|
(filter-map (match-lambda
|
||||||
|
((label (? package? package))
|
||||||
|
(package->manifest-entry package))
|
||||||
|
((label (? package? package) output)
|
||||||
|
(package->manifest-entry package output))
|
||||||
|
;; TODO: Support <inferior-package>.
|
||||||
|
(_
|
||||||
|
#f))
|
||||||
|
(package-development-inputs package system #:target target))))
|
||||||
|
|
||||||
(define (packages->manifest packages)
|
(define (packages->manifest packages)
|
||||||
"Return a list of manifest entries, one for each item listed in PACKAGES.
|
"Return a list of manifest entries, one for each item listed in PACKAGES.
|
||||||
Elements of PACKAGES can be either package objects or package/string tuples
|
Elements of PACKAGES can be either package objects or package/string tuples
|
||||||
|
|
|
@ -66,24 +66,6 @@ do not augment existing environment variables with additional search paths."
|
||||||
(newline)))
|
(newline)))
|
||||||
(profile-search-paths profile manifest)))
|
(profile-search-paths profile manifest)))
|
||||||
|
|
||||||
(define (input->manifest-entry input)
|
|
||||||
"Return a manifest entry for INPUT, or #f if INPUT does not correspond to a
|
|
||||||
package."
|
|
||||||
(match input
|
|
||||||
((_ (? package? package))
|
|
||||||
(package->manifest-entry package))
|
|
||||||
((_ (? package? package) output)
|
|
||||||
(package->manifest-entry package output))
|
|
||||||
(_
|
|
||||||
#f)))
|
|
||||||
|
|
||||||
(define (package-environment-inputs package)
|
|
||||||
"Return a list of manifest entries corresponding to the transitive input
|
|
||||||
packages for PACKAGE."
|
|
||||||
;; Remove non-package inputs such as origin records.
|
|
||||||
(filter-map input->manifest-entry
|
|
||||||
(package-development-inputs package)))
|
|
||||||
|
|
||||||
(define (show-help)
|
(define (show-help)
|
||||||
(display (G_ "Usage: guix environment [OPTION]... PACKAGE... [-- COMMAND...]
|
(display (G_ "Usage: guix environment [OPTION]... PACKAGE... [-- COMMAND...]
|
||||||
Build an environment that includes the dependencies of PACKAGE and execute
|
Build an environment that includes the dependencies of PACKAGE and execute
|
||||||
|
@ -297,11 +279,11 @@ for the corresponding packages."
|
||||||
((? package? package)
|
((? package? package)
|
||||||
(if (eq? mode 'ad-hoc-package)
|
(if (eq? mode 'ad-hoc-package)
|
||||||
(list (package->manifest-entry* package))
|
(list (package->manifest-entry* package))
|
||||||
(package-environment-inputs package)))
|
(manifest-entries (package->development-manifest package))))
|
||||||
(((? package? package) (? string? output))
|
(((? package? package) (? string? output))
|
||||||
(if (eq? mode 'ad-hoc-package)
|
(if (eq? mode 'ad-hoc-package)
|
||||||
(list (package->manifest-entry* package output))
|
(list (package->manifest-entry* package output))
|
||||||
(package-environment-inputs package)))
|
(manifest-entries (package->development-manifest package))))
|
||||||
((lst ...)
|
((lst ...)
|
||||||
(append-map (cut packages->outputs <> mode) lst))))
|
(append-map (cut packages->outputs <> mode) lst))))
|
||||||
|
|
||||||
|
@ -313,8 +295,9 @@ for the corresponding packages."
|
||||||
(specification->package+output spec)))
|
(specification->package+output spec)))
|
||||||
(list (package->manifest-entry* package output))))
|
(list (package->manifest-entry* package output))))
|
||||||
(('package 'package (? string? spec))
|
(('package 'package (? string? spec))
|
||||||
(package-environment-inputs
|
(manifest-entries
|
||||||
(transform (specification->package+output spec))))
|
(package->development-manifest
|
||||||
|
(transform (specification->package+output spec)))))
|
||||||
(('expression mode str)
|
(('expression mode str)
|
||||||
;; Add all the outputs of the package STR evaluates to.
|
;; Add all the outputs of the package STR evaluates to.
|
||||||
(packages->outputs (read/eval str) mode))
|
(packages->outputs (read/eval str) mode))
|
||||||
|
|
|
@ -265,6 +265,13 @@
|
||||||
(manifest-transaction-removal-candidate? guile-2.0.9 t)
|
(manifest-transaction-removal-candidate? guile-2.0.9 t)
|
||||||
(null? install) (null? downgrade) (null? upgrade)))))
|
(null? install) (null? downgrade) (null? upgrade)))))
|
||||||
|
|
||||||
|
(test-assert "package->development-manifest"
|
||||||
|
(let ((manifest (package->development-manifest packages:hello)))
|
||||||
|
(every (lambda (name)
|
||||||
|
(manifest-installed? manifest
|
||||||
|
(manifest-pattern (name name))))
|
||||||
|
'("gcc" "binutils" "glibc" "coreutils" "grep" "sed"))))
|
||||||
|
|
||||||
(test-assertm "profile-derivation"
|
(test-assertm "profile-derivation"
|
||||||
(mlet* %store-monad
|
(mlet* %store-monad
|
||||||
((entry -> (package->manifest-entry %bootstrap-guile))
|
((entry -> (package->manifest-entry %bootstrap-guile))
|
||||||
|
|
Reference in New Issue