summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-05-18 07:51:56 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-05-20 12:13:04 -0400
commit8404ed5c3e3a36958dc0427531b21ae14b6398aa (patch)
tree2b9d0a18adb1d03748a07409577f56321a82e1c9
parent7ea1432e22b42969ff0d078e68f5cb55a75b1aca (diff)
downloadguix-8404ed5c3e3a36958dc0427531b21ae14b6398aa.tar.gz
profiles: Add 'packages->manifest' procedure.
* guix/profiles.scm (packages->manifest): New procedure.
-rw-r--r--guix/profiles.scm21
1 files changed, 17 insertions, 4 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 11d9bf0cd9..9cb226eda7 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -80,6 +80,7 @@
 
             profile-manifest
             package->manifest-entry
+            packages->manifest
             %default-profile-hooks
             profile-derivation
             generation-number
@@ -172,6 +173,18 @@ omitted or #f, use the first output of PACKAGE."
      (dependencies (delete-duplicates deps))
      (search-paths (package-native-search-paths package)))))
 
+(define (packages->manifest 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
+denoting a specific output of a package."
+  (manifest
+   (map (match-lambda
+         ((package output)
+          (package->manifest-entry package output))
+         (package
+           (package->manifest-entry package)))
+        packages)))
+
 (define (manifest->gexp manifest)
   "Return a representation of MANIFEST as a gexp."
   (define (entry->gexp entry)
@@ -469,7 +482,7 @@ entries of MANIFEST, or #f if MANIFEST does not have any GHC packages."
     (module-ref (resolve-interface '(gnu packages haskell)) 'ghc))
 
   (define build
-    #~(begin 
+    #~(begin
         (use-modules (guix build utils)
                      (srfi srfi-1) (srfi srfi-26)
                      (ice-9 ftw))
@@ -478,20 +491,20 @@ entries of MANIFEST, or #f if MANIFEST does not have any GHC packages."
           (let* ((base (basename #+ghc)))
             (string-drop base
                          (+ 1 (string-index base #\-)))))
-        
+
         (define db-subdir
           (string-append "lib/" ghc-name-version "/package.conf.d"))
 
         (define db-dir
           (string-append #$output "/" db-subdir))
-        
+
         (define (conf-files top)
           (find-files (string-append top "/" db-subdir) "\\.conf$"))
 
         (define (copy-conf-file conf)
           (let ((base (basename conf)))
             (copy-file conf (string-append db-dir "/" base))))
-        
+
         (system* (string-append #+ghc "/bin/ghc-pkg") "init" db-dir)
         (for-each copy-conf-file
                   (append-map conf-files