On Wed, Apr 18, 2018 at 03:14:45PM -0400, Mark H Weaver wrote:
> I suggest that we add a phase to the replacement 'perl' to install a
> symlink from $out/lib/perl5/5.26.1 pointing to "5.26.2".
> 
> Would you like to try this, Leo, and push it if it solves the problem
> for you?

Thanks for your advice. The attached patch fixes the issue for me.

I would have pushed it but there is one thing I don't understand. Before
I set (replacement #f), the build would fail because the new phase was
run twice, and symlinking fails because it is not "forced" (as in `ln
-sf`). Is this expected behaviour?
From b49afa6cf9e18d57e67c0580a09e0ee9168218e7 Mon Sep 17 00:00:00 2001
From: Leo Famulari <l...@famulari.name>
Date: Wed, 18 Apr 2018 16:41:39 -0400
Subject: [PATCH] gnu: Perl: Fix a grafting failure due to a path that includes
 the package version.

Fixes <https://bugs.gnu.org/31210>.

* gnu/packages/perl.scm (perl-5.26.2)[arguments]: Add a
'workaround-grafting-version-bug' phase.
---
 gnu/packages/perl.scm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index 34eef565b..24e055225 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -43,6 +43,7 @@
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system perl)
+  #:use-module (guix utils) ;substitute-keyword-arguments for perl-5.26.2
   #:use-module (gnu packages base)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages perl-check)
@@ -161,13 +162,27 @@
 (define-public perl-5.26.2
   (package/inherit perl
     (version "5.26.2")
+    (replacement #f)
     (source (origin
               (inherit (package-source perl))
               (uri (string-append "mirror://cpan/src/5.0/perl-"
                                   version ".tar.gz"))
               (sha256
                (base32
-                "03gpnxx1g6hvlh0v4aqx00580h787sfywp1vlvw64q2xcbm9qbsp"))))))
+                "03gpnxx1g6hvlh0v4aqx00580h787sfywp1vlvw64q2xcbm9qbsp"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments perl)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           ;; The path to libperl.so includes the Perl version number, and this
+           ;; is not handled by grafting. See <https://bugs.gnu.org/31210>.
+           (add-after 'install 'workaround-grafting-version-bug
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (new (string-append out "/lib/perl5/5.26.2"))
+                      (old (string-append out "/lib/perl5/5.26.1")))
+                 (symlink new old)
+                 #t)))))))))
 
 (define-public perl-algorithm-c3
   (package
-- 
2.17.0

Attachment: signature.asc
Description: PGP signature

Reply via email to