Re: [PATCH 5/6] guix: Move package-transitive-propagated-labels* and package-propagated-input-refs to (guix packages).

2015-09-10 Thread Eric Bavier
On Wed, 09 Sep 2015 22:24:11 +0200
l...@gnu.org (Ludovic Courtès) wrote:

> Eric Bavier  skribis:
> 
> > For Perl, my idea is to wrap each module somehow, so that perl gets the
> > appropriate 'use lib "/gnu/store/..."' when it loads each module.
> > Preferably the solution would also work with store deduplication.
> > I've not yet confirmed this is even feasible, so anyone with more perl
> > knowledge should chime in.
> >
> > Our haskell modules install files into a "package.conf.d" subdirectory,
> > and these files actually keep references to all haskell modules that
> > were configured in the environment when it was built.  I'm baffled why
> > GHC does not make use of this information for dependency resolution when
> > it loads libraries.  Perhaps we could hack our GHC to do so.
> 
> This sounds like retrofitting some RUNPATH-like functionality in
> languages.  This would be ideal, and we should use whatever already
> exists if that does the job (which seems to be the case for Perl?).

It exists for Perl to some degree, but 'use lib "/..."' rather than
simple 'use lib' needs to be explicitely used by the module author,
which is rarely done in practice. 

> 
> Otherwise we should really push upstream to implement that
> functionality.
> 
> > From c7932475b95f22f891169b7f315366e2602fb4f5 Mon Sep 17 00:00:00 2001
> > From: Eric Bavier 
> > Date: Tue, 21 Jul 2015 20:45:54 -0500
> > Subject: [PATCH 5/6] guix: packages: Add transitive-input-references.
> >
> > * guix/packages.scm (transitive-input-references): New procedure.
> > * gnu/packages/version-control.scm (package-transitive-propagated-labels*)
> >   (package-propagated-input-refs): Delete.
> >   (git)[arguments]: Adjust to transitive-input-references.
> 
> It addresses previous comments and looks reasonable to me.
> 
> OK for ‘master’!

Pushed.  Thanks!

`~Eric




Re: [PATCH 5/6] guix: Move package-transitive-propagated-labels* and package-propagated-input-refs to (guix packages).

2015-09-09 Thread Ludovic Courtès
Eric Bavier  skribis:

> I find myself needing this functionality while exploring configuration
> support in xmonad, so I am (finally) revisiting this patch.

Nice!

> For Perl, my idea is to wrap each module somehow, so that perl gets the
> appropriate 'use lib "/gnu/store/..."' when it loads each module.
> Preferably the solution would also work with store deduplication.
> I've not yet confirmed this is even feasible, so anyone with more perl
> knowledge should chime in.
>
> Our haskell modules install files into a "package.conf.d" subdirectory,
> and these files actually keep references to all haskell modules that
> were configured in the environment when it was built.  I'm baffled why
> GHC does not make use of this information for dependency resolution when
> it loads libraries.  Perhaps we could hack our GHC to do so.

This sounds like retrofitting some RUNPATH-like functionality in
languages.  This would be ideal, and we should use whatever already
exists if that does the job (which seems to be the case for Perl?).

Otherwise we should really push upstream to implement that
functionality.

> From c7932475b95f22f891169b7f315366e2602fb4f5 Mon Sep 17 00:00:00 2001
> From: Eric Bavier 
> Date: Tue, 21 Jul 2015 20:45:54 -0500
> Subject: [PATCH 5/6] guix: packages: Add transitive-input-references.
>
> * guix/packages.scm (transitive-input-references): New procedure.
> * gnu/packages/version-control.scm (package-transitive-propagated-labels*)
>   (package-propagated-input-refs): Delete.
>   (git)[arguments]: Adjust to transitive-input-references.

It addresses previous comments and looks reasonable to me.

OK for ‘master’!

Thank you,
Ludo’.



Re: [PATCH 5/6] guix: Move package-transitive-propagated-labels* and package-propagated-input-refs to (guix packages).

2015-09-08 Thread Eric Bavier
I find myself needing this functionality while exploring configuration
support in xmonad, so I am (finally) revisiting this patch.

The attached patch, rather than simply moving the two relevant
procedures from (gnu packages version-control), instead replaces them
with a single new procedure, named 'transitive-input-references', in
(guix packages). I think the new procedure addresses the concerns raised
previously.

On Wed, 22 Jul 2015 15:20:11 +0200
l...@gnu.org (Ludovic Courtès) wrote:

> Eric Bavier <ericbav...@openmailbox.org> skribis:
> 
> > From 6282f668d3cadb9f24f045a0c6992eda9fbe6d5d Mon Sep 17 00:00:00 2001
> > From: Eric Bavier <bav...@member.fsf.org>
> > Date: Tue, 21 Jul 2015 20:45:54 -0500
> > Subject: [PATCH 5/6] guix: Move package-transitive-propagated-labels* and
> >  package-propagated-input-refs to (guix packages).
> >
> > * gnu/packages/version-control.scm (package-transitive-propagated-labels*)
> >   (package-propagated-input-refs): Move from here...
> > * guix/packages.scm: ...to here.
> 
[...]
> 
> > +(define (package-propagated-input-refs inputs packages)
> 
> Should be “references”, not “refs.”

Sure.

> 
> > +  "Return a list of (assoc-ref INPUTS ) for each package in
> > +PACKAGES and their transitive propagated inputs."
> 
> Maybe mention that this assumes that each input uses the package name as
> the label.

This is not the case with the new transitive-input-references.  Labels
may be arbitrary strings.  This behavior is checked in the new test
case.

> 
> > +  (map (lambda (l)
> > + `(assoc-ref ,inputs ,l))
> > +   (delete-duplicates   ;XXX: efficiency
> > +(append-map package-transitive-propagated-labels*
> > +packages
> 
> The quadratic ‘delete-duplicates’ is going to be a problem sooner or
> later.

The new procedure makes use of 'transitive-inputs' and so benefits from
its optimizations.
 
> Also, could you add one or two tests?

Done.

> 
> I understand this is needed in some cases, but it is not really nice (or
> “really not nice”?).

I would go with "really not nice"

> I would rather avoid propagating the use of these
> constructs,

No pun intended? ;)

> but OTOH, I have nothing better to propose currently.

For Perl, my idea is to wrap each module somehow, so that perl gets the
appropriate 'use lib "/gnu/store/..."' when it loads each module.
Preferably the solution would also work with store deduplication.
I've not yet confirmed this is even feasible, so anyone with more perl
knowledge should chime in.

Our haskell modules install files into a "package.conf.d" subdirectory,
and these files actually keep references to all haskell modules that
were configured in the environment when it was built.  I'm baffled why
GHC does not make use of this information for dependency resolution when
it loads libraries.  Perhaps we could hack our GHC to do so.

`~Eric


From c7932475b95f22f891169b7f315366e2602fb4f5 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bav...@member.fsf.org>
Date: Tue, 21 Jul 2015 20:45:54 -0500
Subject: [PATCH 5/6] guix: packages: Add transitive-input-references.

* guix/packages.scm (transitive-input-references): New procedure.
* gnu/packages/version-control.scm (package-transitive-propagated-labels*)
  (package-propagated-input-refs): Delete.
  (git)[arguments]: Adjust to transitive-input-references.
---
 gnu/packages/version-control.scm | 28 ++--
 guix/packages.scm| 14 ++
 tests/packages.scm   | 17 +
 3 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 8d8003f..3c0571b 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -98,24 +98,6 @@ changes to project files over time.  It supports both a 
distributed workflow
 as well as the classic centralized workflow.")
 (license gpl2+)))
 
-(define (package-transitive-propagated-labels* package)
-  "Return a list of the input labels of PACKAGE and its transitive inputs."
-  (let ((name (package-name package)))
-`(,name
-  ,@(map (match-lambda
-   ((label (? package? _) . _)
-label))
- (package-transitive-propagated-inputs package)
-
-(define (package-propagated-input-refs inputs packages)
-  "Return a list of (assoc-ref INPUTS ) for each package in
-PACKAGES and their propagated inputs."
-  (map (lambda (l)
- `(assoc-ref ,inputs ,l))
-   (delete-duplicates  ;XXX: efficiency
-(append-map package-transitive-propagated-labels*
-packages
-
 (define-public git
   ;; Keep in s

Re: [PATCH 5/6] guix: Move package-transitive-propagated-labels* and package-propagated-input-refs to (guix packages).

2015-07-22 Thread Eric Bavier
Attached is an updated patch based on current master after core-updates
merge.

`~EricFrom 6282f668d3cadb9f24f045a0c6992eda9fbe6d5d Mon Sep 17 00:00:00 2001
From: Eric Bavier bavier@member.fsf.org
Date: Tue, 21 Jul 2015 20:45:54 -0500
Subject: [PATCH 5/6] guix: Move package-transitive-propagated-labels* and
 package-propagated-input-refs to (guix packages).

* gnu/packages/version-control.scm (package-transitive-propagated-labels*)
  (package-propagated-input-refs): Move from here...
* guix/packages.scm: ...to here.
---
 gnu/packages/version-control.scm | 18 --
 guix/packages.scm| 21 +
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index c3f501b..6fc1be8 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -98,24 +98,6 @@ changes to project files over time.  It supports both a distributed workflow
 as well as the classic centralized workflow.)
 (license gpl2+)))
 
-(define (package-transitive-propagated-labels* package)
-  Return a list of the input labels of PACKAGE and its transitive inputs.
-  (let ((name (package-name package)))
-`(,name
-  ,@(map (match-lambda
-   ((label (? package? _) . _)
-label))
- (package-transitive-propagated-inputs package)
-
-(define (package-propagated-input-refs inputs packages)
-  Return a list of (assoc-ref INPUTS package-name) for each package in
-PACKAGES and their propagated inputs.
-  (map (lambda (l)
- `(assoc-ref ,inputs ,l))
-   (delete-duplicates  ;XXX: efficiency
-(append-map package-transitive-propagated-labels*
-packages
-
 (define-public git
   ;; Keep in sync with 'git-manpages'!
   (package
diff --git a/guix/packages.scm b/guix/packages.scm
index 3983d14..9150cf4 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -93,6 +93,9 @@
 package-output
 package-grafts
 
+package-transitive-propagated-labels*
+package-propagated-input-refs
+
 %supported-systems
 %hydra-supported-systems
 supported-package?
@@ -579,6 +582,24 @@ for the host system (\native inputs\), and not target inputs.
 recursively.
   (transitive-inputs (package-propagated-inputs package)))
 
+(define (package-transitive-propagated-labels* package)
+  Return a list of the input labels of PACKAGE and its transitive inputs.
+  (let ((name (package-name package)))
+`(,name
+  ,@(map (match-lambda
+   ((label (? package? _) . _)
+label))
+ (package-transitive-propagated-inputs package)
+
+(define (package-propagated-input-refs inputs packages)
+  Return a list of (assoc-ref INPUTS package-name) for each package in
+PACKAGES and their transitive propagated inputs.
+  (map (lambda (l)
+ `(assoc-ref ,inputs ,l))
+   (delete-duplicates   ;XXX: efficiency
+(append-map package-transitive-propagated-labels*
+packages
+
 (define-syntax define-memoized/v
   (lambda (form)
 Define a memoized single-valued unary procedure with docstring.
-- 
2.4.3



Re: [PATCH 5/6] guix: Move package-transitive-propagated-labels* and package-propagated-input-refs to (guix packages).

2015-07-22 Thread Ludovic Courtès
Eric Bavier ericbav...@openmailbox.org skribis:

 From 6282f668d3cadb9f24f045a0c6992eda9fbe6d5d Mon Sep 17 00:00:00 2001
 From: Eric Bavier bav...@member.fsf.org
 Date: Tue, 21 Jul 2015 20:45:54 -0500
 Subject: [PATCH 5/6] guix: Move package-transitive-propagated-labels* and
  package-propagated-input-refs to (guix packages).

 * gnu/packages/version-control.scm (package-transitive-propagated-labels*)
   (package-propagated-input-refs): Move from here...
 * guix/packages.scm: ...to here.

[...]

 +(define (package-transitive-propagated-labels* package)
 +  Return a list of the input labels of PACKAGE and its transitive inputs.

Why is there a star in the name?

 +(define (package-propagated-input-refs inputs packages)

Should be “references”, not “refs.”  I think this one should not be
exported.

 +  Return a list of (assoc-ref INPUTS package-name) for each package in
 +PACKAGES and their transitive propagated inputs.

Maybe mention that this assumes that each input uses the package name as
the label.

 +  (map (lambda (l)
 + `(assoc-ref ,inputs ,l))
 +   (delete-duplicates   ;XXX: efficiency
 +(append-map package-transitive-propagated-labels*
 +packages

The quadratic ‘delete-duplicates’ is going to be a problem sooner or
later.

Also, could you add one or two tests?

I understand this is needed in some cases, but it is not really nice (or
“really not nice”?).  I would rather avoid propagating the use of these
constructs, but OTOH, I have nothing better to propose currently.

Could you send an updated patch?

Thanks,
Ludo’.



[PATCH 5/6] guix: Move package-transitive-propagated-labels* and package-propagated-input-refs to (guix packages).

2015-07-09 Thread ericbavier
From: Eric Bavier bav...@member.fsf.org

* gnu/packages/version-control.scm (package-transitive-propagated-labels*)
  (package-propagated-input-refs): Move from here...
* guix/packages.scm: ...to here.
---
 gnu/packages/version-control.scm | 17 -
 guix/packages.scm| 20 
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 15e6fb6..eee3a2f 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -99,23 +99,6 @@ changes to project files over time.  It supports both a 
distributed workflow
 as well as the classic centralized workflow.)
 (license gpl2+)))
 
-(define (package-transitive-propagated-labels* package)
-  Return a list of the input labels of PACKAGE and its transitive inputs.
-  (let ((name (package-name package)))
-`(,name
-  ,@(map (match-lambda
-   ((label (? package? _) . _)
-(string-append name / label)))
- (package-transitive-propagated-inputs package)
-
-(define (package-propagated-input-refs inputs packages)
-  Return a list of (assoc-ref INPUTS package-name) for each package in
-PACKAGES and their propagated inputs.
-  (map (lambda (l)
- `(assoc-ref ,inputs ,l))
-   (append-map package-transitive-propagated-labels*
-   packages)))
-
 (define-public git
   ;; Keep in sync with 'git-manpages'!
   (package
diff --git a/guix/packages.scm b/guix/packages.scm
index 5a28085..e84d129 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -93,6 +93,9 @@
 package-output
 package-grafts
 
+package-transitive-propagated-labels*
+package-propagated-input-refs
+
 %supported-systems
 %hydra-supported-systems
 supported-package?
@@ -559,6 +562,23 @@ for the host system (\native inputs\), and not target 
inputs.
 recursively.
   (transitive-inputs (package-propagated-inputs package)))
 
+(define (package-transitive-propagated-labels* package)
+  Return a list of the input labels of PACKAGE and its transitive inputs.
+  (let ((name (package-name package)))
+`(,name
+  ,@(map (match-lambda
+   ((label (? package? _) . _)
+(string-append name / label)))
+ (package-transitive-propagated-inputs package)
+
+(define (package-propagated-input-refs inputs packages)
+  Return a list of (assoc-ref INPUTS package-name) for each package in
+PACKAGES and their transitive propagated inputs.
+  (map (lambda (l)
+ `(assoc-ref ,inputs ,l))
+   (append-map package-transitive-propagated-labels*
+   packages)))
+
 (define-syntax define-memoized/v
   (lambda (form)
 Define a memoized single-valued unary procedure with docstring.
-- 
2.4.3