From patchwork Wed Dec 8 20:27:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 35022 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3946E27BBEA; Wed, 8 Dec 2021 20:29:24 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B84E927BBE9 for ; Wed, 8 Dec 2021 20:29:23 +0000 (GMT) Received: from localhost ([::1]:43930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mv3Z4-0005jw-Tp for patchwork@mira.cbaines.net; Wed, 08 Dec 2021 15:29:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mv3Yk-0005Ll-TE for guix-patches@gnu.org; Wed, 08 Dec 2021 15:29:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58244) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mv3Yk-0000B9-Lr for guix-patches@gnu.org; Wed, 08 Dec 2021 15:29:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mv3Yk-0005ph-Hi for guix-patches@gnu.org; Wed, 08 Dec 2021 15:29:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v3 03/43] gnu: node: Patch shebangs in node_modules. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 08 Dec 2021 20:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51838 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51838@debbugs.gnu.org Received: via spool by 51838-submit@debbugs.gnu.org id=B51838.163899533622337 (code B ref 51838); Wed, 08 Dec 2021 20:29:02 +0000 Received: (at 51838) by debbugs.gnu.org; 8 Dec 2021 20:28:56 +0000 Received: from localhost ([127.0.0.1]:41541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv3Yd-0005oC-MV for submit@debbugs.gnu.org; Wed, 08 Dec 2021 15:28:55 -0500 Received: from mail-ua1-f44.google.com ([209.85.222.44]:44583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv3YW-0005mu-JD for 51838@debbugs.gnu.org; Wed, 08 Dec 2021 15:28:49 -0500 Received: by mail-ua1-f44.google.com with SMTP id p2so6849981uad.11 for <51838@debbugs.gnu.org>; Wed, 08 Dec 2021 12:28:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vNLOSTWhsUvYl4zbQmT0Z6mwdgkAqlBATEO6lq8SgZA=; b=OCaN3+2LpdQqdE6Hs4Kefq9OVEHl3A4SOlWQ7ijfqT3ZNz706H9Cn9a5JO8MUOfW/9 x952Hp3MF/0nb9yFRnpodKPJKE8mBlqKadGPxxqwhWOvtTKY/pFe5Q8272etHT77ag3Z NjfGgr+98UDawyD02413LrkCnb/ln7x7f6FZ7L7w+MQbDHM5JAyNiS1+DCoHVHbHQVMT vh46sEdx75L5WIv1vRAUYg0X3Z0c2hQ5mOImuKhLrIO0TZi0vy81zs6/vvYX1eSbc+N9 giNXmn6yE+offTyuD3TcSoG3kaiVmNfoQP+MxkbD+cmbXfKx8M3N7/p6I4UQS+3Nbu1Q oPcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vNLOSTWhsUvYl4zbQmT0Z6mwdgkAqlBATEO6lq8SgZA=; b=ny5cdB6OLp5Lu5M0AeOjdZImUNNLJT9EJpQBseg4nwlGT8RaegG3rDcUvPgHBSszlR 0i9sJbj0sitSD6LDnJQkZtL2aeqrrOBJsLtSmv0V9fhUdlhODtU4KKPSPHG9o2KCRuaS Bps0XIoDzbzGYXuy0ekPNbJOjULhEXNMNjsykuQ5VVQP8PS1Wgh58R1mGPVsHlmRBVsX j3rFRxB872G2WFU1WrGvmNQqGVYAN8TrRM4Y5iaghMQSrBAsNnEmArEU38YfIg+lLEmD GldN9QuaYy6DFOXGuXc5ugnZjy9ICTyoiOJ06zV8E4SxI2Z7MDUNdnkDYjYEotsGOozs B5XQ== X-Gm-Message-State: AOAM532PS/+t2DR4l3lw5n9Bqx9ggd4XL/fCMCHBoTtZLFXzWpvFA2CU besAIH8dbL+dEU5DDSPoXUoOccFIpocZOXeTI5A= X-Google-Smtp-Source: ABdhPJwFid7i6ah0yHT38zV75S9K222oziLNTPoW22ahKFI6YhXSu9XipL4QUcoOCsJNUmmc6GzP+Q== X-Received: by 2002:ab0:383:: with SMTP id 3mr11255513uau.4.1638995322885; Wed, 08 Dec 2021 12:28:42 -0800 (PST) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with ESMTPSA id bj50sm2512958vkb.7.2021.12.08.12.28.42 for <51838@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Dec 2021 12:28:42 -0800 (PST) From: Philip McGrath Date: Wed, 8 Dec 2021 15:27:58 -0500 Message-Id: <20211208202838.752542-4-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211208202838.752542-1-philip@philipmcgrath.com> References: <46a042bc08eb72a068b1e8c69bfe28cf2d4b2e53.camel@gmail.com> <20211208202838.752542-1-philip@philipmcgrath.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/node.scm (node)[arguments]: Replace 'patch-npm-shebang and 'patch-node-shebang with a new 'patch-nested-shebangs that also handles node-gyp and other shebangs under "/lib/node_modules". [inputs]: Add Python for node-gyp as "python-for-target". (node-lts)[inputs]: Likewise. (libnode)[arguments]: Adjust to delete 'patch-nested-shebangs rather than 'patch-npm-shebang and 'patch-node-shebang. --- gnu/packages/node.scm | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index 71b66774a6..a57a74fb81 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -237,21 +237,20 @@ (define-public node python (string-append python "3"))) "configure" flags)))) - (add-after 'patch-shebangs 'patch-npm-shebang - (lambda* (#:key outputs #:allow-other-keys) - (let* ((bindir (string-append (assoc-ref outputs "out") - "/bin")) - (npm (string-append bindir "/npm")) - (target (readlink npm))) - (with-directory-excursion bindir - (patch-shebang target (list bindir)))))) - (add-after 'install 'patch-node-shebang - (lambda* (#:key outputs #:allow-other-keys) - (let* ((bindir (string-append (assoc-ref outputs "out") - "/bin")) - (npx (readlink (string-append bindir "/npx")))) - (with-directory-excursion bindir - (patch-shebang npx (list bindir))))))))) + (add-after 'patch-shebangs 'patch-nested-shebangs + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((prefix (assoc-ref outputs "out")) + (path (map (lambda (dir) + (string-append dir "/bin")) + (list prefix + (assoc-ref inputs "python-for-target"))))) + (for-each + (lambda (file) + (patch-shebang file path)) + (find-files (string-append prefix "/lib/node_modules") + (lambda (file stat) + (executable-file? file)) + #:stat lstat)))))))) (native-inputs `(;; Runtime dependencies for binaries used as a bootstrap. ("c-ares" ,c-ares) @@ -274,6 +273,7 @@ (define-public node (inputs `(("bash" ,bash-minimal) ("coreutils" ,coreutils) + ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3) ("c-ares" ,c-ares) ("http-parser" ,http-parser) ("icu4c" ,icu4c) @@ -799,6 +799,7 @@ (define-public node-lts (inputs `(("bash" ,bash-minimal) ("coreutils" ,coreutils) + ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3) ("c-ares" ,c-ares-for-node) ("icu4c" ,icu4c-67) ("libuv" ,libuv-for-node) @@ -817,5 +818,4 @@ (define-public libnode `(cons* "--shared" "--without-npm" ,flags)) ((#:phases phases '%standard-phases) `(modify-phases ,phases - (delete 'patch-npm-shebang) - (delete 'patch-node-shebang))))))) + (delete 'patch-nested-shebangs)))))))