[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/12: profiles: 'packages->manifest' now accepts inferior packages.
From: |
Ludovic Courtès |
Subject: |
09/12: profiles: 'packages->manifest' now accepts inferior packages. |
Date: |
Fri, 21 Sep 2018 11:04:55 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 811b21fb15d36b06fde994ca7ef5916a9a19f250
Author: Ludovic Courtès <address@hidden>
Date: Tue Sep 18 10:21:28 2018 +0200
profiles: 'packages->manifest' now accepts inferior packages.
* guix/profiles.scm (packages->manifest)[inferiors-loaded?]: New
variable.
[inferior->entry]: New procedure.
Accept inferior packages when INFERIORS-LOADED? is true.
* tests/guix-package.sh: Add test using a manifest with an inferior.
* tests/inferior.scm ("packages->manifest"): New test.
---
guix/profiles.scm | 27 +++++++++++++++++++++++----
tests/guix-package.sh | 15 +++++++++++++++
tests/inferior.scm | 11 +++++++++++
3 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 8acfcff..669ebe0 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -314,12 +314,31 @@ file name."
"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
denoting a specific output of a package."
+ (define inferiors-loaded?
+ ;; This hack allows us to provide seamless integration for inferior
+ ;; packages while not having a hard dependency on (guix inferior).
+ (resolve-module '(guix inferior) #f #f #:ensure #f))
+
+ (define (inferior->entry)
+ (module-ref (resolve-interface '(guix inferior))
+ 'inferior-package->manifest-entry))
+
(manifest
(map (match-lambda
- ((package output)
- (package->manifest-entry package output))
- ((? package? package)
- (package->manifest-entry package)))
+ ((package output)
+ (package->manifest-entry package output))
+ ((? package? package)
+ (package->manifest-entry package))
+ ((thing output)
+ (if inferiors-loaded?
+ ((inferior->entry) thing output)
+ (throw 'wrong-type-arg 'packages->manifest
+ "Wrong package object: ~S" (list thing) (list thing))))
+ (thing
+ (if inferiors-loaded?
+ ((inferior->entry) thing)
+ (throw 'wrong-type-arg 'packages->manifest
+ "Wrong package object: ~S" (list thing) (list thing)))))
packages)))
(define (manifest->gexp manifest)
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index cef3b34..f7dfbfa 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -358,6 +358,21 @@ EOF
guix package --bootstrap -m "$module_dir/manifest.scm"
guix package -I | grep guile
test `guix package -I | wc -l` -eq 1
+guix package --rollback --bootstrap
+
+# Applying a manifest file with inferior packages.
+cat > "$module_dir/manifest.scm"<<EOF
+(use-modules (guix inferior))
+
+(define i
+ (open-inferior "$abs_top_srcdir" #:command "scripts/guix"))
+
+(let ((guile (car (lookup-inferior-packages i "guile-bootstrap"))))
+ (packages->manifest (list guile)))
+EOF
+guix package --bootstrap -m "$module_dir/manifest.scm"
+guix package -I | grep guile
+test `guix package -I | wc -l` -eq 1
# Error reporting.
cat > "$module_dir/manifest.scm"<<EOF
diff --git a/tests/inferior.scm b/tests/inferior.scm
index 6f6abd2..d1d5c00 100644
--- a/tests/inferior.scm
+++ b/tests/inferior.scm
@@ -182,4 +182,15 @@
(close-inferior inferior)
(manifest-entry->list entry)))
+(test-equal "packages->manifest"
+ (map manifest-entry->list
+ (manifest-entries (packages->manifest
+ (find-best-packages-by-name "guile" #f))))
+ (let* ((inferior (open-inferior %top-builddir
+ #:command "scripts/guix"))
+ (guile (first (lookup-inferior-packages inferior "guile")))
+ (manifest (packages->manifest (list guile))))
+ (close-inferior inferior)
+ (map manifest-entry->list (manifest-entries manifest))))
+
(test-end "inferior")
- branch master updated (10e066f -> 92a9f14), Ludovic Courtès, 2018/09/21
- 02/12: gnu: hdf5-parallel-openmpi: Really enable parallel build., Ludovic Courtès, 2018/09/21
- 03/12: gnu: Add r-pore., Ludovic Courtès, 2018/09/21
- 08/12: inferior: Add 'inferior-package->manifest-entry'., Ludovic Courtès, 2018/09/21
- 01/12: gnu: hdf5: Allow for absence of utility script., Ludovic Courtès, 2018/09/21
- 09/12: profiles: 'packages->manifest' now accepts inferior packages.,
Ludovic Courtès <=
- 06/12: inferior: Add 'inferior-package-inputs' & co., Ludovic Courtès, 2018/09/21
- 07/12: inferior: Add 'inferior-package-search-paths' & co., Ludovic Courtès, 2018/09/21
- 10/12: channels: Add 'channel-instances->derivation'., Ludovic Courtès, 2018/09/21
- 05/12: inferior: Add 'lookup-inferior-packages'., Ludovic Courtès, 2018/09/21
- 11/12: inferior: Add 'inferior-for-channels'., Ludovic Courtès, 2018/09/21
- 04/12: inferior: Add 'inferior-package-derivation'., Ludovic Courtès, 2018/09/21
- 12/12: doc: Add section about inferiors., Ludovic Courtès, 2018/09/21