From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id TDkGCI7wu2GpNgEAgWs5BA (envelope-from ) for ; Fri, 17 Dec 2021 03:06:06 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id UJ4JA47wu2HrbgAAbx9fmQ (envelope-from ) for ; Fri, 17 Dec 2021 02:06:06 +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 BC2E5353AB for ; Fri, 17 Dec 2021 03:06:05 +0100 (CET) Received: from localhost ([::1]:51620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1my2dI-0003oE-Ts for larch@yhetil.org; Thu, 16 Dec 2021 21:06:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1my2cJ-00036R-TE for guix-patches@gnu.org; Thu, 16 Dec 2021 21:05:14 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:53985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1my2cI-0007YB-Dk for guix-patches@gnu.org; Thu, 16 Dec 2021 21:05:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1my2cI-00055H-6I for guix-patches@gnu.org; Thu, 16 Dec 2021 21:05:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v5 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: Fri, 17 Dec 2021 02:05: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.163970664919324 (code B ref 51838); Fri, 17 Dec 2021 02:05:02 +0000 Received: (at 51838) by debbugs.gnu.org; 17 Dec 2021 02:04:09 +0000 Received: from localhost ([127.0.0.1]:37265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1my2bQ-00051b-QA for submit@debbugs.gnu.org; Thu, 16 Dec 2021 21:04:09 -0500 Received: from mail-qt1-f178.google.com ([209.85.160.178]:38515) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1my2bM-00050U-Q6 for 51838@debbugs.gnu.org; Thu, 16 Dec 2021 21:04:05 -0500 Received: by mail-qt1-f178.google.com with SMTP id 8so1196916qtx.5 for <51838@debbugs.gnu.org>; Thu, 16 Dec 2021 18:04:04 -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=QueHgRoKFRxviTVu8gMv/hUHJMXaPMpsFH0B0TaseE8=; b=RyH8f3aIxPUvyOP81Zh7AmKDP5JMbBSan2R/MeAqzOLpxkw/Zrj3nfIwwde7L7kUdG Ayy9fwab1XPTgmXg3L5F70EjfiQmqswlJd4FYvLJSHrPl+uRVb73Citu3HWPYm1jvkZa Qzo9QC3rRdbdYvQ01oJ6pdQy1IlZ9KLbkf1M7CHndMq/NTzS3/BdMM7K0qZr3Q1kCLg+ lNIosW2o6sLsbs8RniB7mCqO6v2M7/zAl9SZ31SsBby/pw1R9GnIpoIKxvnWMN/kzfz4 md7o2JfMwT/4VfhBmF1jgOzwPLSjNj4Etc+7OXGAgdEou2P0xqzZjv3fg1LAmUq0JhlV s70Q== 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=QueHgRoKFRxviTVu8gMv/hUHJMXaPMpsFH0B0TaseE8=; b=et7hgVbHoE0OU8Mz0Q+DwpvfnB0IIfqAsjzfMOzUXNfEz1yyk05mwOhfQZhJ+0AV6a WcnVs7nnqBnO1N6JoR+jSdhvR0JLwgVGNqkBRB8exVPWaHLzjOTWapPDo4/1wPkmh7XR IpwVNAVH0Fuv5b1Wz3qba2LGrR2Fy1cOGaCpFksdl5mjqanLStbiuyMWkP7Odf7hp2qW lU4fYOd6ioSsJuAJU6QqLCgvGo3w9zj1F2UknESm04fqCUSbQr36wewwYMadYlcs1hhm Yib7aYAWpnjYT0fgaRgDPIy3zCGExn4ZZMDCi6J8jTrNuOv8jSbcpWv45ErivMBoOA/J JL8w== X-Gm-Message-State: AOAM530MCZN2j3PTltsoxgq4tcVtm3GagT0gfe5GXlsoldLpxIlneE8I gJbufmPVODDCeR1/wAiKRxxbl9H6J77PC1dWA2c= X-Google-Smtp-Source: ABdhPJx8/QfYR/UWC+MOh5UOrxxOFbSFmyXpbzMv/RzlzMtBAXuobY1kGVvFuAcnvbrR7FpCvGuHnQ== X-Received: by 2002:ac8:5dc9:: with SMTP id e9mr733729qtx.12.1639706639351; Thu, 16 Dec 2021 18:03:59 -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 v5sm5317514qtc.60.2021.12.16.18.03.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Dec 2021 18:03:59 -0800 (PST) From: Philip McGrath Date: Thu, 16 Dec 2021 21:02:43 -0500 Message-Id: <20211217020325.520821-4-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211217020325.520821-1-philip@philipmcgrath.com> References: <20211213060107.129223-1-philip@philipmcgrath.com> <20211217020325.520821-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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1639706765; 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=QueHgRoKFRxviTVu8gMv/hUHJMXaPMpsFH0B0TaseE8=; b=Yeg92Yaj1oLx6RLOUXWsne+T9vAtMyGgxwf1yIozc22UgZ4Z/kCsxRn+lUpXkf/yhpTJyy lOHi6rdYBGprbAsLceP4UpQuOXcw7WE+ics5/JZhX9115oQhtwGAj4Z5zlgIfdtbJkKuT9 si0JWfvokt8WhyDBAndlPTbAknHCi5WbXoNdslX7Sj7oKtusOpgszeSEVGO0EOR5Nx+yRc O8l2KCcomVxRan1OTlE+0wn7oZ9Gb7tzJx8NFqok16XDyZ/lKjGrOF2XgFWEjNRp2oHD1s kUiGdgYwkMLKOgun6/KrLbBTday6sSR/PQmleAD8Gd/wFmZdsu+tp8i4Kgh6Fg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1639706765; a=rsa-sha256; cv=none; b=PZo9sQ/pYCTXeiuyJkhN03RNd4MGl89OKq7hfq8gXkwLGjVyY/b370MNGAfqw18MVWOZHT 1cVvrrouyPsv6TV3j+VcIlqCkHBSJ+8u5yE2KXSautFAEnCT5P0K+eKiVbMDc0fGwrNcyb AB5/un6fnt+phTAhskpE1KU/AS1hxYqSpAMZtYw0FP8NA8gzg5tiV5B3EUvPEveDbL8ody tFk/PrHCusfKxVrM7ZjkUn0apDeFLzGpnl8Lkza28i4/9YxLjHPuDPyNmwf2RZ556Uz5xo mCKnSU+Q5K7tgb3zGEZ0L0+fCP7R3FeQ/SnvNFCzFOOWFcVms8GJ7PZAcSS9vg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=RyH8f3aI; 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: -0.49 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=RyH8f3aI; 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: BC2E5353AB X-Spam-Score: -0.49 X-Migadu-Scanner: scn0.migadu.com X-TUID: TJ/Dh/3AnKPN * 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 | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index d433118213..3bd98c715e 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -105,6 +105,11 @@ (define-public node ;; Run only the CI tests. The default test target requires additional ;; add-ons from NPM that are not distributed with the source. #:test-target "test-ci-js" + #:modules + ((guix build gnu-build-system) + (guix build utils) + (srfi srfi-1) + (ice-9 match)) #:phases (modify-phases %standard-phases (add-before 'configure 'patch-hardcoded-program-references @@ -240,21 +245,23 @@ (define-public node (search-input-file inpts "/bin/python")))) "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) + ;; Based on the implementation of patch-shebangs + ;; from (guix build gnu-build-system). + (let ((path (append-map (match-lambda + ((_ . dir) + (list (string-append dir "/bin") + (string-append dir "/sbin") + (string-append dir "/libexec")))) + (append outputs inputs)))) + (for-each + (lambda (file) + (patch-shebang file path)) + (find-files (search-input-directory outputs "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) @@ -283,6 +290,7 @@ (define-public node libuv `(,nghttp2 "lib") openssl + python-wrapper ;; for node-gyp (supports python3) zlib)) (synopsis "Evented I/O for V8 JavaScript") (description "Node.js is a platform built on Chrome's JavaScript runtime @@ -802,6 +810,7 @@ (define-public node-lts brotli `(,nghttp2 "lib") openssl + python-wrapper ;; for node-gyp (supports python3) zlib)))) (define-public libnode @@ -813,5 +822,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