summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-05-14 22:59:14 +0200
committerLudovic Courtès <ludo@gnu.org>2018-05-14 23:01:36 +0200
commit91e588554919f23b3f2b7307e246303499180bcd (patch)
tree59e22792f040f847a227c1960ce54f5f294a652d
parent5834e4b70aef727d591c271ce3141ed23753377e (diff)
downloadguix-91e588554919f23b3f2b7307e246303499180bcd.tar.gz
pack: Link top-level entries of wrapped packages.
Previously things like:

  guix pack -R guile guile-json

would lead to a profile without Guile-JSON, and to an 'etc/profile' that
does not define 'GUILE_LOAD_PATH'.

* guix/scripts/pack.scm (wrapped-package)[build]: Link top-level entries
of PACKAGE into OUTPUT.
-rw-r--r--guix/scripts/pack.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 6d648d1ac3..1e84459e78 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -378,9 +378,13 @@ please email '~a'~%")
     (local-file (search-auxiliary-file "run-in-namespace.c")))
 
   (define build
-    (with-imported-modules '((guix build utils))
+    (with-imported-modules (source-module-closure
+                            '((guix build utils)
+                              (guix build union)))
       #~(begin
           (use-modules (guix build utils)
+                       ((guix build union) #:select (relative-file-name))
+                       (ice-9 ftw)
                        (ice-9 match))
 
           (define (strip-store-prefix file)
@@ -411,6 +415,17 @@ please email '~a'~%")
           (setvbuf (current-output-port)
                    (cond-expand (guile-2.2 'line)
                                 (else      _IOLBF)))
+
+          ;; Link the top-level files of PACKAGE so that search paths are
+          ;; properly defined in PROFILE/etc/profile.
+          (mkdir #$output)
+          (for-each (lambda (file)
+                      (unless (member file '("." ".." "bin" "sbin" "libexec"))
+                        (let ((file* (string-append #$package "/" file)))
+                          (symlink (relative-file-name #$output file*)
+                                   (string-append #$output "/" file)))))
+                    (scandir #$package))
+
           (for-each build-wrapper
                     (append (find-files #$(file-append package "/bin"))
                             (find-files #$(file-append package "/sbin"))