From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yASyMDritmEuSQEAgWs5BA (envelope-from ) for ; Mon, 13 Dec 2021 07:03:38 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gJ10LDritmHGYQAAB5/wlQ (envelope-from ) for ; Mon, 13 Dec 2021 06:03:38 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 631502AF5F for ; Mon, 13 Dec 2021 07:03:38 +0100 (CET) Received: from localhost ([::1]:40666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mweQz-0001h9-Gq for larch@yhetil.org; Mon, 13 Dec 2021 01:03:37 -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 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1639375418; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vNLOSTWhsUvYl4zbQmT0Z6mwdgkAqlBATEO6lq8SgZA=; b=a4KyLX9D2r64UHspr6w5hd//r5FM2hFwOiwxRRdJbHZXU8omFEi3y3EUWuWGsyH0N+HB4o AkZBcXwJOLW1ty9sHnQnrP0emTMQWnR+J9UvQHh/ZHiaeHEc5Ybz/iyPKwKllwIF4VRR8d 0OCTfruEVsTf039KwXSVkkO/IvyPzbvIy3AXBPufvQ4Aub2ZXkBjTDMTDpBTrqGjbsKUm+ Qu+i+M6Rrjapi6vekDF9ENd5cMeaW5LSvl0bTuNnLxC+juLu1WQ6LXuTQFnIviAz840X1u Nfz2YwFS31cvcVDHfwBKuB3B4EnDo4HPYyhaVed+xzgaTgIjOJtUEQKzTW9XAg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1639375418; a=rsa-sha256; cv=none; b=BjuRu6j9JmzRh6uoQRcR98Hp6Xo/CgXVn45iQDrIXCAl8NQrM+wVQjQtDCRTHgMFzhCdXS 3iHbI9FWjv7pmkzePbI+gUgYPsyhI7RgukEw9iiFK3dzKXjGzSF+2Zmw/21wLYCti9XPLp XknwYw+Jmow3qAhUKUwgOtUZa+N4U5j3DrmbE2VDa9E4ep56xasDV6sKxMHQjwFoSnSp0R kiOCWV8XlSTgPwzaAr/xvdAwINQ9HUn2xJr9r1J7EHKblWRaHdRb0DRLEuHCi7+f78CgHW nmfFULzoGm1OFxhL8F4YkdrVlyEggPhIwLmr9tib7AG/o4mpfpBC3dJk+u3g2A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=AIjqCNjF; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 1.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=AIjqCNjF; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 631502AF5F X-Spam-Score: 1.03 X-Migadu-Scanner: scn1.migadu.com X-TUID: UvQEif4Qq10t * 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))))))) -- 2.32.0