Subject: bug#22073: Fwd: search-paths and propagated inputs

From: Federico Beffa <[email-masked]>
Date: Thu, 3 Dec 2015 19:54:16 +0100

Looking at my manifest file I see that, e.g., the entry for
'python-matplotlib' lists all recursively propagated
dependencies. Differently from this the 'search-paths' entry only lists
the entries defined in the package (in this case none), neglecting the
search paths in the 'propagated-inputs'.

If I understand correctly, this behavior is defined by this function (from
guix/profiles.scm):

(define* (package->manifest-entry package #:optional output)
  "Return a manifest entry for the OUTPUT of package PACKAGE.  When OUTPUT is
omitted or #f, use the first output of PACKAGE."
  (let ((deps (map (match-lambda
                    ((label package)
                     (gexp-input package))
                    ((label package output)
                     (gexp-input package output)))
                   (package-transitive-propagated-inputs package))))
    (manifest-entry
     (name (package-name package))
     (version (package-version package))
     (output (or output (car (package-outputs package))))
     (item package)
     (dependencies (delete-duplicates deps))
     (search-paths (package-native-search-paths package)))))

To get all the required search paths recursively we should replace the
last 'manifest-entry' slot with a call to a function like this:

(define (collect-package-search-paths package)
  (define (collect-search-paths package)
    (let ((propagated-inputs (package-propagated-inputs package))
          (search-paths (package-native-search-paths package)))
      (append search-paths
              (append-map
               (match-lambda
                ((name pkg . rest) (collect-search-paths pkg))
                (_ '()))
               propagated-inputs))))
  (delete-duplicates (collect-search-paths package)))

Or, am I missing how this works?

Regards,
Fede