On Mon, 29 Jun 2015 13:56:51 +0200
l...@gnu.org (Ludovic Courtès) wrote:

> ericbav...@openmailbox.org skribis:
> 
> > From: Eric Bavier <bav...@member.fsf.org>
> >
> > * gnu/packages/version-control.scm (git)[inputs]: Add
> >   perl-authen-sasl, perl-net-smtp-ssl, and perl-io-socket-ssl.
> >   [arguments]: Add #:modules argument with srfi-1.  In 'split phase,
> >   wrap git-send-email.
> 
> [...]
> 
> > +      #:modules ((guix build gnu-build-system)
> > +                 (guix build utils)
> > +                 (srfi srfi-1))
> 
> Use %gnu-build-system-modules instead of listing modules explicitly.
> 
> > +              ;; Tell 'git-send-email' where perl modules are.
> > +              (wrap-program (string-append out
> > "/libexec/git-core/git-send-email")
> 
> It would be best to add a “send-email” output specifically for that,
> so we keep the size of the closure of “out” under control (2 MiB is
> still 10% of the size of “out”.)
> 
> > +                `("PERL5LIB" ":" prefix
> > +                  ,(map (lambda (o) (string-append o
> > "/lib/perl5/site_perl"))
> > +                        (delete-duplicates
> > +                         (list
> > +                          ,@(append-map
> > +                             (lambda (p)
> > +                               (let ((name (package-name p)))
> > +                                 `((assoc-ref inputs ,name)
> > +                                   ,@(map (match-lambda
> > +                                            ((label (? package?
> > _) . _)
> > +                                             `(assoc-ref inputs
> > +                                                         ,(string-append
> > name "/" label))))
> > +
> > (package-transitive-propagated-inputs p)))))
> > +                             `(,perl-authen-sasl
> > +                               ,perl-net-smtp-ssl
> > +                               ,perl-io-socket-ssl)))))))
> 
> Could you move the part of ,@ to a top-level procedure?

Updated patch attached.

`~Eric
From 850f3672ef192354d4bacad48fd84079db08775e Mon Sep 17 00:00:00 2001
From: Eric Bavier <bav...@member.fsf.org>
Date: Sat, 27 Jun 2015 21:06:53 -0500
Subject: [PATCH 4/4] gnu: git: Add inputs for send-email.

* gnu/packages/version-control.scm (package-transitive-propagated-labels*)
  (package-propagated-input-refs): New procedures.
  (git)[inputs]: Add perl-authen-sasl, perl-net-smtp-ssl, and 
perl-io-socket-ssl.
  [outputs]: Add send-email output.
  [arguments]: Add #:modules argument with srfi-1.  In 'split phase, wrap
  git-send-email.
---
 gnu/packages/version-control.scm | 49 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 71171e6..15e6fb6 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -60,7 +60,9 @@
   #:use-module (gnu packages compression)
   #:use-module (gnu packages swig)
   #:use-module (gnu packages tcl)
-  #:use-module (gnu packages))
+  #:use-module (gnu packages)
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1))
 
 (define-public bazaar
   (package
@@ -97,6 +99,23 @@ 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
@@ -124,10 +143,16 @@ as well as the classic centralized workflow.")
       ;; For 'git-svn'.
       ("subversion" ,subversion)
 
+      ;; For 'git-send-email'
+      ("perl-authen-sasl" ,perl-authen-sasl)
+      ("perl-net-smtp-ssl" ,perl-net-smtp-ssl)
+      ("perl-io-socket-ssl" ,perl-io-socket-ssl)
+
       ;; For 'git gui', 'gitk', and 'git citool'.
       ("tcl" ,tcl)
       ("tk" ,tk)))
    (outputs '("out"                               ; the core
+              "send-email"                        ; for git-send-email
               "svn"                               ; git-svn
               "gui"))                             ; gitk, git gui
    (arguments
@@ -141,6 +166,8 @@ as well as the classic centralized workflow.")
                                              (assoc-ref %build-inputs "tk")
                                              "/bin/wish8.6")) ; XXX
 
+      #:modules ((srfi srfi-1)
+                 ,@%gnu-build-system-modules)
       #:phases
        (alist-cons-after
         'configure 'patch-makefile-shebangs
@@ -164,6 +191,7 @@ as well as the classic centralized workflow.")
           (lambda* (#:key inputs outputs #:allow-other-keys)
             ;; Split the binaries to the various outputs.
             (let* ((out      (assoc-ref outputs "out"))
+                   (se       (assoc-ref outputs "send-email"))
                    (svn      (assoc-ref outputs "svn"))
                    (gui      (assoc-ref outputs "gui"))
                    (gitk     (string-append out "/bin/gitk"))
@@ -172,20 +200,23 @@ as well as the classic centralized workflow.")
                    (git-gui* (string-append gui "/libexec/git-core/git-gui"))
                    (git-cit  (string-append out 
"/libexec/git-core/git-citool"))
                    (git-cit* (string-append gui 
"/libexec/git-core/git-citool"))
+                   (git-se   (string-append out 
"/libexec/git-core/git-send-email"))
+                   (git-se*  (string-append se  
"/libexec/git-core/git-send-email"))
                    (git-svn  (string-append out "/libexec/git-core/git-svn"))
                    (git-svn* (string-append svn "/libexec/git-core/git-svn"))
                    (git-sm   (string-append out
                                             
"/libexec/git-core/git-submodule")))
               (mkdir-p (string-append gui "/bin"))
               (mkdir-p (string-append gui "/libexec/git-core"))
+              (mkdir-p (string-append se  "/libexec/git-core"))
               (mkdir-p (string-append svn "/libexec/git-core"))
 
               (for-each (lambda (old new)
                           (copy-file old new)
                           (delete-file old)
                           (chmod new #o555))
-                        (list gitk git-gui git-cit git-svn)
-                        (list gitk* git-gui* git-cit* git-svn*))
+                        (list gitk git-gui git-cit git-se git-svn)
+                        (list gitk* git-gui* git-cit* git-se* git-svn*))
 
               ;; Tell 'git-svn' where Subversion is.
               (wrap-program git-svn*
@@ -202,6 +233,18 @@ as well as the classic centralized workflow.")
                   (,(string-append (assoc-ref inputs "subversion")
                                    "/lib"))))
 
+              ;; Tell 'git-send-email' where perl modules are.
+              (wrap-program git-se*
+                `("PERL5LIB" ":" prefix
+                  ,(map (lambda (o) (string-append o "/lib/perl5/site_perl"))
+                        (delete-duplicates
+                         (list
+                          ,@(package-propagated-input-refs
+                             'inputs
+                             `(,perl-authen-sasl
+                               ,perl-net-smtp-ssl
+                               ,perl-io-socket-ssl)))))))
+
               ;; Tell 'git-submodule' where Perl is.
               (wrap-program git-sm
                 `("PATH" ":" prefix
-- 
2.2.1

Reply via email to