From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fl8p8-0006nJ-5Q for guix-patches@gnu.org; Thu, 02 Aug 2018 04:19:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fl8p4-0006TV-62 for guix-patches@gnu.org; Thu, 02 Aug 2018 04:19:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:33209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fl8p4-0006TK-11 for guix-patches@gnu.org; Thu, 02 Aug 2018 04:19:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fl8p3-0007Ns-Ls for guix-patches@gnu.org; Thu, 02 Aug 2018 04:19:01 -0400 Subject: [bug#29951] [PATCH] WIP guix: Add wrap-script. Resent-Message-ID: MIME-Version: 1.0 In-Reply-To: <20180102204434.2716-1-rekado@elephly.net> References: <20180102204434.2716-1-rekado@elephly.net> From: Jelle Licht Date: Thu, 2 Aug 2018 10:18:13 +0200 Message-ID: Content-Type: multipart/alternative; boundary="000000000000d4c6a105726f733d" 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: Ricardo Wurmus Cc: h.goebel@crazy-compilers.com, 29951@debbugs.gnu.org --000000000000d4c6a105726f733d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2018-01-02 21:44 GMT+01:00 Ricardo Wurmus : > * guix/build/utils.scm (wrap-script): New procedure. > --- > guix/build/utils.scm | 101 ++++++++++++++++++++++++++++++ > +++++++++++++++++++++ > 1 file changed, 101 insertions(+) > > diff --git a/guix/build/utils.scm b/guix/build/utils.scm > index 7391307c8..a2efcb31c 100644 > --- a/guix/build/utils.scm > +++ b/guix/build/utils.scm > @@ -3,6 +3,7 @@ > ;;; Copyright =C2=A9 2013 Andreas Enge > ;;; Copyright =C2=A9 2013 Nikita Karetnikov > ;;; Copyright =C2=A9 2015 Mark H Weaver > +;;; Copyright =C2=A9 2018 Ricardo Wurmus > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -84,6 +85,7 @@ > fold-port-matches > remove-store-references > wrap-program > + wrap-script > invoke > > locale-category->string)) > @@ -1068,6 +1070,105 @@ with definitions for VARS." > (chmod prog-tmp #o755) > [...] > (rename-file prog-tmp prog)))) > > +(define wrap-script > + (let ((interpreter-regex > + (make-regexp > + (string-append "^#! ?(/bin/sh|/gnu/store/[^/]+/bin/(" > Won't this be an issue for people using a customized store location? [snipped] > --000000000000d4c6a105726f733d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


2018-01-02 21:44 GMT+01:00 Ricardo Wurmus <rekado@elephly.net>= :
* guix/build/utils.scm (wrap-scr= ipt): New procedure.
---
=C2=A0guix/build/utils.scm | 101 +++++++++++++++++++++++++++++++++++++= ++++++++++++++
=C2=A01 file changed, 101 insertions(+)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 7391307c8..a2efcb31c 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -3,6 +3,7 @@
=C2=A0;;; Copyright =C2=A9 2013 Andreas Enge <andreas@enge.fr>
=C2=A0;;; Copyright =C2=A9 2013 Nikita Karetnikov <nikita@karetnikov.org>
=C2=A0;;; Copyright =C2=A9 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright =C2=A9 2018 Ricardo Wurmus <rekado@elephly.net>
=C2=A0;;;
=C2=A0;;; This file is part of GNU Guix.
=C2=A0;;;
@@ -84,6 +85,7 @@
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fold-port-matches
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0remove-store-references
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wrap-program
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 wrap-script
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0invoke

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0locale-category->string)= )
@@ -1068,6 +1070,105 @@ with definitions for VARS."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(chmod prog-tmp #o755)
=C2=A0 =C2=A0
[...]
=C2=A0 =C2=A0 =C2=A0(rename-file prog-tmp prog))))

+(define wrap-script
+=C2=A0 (let ((interpreter-regex
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(make-regexp
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (string-append "^#! ?(/bin/sh|/gnu= /store/[^/]+/bin/("
=C2=A0
Won'= ;t this be an issue for people using a customized store location?

<= /div>
[snipped]

=C2=A0
--000000000000d4c6a105726f733d--