From patchwork Mon Dec 13 06:00:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 35156 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 35BDD27BBEA; Mon, 13 Dec 2021 06:03:17 +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 8C79527BBE9 for ; Mon, 13 Dec 2021 06:03:16 +0000 (GMT) Received: from localhost ([::1]:39424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mweQd-0000ph-Ku for patchwork@mira.cbaines.net; Mon, 13 Dec 2021 01:03:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mweQQ-0000o2-Jr for guix-patches@gnu.org; Mon, 13 Dec 2021 01:03:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42156) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mweQQ-00074F-AV for guix-patches@gnu.org; Mon, 13 Dec 2021 01:03:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mweQQ-0002RD-70 for guix-patches@gnu.org; Mon, 13 Dec 2021 01:03:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v4 01/45] gnu: node: Avoid duplicating build phases. 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.16393753479220 (code B ref 51838); Mon, 13 Dec 2021 06:03:02 +0000 Received: (at 51838) by debbugs.gnu.org; 13 Dec 2021 06:02:27 +0000 Received: from localhost ([127.0.0.1]:53679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwePq-0002Oe-Es for submit@debbugs.gnu.org; Mon, 13 Dec 2021 01:02:26 -0500 Received: from mail-ua1-f49.google.com ([209.85.222.49]:39725) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwePo-0002OR-Ma for 51838@debbugs.gnu.org; Mon, 13 Dec 2021 01:02:25 -0500 Received: by mail-ua1-f49.google.com with SMTP id i6so27290313uae.6 for <51838@debbugs.gnu.org>; Sun, 12 Dec 2021 22:02:24 -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=KH4RQSW2Vl/+hSZ71LTsM4xePvjwFAevZ9cxlfrinCQ=; b=epdTGtFKodUCbiaUAIG3/UEftiYqjs20zX1g1EJQ9VLRvb/MA/Nlyej4ngml2q7mYP YXxjFZXiny1azlfHx1C82xLp2/Pnroz9kl6mWxiGSa31+amjyYzgNjXHwpSX9AEnltyw pYqFkC9XWLgSeLNS0RAj7far7+7CGru+z7/Plj2nxhHMv8a8rygbmqThoj9AT2scAiaa +V/AwJ0+ZKMtdNTmY5/YMtzNO1ajgyN5cNkkumiFmAwT8yfqNqX5Y6717gf8fy2Qso/M FuHndST4OPHsHv9VToiJ/iqvV9cQ0PFK7BKyhDjUJW03pqrPGCSJlNZMCBRVwfD80AW4 bRrA== 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=KH4RQSW2Vl/+hSZ71LTsM4xePvjwFAevZ9cxlfrinCQ=; b=cBo4zxy4TeEIpBhIDfjyaO13SAq+vrA17UQUL/NlMuCUL17aACyRH8K/xdLfyBqjYG 69dO84/qjTqvDN3DozLzdC5kNbmkq377kFqdVZ30GBUgVHgM/kkHWOFoCmGRxlA+h4c6 Ul4g6r3JHUceRb2FRSO1T7gEwxK1jem/FeEUdWVQ/kNHkKBrB6jG/uDHqFPr1SGPNBSq lpYGHia34Bl734+s6TUqQ552cDNvQN+pJd2O2s3WG4FyVITOLTYFHGqPZhYthiitX7dU AWw4K3yqFRZgwS6f8ZCIbvwD7wpTLDDTZCIEqO0JkYivNiwBQaCv0Zk0pGidmqZb0Exl a8/w== X-Gm-Message-State: AOAM531Nyqr0b2qj3P5TTZvtO68DXgrTSuDdF/Tw9u43XRcoCtSPSh+u kdvO8sp0LqWYXNDSxkV4g+6BBYrqNV03MWvp4UY= X-Google-Smtp-Source: ABdhPJwJMxIIbSojcStIh5zpJF8/LXaGtnJCBASC5Pghb+Z5fk3GfuPA4OUSuEnDI7ZUXl/gmDFLig== X-Received: by 2002:ab0:7784:: with SMTP id x4mr39592518uar.143.1639375338996; Sun, 12 Dec 2021 22:02:18 -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 92sm3901425uav.9.2021.12.12.22.02.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Dec 2021 22:02:18 -0800 (PST) From: Philip McGrath Date: Mon, 13 Dec 2021 01:00:23 -0500 Message-Id: <20211213060107.129223-2-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]: Split 'patch-files phase into 'patch-hardcoded-program-references and 'delete-problematic-tests. Adapt 'patch-hardcoded-program-references and 'configure to work unmodified on node-lts, but don't try to share 'delete-problematic-tests, because those details seem to change too much between node versions. (node, node-lts)[inputs]: Use bash-minimal rather than bash. (node-lts)[arguments]: Inherit 'patch-hardcoded-program-references, and 'configure phases from the bootstrap node. Remove the 'patch-files phase, keeping its remaining non-inherited work in a new 'replace-llhttp-sources phase. --- gnu/packages/node.scm | 105 +++++++++++++----------------------------- 1 file changed, 32 insertions(+), 73 deletions(-) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index dccf871d2c..7ebbbc3060 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2020, 2021 Pierre Langlois ;;; Copyright © 2020 Ricardo Wurmus ;;; Copyright © 2021 Simon Tournier +;;; Copyright © 2021 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -105,14 +106,22 @@ (define-public node #:test-target "test-ci-js" #:phases (modify-phases %standard-phases - (add-before 'configure 'patch-files + (add-before 'configure 'patch-hardcoded-program-references (lambda* (#:key inputs #:allow-other-keys) + ;; Fix hardcoded /bin/sh references. - (substitute* '("lib/child_process.js" - "lib/internal/v8_prof_polyfill.js" - "test/parallel/test-child-process-spawnsync-shell.js" - "test/parallel/test-stdio-closed.js" - "test/sequential/test-child-process-emfile.js") + (substitute* + (let ((common + '("lib/child_process.js" + "lib/internal/v8_prof_polyfill.js" + "test/parallel/test-child-process-spawnsync-shell.js" + "test/parallel/test-stdio-closed.js" + "test/sequential/test-child-process-emfile.js")) + ;; not in bootstap node: + (sigxfsz "test/parallel/test-fs-write-sigxfsz.js")) + (if (file-exists? sigxfsz) + (cons sigxfsz common) + common)) (("'/bin/sh'") (string-append "'" (assoc-ref inputs "bash") "/bin/sh'"))) @@ -122,7 +131,10 @@ (define-public node "test/parallel/test-child-process-exec-env.js") (("'/usr/bin/env'") (string-append "'" (assoc-ref inputs "coreutils") - "/bin/env'"))) + "/bin/env'"))))) + (add-after 'patch-hardcoded-program-references + 'delete-problematic-tests + (lambda* (#:key inputs #:allow-other-keys) ;; FIXME: These tests fail in the build container, but they don't ;; seem to be indicative of real problems in practice. @@ -217,9 +229,13 @@ (define-public node (setenv "CXX" ,(cxx-for-target)) (setenv "PKG_CONFIG" ,(pkg-config-for-target)) (apply invoke - (string-append (assoc-ref (or native-inputs inputs) - "python") - "/bin/python") + (let ((python + (string-append (assoc-ref (or native-inputs inputs) + "python") + "/bin/python"))) + (if (file-exists? python) + python + (string-append python "3"))) "configure" flags)))) (add-after 'patch-shebangs 'patch-npm-shebang (lambda* (#:key outputs #:allow-other-keys) @@ -256,7 +272,7 @@ (define-public node (variable "NODE_PATH") (files '("lib/node_modules"))))) (inputs - `(("bash" ,bash) + `(("bash" ,bash-minimal) ("coreutils" ,coreutils) ("c-ares" ,c-ares) ("http-parser" ,http-parser) @@ -712,66 +728,8 @@ (define-public node-lts libuv "/lib:" zlib "/lib" "'],")))))) - (replace 'configure - ;; Node's configure script is actually a python script, so we can't - ;; run it with bash. - (lambda* (#:key outputs (configure-flags '()) native-inputs inputs - #:allow-other-keys) - (let* ((prefix (assoc-ref outputs "out")) - (xflags ,(if (%current-target-system) - `'("--cross-compiling" - ,(string-append - "--dest-cpu=" - (match (%current-target-system) - ((? (cut string-prefix? "arm" <>)) - "arm") - ((? (cut string-prefix? "aarch64" <>)) - "arm64") - ((? (cut string-prefix? "i686" <>)) - "ia32") - ((? (cut string-prefix? "x86_64" <>)) - "x64") - ((? (cut string-prefix? "powerpc64" <>)) - "ppc64") - (_ "unsupported")))) - ''())) - (flags (cons - (string-append "--prefix=" prefix) - (append xflags configure-flags)))) - (format #t "build directory: ~s~%" (getcwd)) - (format #t "configure flags: ~s~%" flags) - ;; Node's configure script expects the CC environment variable to - ;; be set. - (setenv "CC_host" "gcc") - (setenv "CXX_host" "g++") - (setenv "CC" ,(cc-for-target)) - (setenv "CXX" ,(cxx-for-target)) - (setenv "PKG_CONFIG" ,(pkg-config-for-target)) - (apply invoke - (string-append (assoc-ref (or native-inputs inputs) - "python") - "/bin/python3") - "configure" flags)))) - (replace 'patch-files + (replace 'delete-problematic-tests (lambda* (#:key inputs #:allow-other-keys) - ;; Fix hardcoded /bin/sh references. - (substitute* '("lib/child_process.js" - "lib/internal/v8_prof_polyfill.js" - "test/parallel/test-child-process-spawnsync-shell.js" - "test/parallel/test-fs-write-sigxfsz.js" - "test/parallel/test-stdio-closed.js" - "test/sequential/test-child-process-emfile.js") - (("'/bin/sh'") - (string-append "'" (assoc-ref inputs "bash") "/bin/sh'"))) - - ;; Fix hardcoded /usr/bin/env references. - (substitute* '("test/parallel/test-child-process-default-options.js" - "test/parallel/test-child-process-env.js" - "test/parallel/test-child-process-exec-env.js") - (("'/usr/bin/env'") - (string-append "'" (assoc-ref inputs "coreutils") - "/bin/env'"))) - ;; FIXME: These tests fail in the build container, but they don't ;; seem to be indicative of real problems in practice. (for-each delete-file @@ -810,8 +768,9 @@ (define-public node-lts ;; TODO: Regenerate certs instead. (for-each delete-file '("test/parallel/test-tls-passphrase.js" - "test/parallel/test-tls-server-verify.js")) - + "test/parallel/test-tls-server-verify.js")))) + (add-after 'delete-problematic-tests 'replace-llhttp-sources + (lambda* (#:key inputs #:allow-other-keys) ;; Replace pre-generated llhttp sources (let ((llhttp (assoc-ref inputs "llhttp"))) (copy-file (string-append llhttp "/src/llhttp.c") @@ -838,7 +797,7 @@ (define-public node-lts ("python" ,python) ("util-linux" ,util-linux))) (inputs - `(("bash" ,bash) + `(("bash" ,bash-minimal) ("coreutils" ,coreutils) ("c-ares" ,c-ares-for-node) ("icu4c" ,icu4c-67)