GNU bug report logs - #26275
[PATCH] build: perl-build-system: Add `wrap' phase.

Previous Next

Package: guix-patches;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Mon, 27 Mar 2017 19:40:02 UTC

Severity: normal

Tags: patch

Done: Jonathan Brielmaier <jonathan.brielmaier <at> web.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26275 in the body.
You can then email your comments to 26275 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#26275; Package guix-patches. (Mon, 27 Mar 2017 19:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arun Isaac <arunisaac <at> systemreboot.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 27 Mar 2017 19:40:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: guix-patches <at> gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Tue, 28 Mar 2017 01:08:50 +0530
* guix/build/perl-build-system.scm (wrap): New procedure.
(%standard-phases): Add it.
---
 guix/build/perl-build-system.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/guix/build/perl-build-system.scm b/guix/build/perl-build-system.scm
index 8f480eae1..32ef86b65 100644
--- a/guix/build/perl-build-system.scm
+++ b/guix/build/perl-build-system.scm
@@ -19,7 +19,10 @@
 (define-module (guix build perl-build-system)
   #:use-module ((guix build gnu-build-system) #:prefix gnu:)
   #:use-module (guix build utils)
+  #:use-module (ice-9 ftw)
   #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
   #:export (%standard-phases
             perl-build))
 
@@ -68,6 +71,31 @@
 (define-w/gnu-fallback* (install)
   (zero? (system* "./Build" "install")))
 
+(define* (wrap #:key inputs outputs #:allow-other-keys)
+  (define (list-of-files dir)
+    (map (cut string-append dir "/" <>)
+         (or (scandir dir (lambda (f)
+                            (let ((s (stat (string-append dir "/" f))))
+                              (eq? 'regular (stat:type s)))))
+             '())))
+
+  (define bindirs
+    (append-map (match-lambda
+                  ((_ . dir)
+                   (list (string-append dir "/bin")
+                         (string-append dir "/sbin"))))
+                outputs))
+
+  (let* ((out  (assoc-ref outputs "out"))
+         (var `("PERL5LIB" prefix
+                ,(search-path-as-string->list
+                  (or (getenv "PERL5LIB") "")))))
+    (for-each (lambda (dir)
+                (let ((files (list-of-files dir)))
+                  (for-each (cut wrap-program <> var)
+                            files)))
+              bindirs)))
+
 (define %standard-phases
   ;; Everything is as with the GNU Build System except for the `configure',
   ;; `build', `check', and `install' phases.
@@ -75,6 +103,7 @@
     (replace 'install install)
     (replace 'check check)
     (replace 'build build)
+    (add-after 'install 'wrap wrap)
     (replace 'configure configure)))
 
 (define* (perl-build #:key inputs (phases %standard-phases)
-- 
2.11.0





Information forwarded to guix-patches <at> gnu.org:
bug#26275; Package guix-patches. (Mon, 27 Mar 2017 19:50:01 GMT) Full text and rfc822 format available.

Message #8 received at 26275 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 26275 <at> debbugs.gnu.org
Subject: Re: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Tue, 28 Mar 2017 01:19:20 +0530
As discussed earlier at bug 26203
(https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26203), I have added a
`wrap' phase to the perl-build-system. Please consider this a first
iteration and provide feedback.




Information forwarded to guix-patches <at> gnu.org:
bug#26275; Package guix-patches. (Tue, 28 Mar 2017 14:34:02 GMT) Full text and rfc822 format available.

Message #11 received at 26275 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 26275 <at> debbugs.gnu.org
Subject: Re: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Tue, 28 Mar 2017 20:03:13 +0530
> +(define* (wrap #:key inputs outputs #:allow-other-keys)
> +  (define (list-of-files dir)
> +    (map (cut string-append dir "/" <>)
> +         (or (scandir dir (lambda (f)
> +                            (let ((s (stat (string-append dir "/" f))))
> +                              (eq? 'regular (stat:type s)))))
> +             '())))
> +
> +  (define bindirs
> +    (append-map (match-lambda
> +                  ((_ . dir)
> +                   (list (string-append dir "/bin")
> +                         (string-append dir "/sbin"))))
> +                outputs))
> +
> +  (let* ((out  (assoc-ref outputs "out"))
> +         (var `("PERL5LIB" prefix
> +                ,(search-path-as-string->list
> +                  (or (getenv "PERL5LIB") "")))))
> +    (for-each (lambda (dir)
> +                (let ((files (list-of-files dir)))
> +                  (for-each (cut wrap-program <> var)
> +                            files)))
> +              bindirs)))

I copied this wrap function from the python build system, and modified
it a little to suite perl. Is there any reason `list-of-files' and
`bindirs' are initialized using `define' rather than a `let' binding?
This is probably a very basic Guile question, but still...

Thanks,
Arun Isaac.




Information forwarded to guix-patches <at> gnu.org:
bug#26275; Package guix-patches. (Tue, 28 Mar 2017 15:19:02 GMT) Full text and rfc822 format available.

Message #14 received at 26275 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Arun Isaac <arunisaac <at> systemreboot.net>, 26275 <at> debbugs.gnu.org
Subject: Re: bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Tue, 28 Mar 2017 17:18:12 +0200
[Message part 1 (text/plain, inline)]
Hello!

I can't study the code right now, but at a glance it looks like this
will also include native-inputs in PERL5LIB. Can you try to filter them
out?

Doing that will effectively also solve
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25235 . Patch welcome! :)

Arun Isaac <arunisaac <at> systemreboot.net> writes:

> * guix/build/perl-build-system.scm (wrap): New procedure.
> (%standard-phases): Add it.
> ---
>  guix/build/perl-build-system.scm | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>
> diff --git a/guix/build/perl-build-system.scm b/guix/build/perl-build-system.scm
> index 8f480eae1..32ef86b65 100644
> --- a/guix/build/perl-build-system.scm
> +++ b/guix/build/perl-build-system.scm
> @@ -19,7 +19,10 @@
>  (define-module (guix build perl-build-system)
>    #:use-module ((guix build gnu-build-system) #:prefix gnu:)
>    #:use-module (guix build utils)
> +  #:use-module (ice-9 ftw)
>    #:use-module (ice-9 match)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-26)
>    #:export (%standard-phases
>              perl-build))
>  
> @@ -68,6 +71,31 @@
>  (define-w/gnu-fallback* (install)
>    (zero? (system* "./Build" "install")))
>  
> +(define* (wrap #:key inputs outputs #:allow-other-keys)
> +  (define (list-of-files dir)
> +    (map (cut string-append dir "/" <>)
> +         (or (scandir dir (lambda (f)
> +                            (let ((s (stat (string-append dir "/" f))))
> +                              (eq? 'regular (stat:type s)))))
> +             '())))
> +
> +  (define bindirs
> +    (append-map (match-lambda
> +                  ((_ . dir)
> +                   (list (string-append dir "/bin")
> +                         (string-append dir "/sbin"))))
> +                outputs))
> +
> +  (let* ((out  (assoc-ref outputs "out"))
> +         (var `("PERL5LIB" prefix
> +                ,(search-path-as-string->list
> +                  (or (getenv "PERL5LIB") "")))))
> +    (for-each (lambda (dir)
> +                (let ((files (list-of-files dir)))
> +                  (for-each (cut wrap-program <> var)
> +                            files)))
> +              bindirs)))
> +
>  (define %standard-phases
>    ;; Everything is as with the GNU Build System except for the `configure',
>    ;; `build', `check', and `install' phases.
> @@ -75,6 +103,7 @@
>      (replace 'install install)
>      (replace 'check check)
>      (replace 'build build)
> +    (add-after 'install 'wrap wrap)
>      (replace 'configure configure)))
>  
>  (define* (perl-build #:key inputs (phases %standard-phases)
> -- 
> 2.11.0
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#26275; Package guix-patches. (Tue, 28 Mar 2017 17:03:01 GMT) Full text and rfc822 format available.

Message #17 received at 26275 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 26275 <at> debbugs.gnu.org
Subject: Re: bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Tue, 28 Mar 2017 22:32:01 +0530
> I can't study the code right now, but at a glance it looks like this
> will also include native-inputs in PERL5LIB. Can you try to filter them
> out?
>
> Doing that will effectively also solve
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25235 . Patch welcome! :)

Yes, I'll do this! :-) I'll first send a patch for bug 25235, we'll
close that, and then come back here.




Information forwarded to guix-patches <at> gnu.org:
bug#26275; Package guix-patches. (Mon, 10 Apr 2017 21:54:02 GMT) Full text and rfc822 format available.

Message #20 received at 26275 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 26275 <at> debbugs.gnu.org
Subject: Re: bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Mon, 10 Apr 2017 23:53:00 +0200
Hi,

And sorry for the delay.

Arun Isaac <arunisaac <at> systemreboot.net> skribis:

>> +(define* (wrap #:key inputs outputs #:allow-other-keys)
>> +  (define (list-of-files dir)
>> +    (map (cut string-append dir "/" <>)
>> +         (or (scandir dir (lambda (f)
>> +                            (let ((s (stat (string-append dir "/" f))))
>> +                              (eq? 'regular (stat:type s)))))
>> +             '())))
>> +
>> +  (define bindirs
>> +    (append-map (match-lambda
>> +                  ((_ . dir)
>> +                   (list (string-append dir "/bin")
>> +                         (string-append dir "/sbin"))))
>> +                outputs))
>> +
>> +  (let* ((out  (assoc-ref outputs "out"))
>> +         (var `("PERL5LIB" prefix
>> +                ,(search-path-as-string->list
>> +                  (or (getenv "PERL5LIB") "")))))
>> +    (for-each (lambda (dir)
>> +                (let ((files (list-of-files dir)))
>> +                  (for-each (cut wrap-program <> var)
>> +                            files)))
>> +              bindirs)))
>
> I copied this wrap function from the python build system, and modified
> it a little to suite perl. Is there any reason `list-of-files' and
> `bindirs' are initialized using `define' rather than a `let' binding?
> This is probably a very basic Guile question, but still...

It’s purely cosmetic in this case: it makes them more visible and fits
within the 80-column limit.  :-)

Technically:

  (define (proc x y)
    (define a …)
    (define b …)
    body …)

is equivalent to:

  (define (proc x y)
    (letrec ((a …)
             (b …))
      body …))

See <https://gnu.org/software/guile/manual/html_node/Local-Bindings.html>.

HTH!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#26275; Package guix-patches. (Fri, 02 Jun 2017 16:34:02 GMT) Full text and rfc822 format available.

Message #23 received at 26275 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 26275 <at> debbugs.gnu.org
Subject: Re: bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Fri, 02 Jun 2017 18:33:34 +0200
Hi Arun,

Arun Isaac <arunisaac <at> systemreboot.net> skribis:

>> I can't study the code right now, but at a glance it looks like this
>> will also include native-inputs in PERL5LIB. Can you try to filter them
>> out?
>>
>> Doing that will effectively also solve
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25235 . Patch welcome! :)
>
> Yes, I'll do this! :-) I'll first send a patch for bug 25235, we'll
> close that, and then come back here.

What’s the status of this patch?  It might still be time for
‘core-updates’ if it’s ready…

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#26275; Package guix-patches. (Fri, 02 Jun 2017 17:41:02 GMT) Full text and rfc822 format available.

Message #26 received at 26275 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 26275 <at> debbugs.gnu.org
Subject: Re: bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Fri, 02 Jun 2017 23:10:41 +0530
> What’s the status of this patch?  It might still be time for
> ‘core-updates’ if it’s ready…

I don't have a solution for the native-inputs being included in the
wrap. Without that, I can deliver a patch. I've just been waiting for
someone to figure out the native-inputs problem. This problem is shared
with the python wrap phase as well.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25235

But, Alex Sassmannshausen has a generalized wrap phase for python and
perl ready at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27003 . So,
I think we should close this bug report and bug 25235 to use his
patches. He too does not have a solution for the native-inputs problem.




Reply sent to Jonathan Brielmaier <jonathan.brielmaier <at> web.de>:
You have taken responsibility. (Mon, 16 Nov 2020 18:04:01 GMT) Full text and rfc822 format available.

Notification sent to Arun Isaac <arunisaac <at> systemreboot.net>:
bug acknowledged by developer. (Mon, 16 Nov 2020 18:04:01 GMT) Full text and rfc822 format available.

Message #31 received at 26275-done <at> debbugs.gnu.org (full text, mbox):

From: Jonathan Brielmaier <jonathan.brielmaier <at> web.de>
To: 26275-done <at> debbugs.gnu.org
Subject: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Mon, 16 Nov 2020 19:03:25 +0100
Functionality was added in 0fb9a8df429a7b9f40610ff15baaff0d8e31e8cf by
Ricardo.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 15 Dec 2020 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 199 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.