guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add (minimal) BioPerl.


From: Ricardo Wurmus
Subject: Re: [PATCH] Add (minimal) BioPerl.
Date: Tue, 21 Jul 2015 10:41:19 +0200

Ludovic Courtès <address@hidden> writes:

>> Is there a better way to make sure that all (direct and transient)
>> runtime dependencies can be found through the PERL5LIB variable?
>
> Good question.  The #:inputs parameter of build phases contains all the
> inputs (native, normal, and propagated) when not cross-compiling, so
> that doesn’t help.
>
> Currently you would have to enumerate the subset of the inputs that you
> want to use in ‘wrap-program’ as done in the ‘clusterssh’ recipe, for
> instance.  That’s tedious but still preferable, esp. if that reduces the
> size of the package’s closure.
>
>> From a7f69eb16e91ca94e5894b234a98a7f14e78fd64 Mon Sep 17 00:00:00 2001
>> From: Ricardo Wurmus <address@hidden>
>> Date: Wed, 3 Jun 2015 17:44:20 +0200
>> Subject: [PATCH] gnu: Add BioPerl.
>>
>> * gnu/packages/bioinformatics.scm (bioperl-minimal): New variable.
>
> [...]
>
>> +            ;; Make sure all executables in "bin" find the required Perl
>> +            ;; modules at runtime.
>> +            (let* ((out (assoc-ref outputs "out"))
>> +                   (bin (string-append out "/bin/"))
>> +                   (path (string-append out "/lib/perl5/site_perl:"
>> +                                        (getenv "PERL5LIB"))))
>> +              (for-each (lambda (file)
>> +                          (wrap-program file
>> +                            `("PERL5LIB" ":" prefix (,path))))
>> +                        (find-files bin "\\.pl$"))
>
> So either leave a “FIXME” saying that this is closing over a superset of
> what’s actually needed at run time, or enumerate the inputs.
>
> Otherwise LGTM.

Attached is a new patch in which only the paths of the transitive target
inputs (+ the output perl site_perl directory) are wrapped around the
executables.  The resulting path is a lot shorter than the PERL5LIB path
at build time and judging from my quick tests the executables do not
complain about missing Perl modules.

WDYT?

>From 7a772f530dba93cfd405e9800e0f043e747a15cc Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <address@hidden>
Date: Wed, 3 Jun 2015 17:44:20 +0200
Subject: [PATCH] gnu: Add BioPerl.

* gnu/packages/bioinformatics.scm (bioperl-minimal): New variable.
---
 gnu/packages/bioinformatics.scm | 64 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 78cd3ce..ef5c8eb 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -52,7 +52,8 @@
   #:use-module (gnu packages vim)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
-  #:use-module (gnu packages zip))
+  #:use-module (gnu packages zip)
+  #:use-module (srfi srfi-1))
 
 (define-public bamtools
   (package
@@ -228,6 +229,67 @@ pybedtools extends BEDTools by offering feature-level 
manipulations from with
 Python.")
     (license license:gpl2+)))
 
+(define-public bioperl-minimal
+  (let* ((inputs `(("perl-module-build" ,perl-module-build)
+                   ("perl-data-stag" ,perl-data-stag)
+                   ("perl-libwww" ,perl-libwww)
+                   ("perl-uri" ,perl-uri)))
+         (transitive-inputs
+          (map (compose package-name cadr)
+               (delete-duplicates
+                (concatenate
+                 (map (compose package-transitive-target-inputs cadr) 
inputs))))))
+    (package
+      (name "bioperl-minimal")
+      (version "1.6.924")
+      (source
+       (origin
+         (method url-fetch)
+         (uri (string-append "mirror://cpan/authors/id/C/CJ/CJFIELDS/BioPerl-"
+                             version ".tar.gz"))
+         (sha256
+          (base32
+           "1l3npcvvvwjlhkna9dndpfv1hklhrgva013kw96m0n1wpd37ask1"))))
+      (build-system perl-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after
+            'install 'wrap-programs
+            (lambda* (#:key outputs #:allow-other-keys)
+              ;; Make sure all executables in "bin" find the required Perl
+              ;; modules at runtime.  As the PERL5LIB variable contains also
+              ;; the paths of native inputs, we pick the transitive target
+              ;; inputs from %build-inputs.
+              (let* ((out  (assoc-ref outputs "out"))
+                     (bin  (string-append out "/bin/"))
+                     (path (string-join
+                            (cons (string-append out "/lib/perl5/site_perl")
+                                  (map (lambda (name)
+                                         (assoc-ref %build-inputs name))
+                                       ',transitive-inputs))
+                            ":")))
+                (for-each (lambda (file)
+                            (wrap-program file
+                              `("PERL5LIB" ":" prefix (,path))))
+                          (find-files bin "\\.pl$"))
+                #t))))))
+      (inputs inputs)
+      (native-inputs
+       `(("perl-test-most" ,perl-test-most)))
+      (home-page "http://search.cpan.org/dist/BioPerl";)
+      (synopsis "Bioinformatics toolkit")
+      (description
+       "BioPerl is the product of a community effort to produce Perl code which
+is useful in biology.  Examples include Sequence objects, Alignment objects
+and database searching objects.  These objects not only do what they are
+advertised to do in the documentation, but they also interact - Alignment
+objects are made from the Sequence objects, Sequence objects have access to
+Annotation and SeqFeature objects and databases, Blast objects can be
+converted to Alignment objects, and so on.  This means that the objects
+provide a coordinated and extensible framework to do computational biology.")
+      (license (package-license perl)))))
+
 (define-public python-biopython
   (package
     (name "python-biopython")
-- 
2.1.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]