From: ludo@gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: 26275@debbugs.gnu.org
Subject: bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Mon, 10 Apr 2017 23:53:00 +0200 [thread overview]
Message-ID: <87pogkdj5v.fsf@gnu.org> (raw)
In-Reply-To: <f5525e2f.AEAAIZKx6N0AAAAAAAAAAAOwQVoAAAACwQwAAAAAAAW9WABY2nQ0@mailjet.com> (Arun Isaac's message of "Tue, 28 Mar 2017 20:03:13 +0530")
Hi,
And sorry for the delay.
Arun Isaac <arunisaac@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’.
next prev parent reply other threads:[~2017-04-10 21:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170327193850.12655-1-arunisaac@systemreboot.net>
2017-03-27 19:49 ` bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase Arun Isaac
2017-03-28 14:33 ` Arun Isaac
2017-04-10 21:53 ` Ludovic Courtès [this message]
2017-03-27 19:38 Arun Isaac
2017-03-28 15:18 ` Marius Bakke
2017-03-28 17:02 ` Arun Isaac
2017-06-02 16:33 ` Ludovic Courtès
2017-06-02 17:40 ` Arun Isaac
2020-11-16 18:03 ` Jonathan Brielmaier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pogkdj5v.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=26275@debbugs.gnu.org \
--cc=arunisaac@systemreboot.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).