From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxhGB-0007Cc-Ax for guix-patches@gnu.org; Mon, 10 Apr 2017 17:54:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxhG6-00006r-S4 for guix-patches@gnu.org; Mon, 10 Apr 2017 17:54:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:43436) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cxhG6-00006n-Ob for guix-patches@gnu.org; Mon, 10 Apr 2017 17:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cxhG6-0003un-2U for guix-patches@gnu.org; Mon, 10 Apr 2017 17:54:02 -0400 Subject: bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170327193850.12655-1-arunisaac@systemreboot.net> Date: Mon, 10 Apr 2017 23:53:00 +0200 In-Reply-To: (Arun Isaac's message of "Tue, 28 Mar 2017 20:03:13 +0530") Message-ID: <87pogkdj5v.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Arun Isaac Cc: 26275@debbugs.gnu.org Hi, And sorry for the delay. Arun Isaac 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=E2=80=99s purely cosmetic in this case: it makes them more visible and f= its within the 80-column limit. :-) Technically: (define (proc x y) (define a =E2=80=A6) (define b =E2=80=A6) body =E2=80=A6) is equivalent to: (define (proc x y) (letrec ((a =E2=80=A6) (b =E2=80=A6)) body =E2=80=A6)) See . HTH! Ludo=E2=80=99.