summary refs log tree commit diff
path: root/gnu/packages.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-04-16 18:15:28 +0200
committerMarius Bakke <mbakke@fastmail.com>2018-04-16 18:15:28 +0200
commit5d904d63f4d43e3f0e4be38c5f5404e029c00a22 (patch)
treeb2893eceae99c967e0f49cdbfe084f6c7d4767c4 /gnu/packages.scm
parentbab5f3a7f62150ae009e78d03c4b1f5b1646104c (diff)
parentd0ee11b2f000c3c027fd8370bc2195266398444f (diff)
downloadguix-5d904d63f4d43e3f0e4be38c5f5404e029c00a22.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'gnu/packages.scm')
-rw-r--r--gnu/packages.scm27
1 files changed, 23 insertions, 4 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 97e6cb347f..1a37a17342 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016, 2017 Alex Kost <alezost@gmail.com>
@@ -110,8 +110,25 @@ for system '~a'")
                         file-name system)))))))
 
 (define %distro-root-directory
-  ;; Absolute file name of the module hierarchy.
-  (dirname (search-path %load-path "guix.scm")))
+  ;; Absolute file name of the module hierarchy.  Since (gnu packages …) might
+  ;; live in a directory different from (guix), try to get the best match.
+  (letrec-syntax ((dirname* (syntax-rules ()
+                              ((_ file)
+                               (dirname file))
+                              ((_ file head tail ...)
+                               (dirname (dirname* file tail ...)))))
+                  (try      (syntax-rules ()
+                              ((_ (file things ...) rest ...)
+                               (match (search-path %load-path file)
+                                 (#f
+                                  (try rest ...))
+                                 (absolute
+                                  (dirname* absolute things ...))))
+                              ((_)
+                               #f))))
+    (try ("gnu/packages/base.scm" gnu/ packages/)
+         ("gnu/packages.scm"      gnu/)
+         ("guix.scm"))))
 
 (define %package-module-path
   ;; Search path for package modules.  Each item must be either a directory
@@ -142,7 +159,9 @@ for system '~a'")
 
 (define* (fold-packages proc init
                         #:optional
-                        (modules (all-modules (%package-module-path)))
+                        (modules (all-modules (%package-module-path)
+                                              #:warn
+                                              warn-about-load-error))
                         #:key (select? (negate hidden-package?)))
   "Call (PROC PACKAGE RESULT) for each available package defined in one of
 MODULES that matches SELECT?, using INIT as the initial value of RESULT.  It