From: ludo@gnu.org (Ludovic Courtès)
To: Alex Sassmannshausen <alex.sassmannshausen@gmail.com>
Cc: guix-devel@gnu.org, Alex Sassmannshausen <alex@pompo.co>
Subject: Re: [PATCH] build-system/perl: Add wrap phase.
Date: Sun, 13 Nov 2016 13:23:54 +0100 [thread overview]
Message-ID: <87a8d3h8kl.fsf@gnu.org> (raw)
In-Reply-To: <20161112172446.5571-2-alex@pompo.co> (Alex Sassmannshausen's message of "Sat, 12 Nov 2016 18:24:46 +0100")
Alex Sassmannshausen <alex.sassmannshausen@gmail.com> skribis:
> * guix/build/perl-build-system.scm (wrap): New procedure.
> (%standard-phases): Declare new phase, `wrap`, and use `wrap`
> procedure.
Nice!
> +(define* (wrap #:key inputs outputs #:allow-other-keys)
Please add a docstring, even if the original code didn’t have one. ;-)
> + (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"))
> + (perl (assoc-ref inputs "perl"))
> + (var `("PERL5LIB" prefix
> + ,(cons (string-append out "/lib/perl5/site_perl/"
> + ;; Like in python’s, we assume version
> + ;; at end of `perl' string.
> + (last (string-split perl #\-)))
> + (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)))
Please have it return #t explicitly, for clarity.
Otherwise LGTM!
There are 479 packages using ‘perl-build-system’ but in total 1,159
packages are affected:
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(gnu packages)
scheme@(guile-user)> ,use(guix build-system perl)
scheme@(guile-user)> ,use(guix)
scheme@(guile-user)> (fold-packages (lambda (p n)
(if (eq? (package-build-system p)
perl-build-system)
(+ 1 n)
n))
0)
$2 = 479
scheme@(guile-user)> ,use(guix graph)
scheme@(guile-user)> ,use(guix scripts graph)
scheme@(guile-user)> ,enter-store-monad
store-monad@(guile-user) [1]> (node-back-edges %package-node-type
(fold-packages cons '()))
$3 = #<procedure 5d0fee0 at guix/graph.scm:87:17 (node)>
store-monad@(guile-user) [1]> ,q
scheme@(guile-user)> (node-reachable-count
(fold-packages (lambda (p l)
(if (eq? (package-build-system p)
perl-build-system)
(cons p l)
l))
'())
$3)
$4 = 1159
--8<---------------cut here---------------end--------------->8---
So I think this should go to ‘core-updates’.
We should probably factorize this in (guix build utils) eventually and
have both python-build-system and perl-build-system use it. Like:
(wrap-language-programs directories
"PERL5LIB"
(cons (string-append …)
(search-path-as-string->list …)))
Thanks!
Ludo’.
next prev parent reply other threads:[~2016-11-13 12:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-12 17:24 [PATCH] Wrap binaries in perl build system Alex Sassmannshausen
2016-11-12 17:24 ` [PATCH] build-system/perl: Add wrap phase Alex Sassmannshausen
2016-11-13 12:23 ` Ludovic Courtès [this message]
2016-11-13 15:11 ` Hartmut Goebel
2016-11-13 20:05 ` Leo Famulari
2016-11-13 21:41 ` Hartmut Goebel
2016-11-16 4:39 ` [PATCH] Wrap binaries in perl build system Eric Bavier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8d3h8kl.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=alex.sassmannshausen@gmail.com \
--cc=alex@pompo.co \
--cc=guix-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.