unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22073: Fwd: search-paths and propagated inputs
       [not found] ` <87egf7l3fz.fsf@mdc-berlin.de>
@ 2015-12-02  8:18   ` Federico Beffa
  2015-12-03 18:54     ` Federico Beffa
  2015-12-20 11:37     ` Federico Beffa
  0 siblings, 2 replies; 6+ messages in thread
From: Federico Beffa @ 2015-12-02  8:18 UTC (permalink / raw)
  To: 22073

Federico Beffa <beffa@ieee.org> writes:

> Federico Beffa <beffa@ieee.org> writes:
>
>> Hi,
>>
>> the package 'gobject-introspection' declares a
>> search-path-specification for the variable GI_TYPELIB_PATH and
>> 'matplotlib' uses and propagates said package. I have 'matplotlib' in
>> my profile, but "guix package --search-paths" doesn't show anything
>> about GI_TYPELIB_PATH.
>>
>> Is it intentional or an oversight that search-path-specifications of
>> propagated-inputs are not considered? Or, am I doing something wrong?
>>
>> Regards,
>> Fede
>
> Bug or feature?

I think it’s a bug.  Right now users of matplotlib have to check the
sources where it says that GI_TYPELIB_PATH must be set.

~~ Ricardo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22073: Fwd: search-paths and propagated inputs
  2015-12-02  8:18   ` bug#22073: Fwd: search-paths and propagated inputs Federico Beffa
@ 2015-12-03 18:54     ` Federico Beffa
  2015-12-20 12:56       ` Ludovic Courtès
  2015-12-20 11:37     ` Federico Beffa
  1 sibling, 1 reply; 6+ messages in thread
From: Federico Beffa @ 2015-12-03 18:54 UTC (permalink / raw)
  To: 22073

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22073: Fwd: search-paths and propagated inputs
  2015-12-02  8:18   ` bug#22073: Fwd: search-paths and propagated inputs Federico Beffa
  2015-12-03 18:54     ` Federico Beffa
@ 2015-12-20 11:37     ` Federico Beffa
  1 sibling, 0 replies; 6+ messages in thread
From: Federico Beffa @ 2015-12-20 11:37 UTC (permalink / raw)
  To: 22073

Any feedback on this?

Thanks,
Fede

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22073: Fwd: search-paths and propagated inputs
  2015-12-03 18:54     ` Federico Beffa
@ 2015-12-20 12:56       ` Ludovic Courtès
  2015-12-20 16:52         ` Federico Beffa
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2015-12-20 12:56 UTC (permalink / raw)
  To: Federico Beffa; +Cc: 22073

[-- Attachment #1: Type: text/plain, Size: 2204 bytes --]

Thanks for the heads-up, and sorry for the delay!

Federico Beffa <beffa@ieee.org> skribis:

> 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'.

That’s a bug, indeed.

> 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:

Right.

Here’s a variant of what you propose.  With that, I get:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix package -i python2-matplotlib -p foo

[...]

The following environment variable definitions may be needed:
   export PATH="foo/bin:foo/sbin"
   export PYTHONPATH="foo/lib/python2.7/site-packages"
   export GI_TYPELIB_PATH="foo/lib/girepository-1.0"
   export XDG_DATA_DIRS="foo/share"
   export GIO_EXTRA_MODULES="foo/lib/gio/modules"
--8<---------------cut here---------------end--------------->8---

… which is what we’re expecting, right?

If that’s fine with you, I’ll commit this patch along with test cases.

Thanks!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1771 bytes --]

diff --git a/guix/packages.scm b/guix/packages.scm
index 68fb091..7222337 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -89,6 +89,7 @@
             package-transitive-target-inputs
             package-transitive-native-inputs
             package-transitive-propagated-inputs
+            package-transitive-native-search-paths
             package-transitive-supported-systems
             package-source-derivation
             package-derivation
@@ -632,6 +633,16 @@ for the host system (\"native inputs\"), and not target inputs."
 recursively."
   (transitive-inputs (package-propagated-inputs package)))
 
+(define (package-transitive-native-search-paths package)
+  "Return the list of search paths for PACKAGE and its propagated inputs,
+recursively."
+  (append-map (match-lambda
+                ((label (? package? p) _ ...)
+                 (package-native-search-paths p))
+                (_
+                 '()))
+              (package-transitive-propagated-inputs package)))
+
 (define (transitive-input-references alist inputs)
   "Return a list of (assoc-ref ALIST <label>) for each (<label> <package> . _)
 in INPUTS and their transitive propagated inputs."
diff --git a/guix/profiles.scm b/guix/profiles.scm
index ce6b2c4..ce86ff8 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -176,7 +176,7 @@ omitted or #f, use the first output of PACKAGE."
      (output (or output (car (package-outputs package))))
      (item package)
      (dependencies (delete-duplicates deps))
-     (search-paths (package-native-search-paths package)))))
+     (search-paths (package-transitive-native-search-paths package)))))
 
 (define (packages->manifest packages)
   "Return a list of manifest entries, one for each item listed in PACKAGES.

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#22073: Fwd: search-paths and propagated inputs
  2015-12-20 12:56       ` Ludovic Courtès
@ 2015-12-20 16:52         ` Federico Beffa
  2015-12-20 21:35           ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Federico Beffa @ 2015-12-20 16:52 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 22073

On Sun, Dec 20, 2015 at 1:56 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>> To get all the required search paths recursively we should replace the
>> last 'manifest-entry' slot with a call to a function like this:
>
> Right.
>
> Here’s a variant of what you propose.  With that, I get:
>
> --8<---------------cut here---------------start------------->8---
> $ ./pre-inst-env guix package -i python2-matplotlib -p foo
>
> [...]
>
> The following environment variable definitions may be needed:
>    export PATH="foo/bin:foo/sbin"
>    export PYTHONPATH="foo/lib/python2.7/site-packages"
>    export GI_TYPELIB_PATH="foo/lib/girepository-1.0"
>    export XDG_DATA_DIRS="foo/share"
>    export GIO_EXTRA_MODULES="foo/lib/gio/modules"
> --8<---------------cut here---------------end--------------->8---
>
> … which is what we’re expecting, right?

I think so.

>
> If that’s fine with you, I’ll commit this patch along with test cases.

Sure, thanks for that!

Regards,
Fede

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22073: Fwd: search-paths and propagated inputs
  2015-12-20 16:52         ` Federico Beffa
@ 2015-12-20 21:35           ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2015-12-20 21:35 UTC (permalink / raw)
  To: Federico Beffa; +Cc: 22073-done

Fixed in ccda8f7, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-20 21:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAKrPhPNCyeQYGz77g2-Z3rngXaEcUZVe3gTUXrufJDOLTnR9=A@mail.gmail.com>
     [not found] ` <87egf7l3fz.fsf@mdc-berlin.de>
2015-12-02  8:18   ` bug#22073: Fwd: search-paths and propagated inputs Federico Beffa
2015-12-03 18:54     ` Federico Beffa
2015-12-20 12:56       ` Ludovic Courtès
2015-12-20 16:52         ` Federico Beffa
2015-12-20 21:35           ` Ludovic Courtès
2015-12-20 11:37     ` Federico Beffa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).