From patchwork Mon Dec 13 06:00:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 35159 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 42A1F27BBEA; Mon, 13 Dec 2021 06:03:42 +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 C61B527BBE9 for ; Mon, 13 Dec 2021 06:03:41 +0000 (GMT) Received: from localhost ([::1]:40666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mweR2-0001h9-V5 for patchwork@mira.cbaines.net; Mon, 13 Dec 2021 01:03:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mweQR-0000p1-Dd for guix-patches@gnu.org; Mon, 13 Dec 2021 01:03:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42158) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mweQR-00074h-4k for guix-patches@gnu.org; Mon, 13 Dec 2021 01:03:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mweQR-0002RS-1C for guix-patches@gnu.org; Mon, 13 Dec 2021 01:03:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v4 03/45] gnu: node: Patch shebangs in node_modules. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Dec 2021 06:03: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 Cc: Timothy Sample , Pierre Langlois , Jelle Licht , Philip McGrath , Liliana Marie Prikler Received: via spool by 51838-submit@debbugs.gnu.org id=B51838.16393753609267 (code B ref 51838); Mon, 13 Dec 2021 06:03:02 +0000 Received: (at 51838) by debbugs.gnu.org; 13 Dec 2021 06:02:40 +0000 Received: from localhost ([127.0.0.1]:53685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mweQ4-0002PN-65 for submit@debbugs.gnu.org; Mon, 13 Dec 2021 01:02:40 -0500 Received: from mail-ua1-f51.google.com ([209.85.222.51]:45927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mweQ1-0002Ou-CL for 51838@debbugs.gnu.org; Mon, 13 Dec 2021 01:02:37 -0500 Received: by mail-ua1-f51.google.com with SMTP id ay21so27247095uab.12 for <51838@debbugs.gnu.org>; Sun, 12 Dec 2021 22:02:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vNLOSTWhsUvYl4zbQmT0Z6mwdgkAqlBATEO6lq8SgZA=; b=AIjqCNjFjedGguEGy2DVpLiUL9xlRvB9So1RPvSW+nzATkEhun3nRw2PWY1fb8xx6o /wBroCefZ1EpVcN7hkbTgZxCyxxgqipkYRuI8FPr5btdEnyHeDsCjOAyLe1oog5vwmMT YlKYACnNr7+EYzVs5cWN2YTtdp9hsRsw0uONnhTazLMH/rFpcIWOf+tG/PHd+u98iXG/ G7+F9g1eqH+/fOb2sbIxb38viSBkpg9gVRiH0oNsDf0WkDKXtSJlOsNQLn98sXHfGbM4 U/gsm6taIC6U8dknfvUeD6BjL1+4aPf3lXADJyHITpIilCi0OQ0bLlc4xYoX2GbNQTgT gdbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vNLOSTWhsUvYl4zbQmT0Z6mwdgkAqlBATEO6lq8SgZA=; b=V5GQAOaZj9W8Is4ujIZ8fotQIMkvtWW2jashpmjsv0MjZE0HGlK8afLajeQ51+jJkC OdAJvfKjFcf2skCeli5lSm3XY7sfn6zS98nuY9sz2xsUSzotOe7dHO1j/G2qRIwH4Q0R gyqH6jVqrEoZMfRA6I2nY3rZfWeWnvXvG+7OOkKcvRD8CBXovBUoEZBJPf6bbe5TFbKZ 0iLhxGNjletI9odOQBstbpl7JNECXc1JBKk5MSedftK1VkCz8Wwht6Fy4P65ITehXsuH 1kR32sjhtKYjFlHZzrmU0KhrTi3iEsS8nmBxz5UWF8/xuaAyC4+o759gQz7qYu7/D+hR ppoQ== X-Gm-Message-State: AOAM533iKtcv8oof2agKtmmYFOpGZMtG0DuQ6Y/tYuFnknNiJiTOkc9l K6mycMi7//tYlyY8jFmmFWuD/1Y62QOhm40A7SY= X-Google-Smtp-Source: ABdhPJxoOkGgXGSN8HzjeYXZiVyv/RTkGszKCrU/UOMCPsPbjsNwYTlHFlsFS4w+Exl9i92h2iIKJA== X-Received: by 2002:ab0:7041:: with SMTP id v1mr39840971ual.95.1639375351924; Sun, 12 Dec 2021 22:02:31 -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 o128sm3561495vsc.7.2021.12.12.22.02.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Dec 2021 22:02:31 -0800 (PST) From: Philip McGrath Date: Mon, 13 Dec 2021 01:00:25 -0500 Message-Id: <20211213060107.129223-4-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211213060107.129223-1-philip@philipmcgrath.com> References: <46a042bc08eb72a068b1e8c69bfe28cf2d4b2e53.camel@gmail.com> <20211208202838.752542-1-philip@philipmcgrath.com> <20211208202838.752542-5-philip@philipmcgrath.com> <877dc924h7.fsf@gmx.com> <5c62c3ce-dd50-5dcd-00ed-ff1524be4e0b@philipmcgrath.com> <20211213060107.129223-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)))))))