From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uJtdK50VsWF1hAEAgWs5BA (envelope-from ) for ; Wed, 08 Dec 2021 21:29:17 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id mFEhJ50VsWFCIQAAB5/wlQ (envelope-from ) for ; Wed, 08 Dec 2021 20:29:17 +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 124999105 for ; Wed, 8 Dec 2021 21:29:17 +0100 (CET) Received: from localhost ([::1]:43386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mv3Yy-0005Lm-6p for larch@yhetil.org; Wed, 08 Dec 2021 15:29:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mv3Yj-0005LU-UG for guix-patches@gnu.org; Wed, 08 Dec 2021 15:29:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58241) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mv3Yj-0000Av-Mv for guix-patches@gnu.org; Wed, 08 Dec 2021 15:29:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mv3Yj-0005pM-Ie for guix-patches@gnu.org; Wed, 08 Dec 2021 15:29:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v3 01/43] gnu: node: Avoid duplicating build phases. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 08 Dec 2021 20:29:01 +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.163899533022289 (code B ref 51838); Wed, 08 Dec 2021 20:29:01 +0000 Received: (at 51838) by debbugs.gnu.org; 8 Dec 2021 20:28:50 +0000 Received: from localhost ([127.0.0.1]:41531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv3YX-0005nE-JF for submit@debbugs.gnu.org; Wed, 08 Dec 2021 15:28:50 -0500 Received: from mail-vk1-f179.google.com ([209.85.221.179]:42630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv3YU-0005mp-E8 for 51838@debbugs.gnu.org; Wed, 08 Dec 2021 15:28:48 -0500 Received: by mail-vk1-f179.google.com with SMTP id s1so2354682vks.9 for <51838@debbugs.gnu.org>; Wed, 08 Dec 2021 12:28:46 -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=KH4RQSW2Vl/+hSZ71LTsM4xePvjwFAevZ9cxlfrinCQ=; b=JscCN3sEM/eNw5Es+e2WaisMG8DVr4sztCMj8CQqfwaZlbY3qw+qz9/s8pTDbwDSTF aXdAqL5Zklc+g6rCS8aa17Qrp66OmNpswSEUyisW2vtX1ggAOIb7UnxuF10M93OVGE6K mDyOSHcOPoteBUPxKBn0Lf3nkzJ5TkOiboxHhfzopV7nuqoMAbVBJdcXs6GhUdtRC1Lo TwvrO0OSR2A9AhqQyjwMWAfA7NfoWJgFyIRI032yS3EcFhk9elOe2RbBneej0ntKJzzD oJw2vCMHzUcRGu4+T2S3NL2h9S17tQJqLnu2lrE8ObipzUCAYqVsD9PgChfon77y6An5 oO9Q== 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=KH4RQSW2Vl/+hSZ71LTsM4xePvjwFAevZ9cxlfrinCQ=; b=U0jKWdk1B195/a3syqkXdiSYcq/JwkIqQfQqDg6YbScte5YatNsvUDeaHrYNkuqarz /ISwuoueWbEAWksMC0dYgneGcLNPKRT8/40nPYuVFacFcOO9DiXWHWnTppCXN8s6rLC8 s7pN86UNSroMOy626BLjMGwt9XIwiqe0oPGnGShbfYhm2uT4MAWElQLxOIldJGsJatxu LPlKTHlFZ4+FuYf16jF9gp8PD/F3bEpWsFvugR/EvuUa6jjfeTf70h+BcjqJKGZ4yGkZ MdUMZA3xr+2XM5QbMwmH+IDbw/ooPqhKdqsvl9HIPBd/phDwF3HgfEOqWJd+8kpLQ7Nq FZGA== X-Gm-Message-State: AOAM533wF5DjqxAaeokorPxJB/88jj2mRQJJreYl9fAqpR/dxuWxbfFQ 4aemdfTCjcogUnKX6ZUrehYsaycm3iTBK1pk9oM= X-Google-Smtp-Source: ABdhPJz2oSEXYCxOhM/StskfGj4eFLmSZUgqDZTKltmdPWE7Mhuy6F7b/OYC1oSojp1pCHHtoctJ3A== X-Received: by 2002:a05:6122:920:: with SMTP id j32mr1281166vka.20.1638995320742; Wed, 08 Dec 2021 12:28:40 -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 w17sm2525134uar.18.2021.12.08.12.28.40 for <51838@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Dec 2021 12:28:40 -0800 (PST) From: Philip McGrath Date: Wed, 8 Dec 2021 15:27:56 -0500 Message-Id: <20211208202838.752542-2-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 Content-Type: text/plain; charset=UTF-8 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=1638995357; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: 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=KH4RQSW2Vl/+hSZ71LTsM4xePvjwFAevZ9cxlfrinCQ=; b=t0J7bmVaaS2Rjb1PIxaH3jtaDN82Q/Ve/XvTbVt0816ozmMFgqQPbyUVVhWTq6hdeKdRhq wIb4ao3Yq4DyxbOxKkjUg87yZ8hxwxQUNTRfHYKySUOzEU7k3xd/JFwr96AMNjnpc3qY24 Ak0tYhJsI1ytVakdYUlu9zPaXthm7p0DJyqHO2PdkLQ/twMbKVPKWXK9wb5Bj+F6CbTon0 nucvU9kB/mZwDPJFtcgyV1l/by1MPIH3vXcNKxx20ApoLuwKrsugYJG25SXYSG/4DJ3GXm qi6wfYZTcGSKeF60yyXkNza+PmR/tS4AR38Fs+jkrYGKQUgQj+e2YxIwD9hw4Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638995357; a=rsa-sha256; cv=none; b=QAF9sj7YJXh+A+UTJ/xFgKuC9LwhLNKNgMo2+JHf3XqEhCyGl8Fzb/RinOV7bOVxfP+1W2 kIaF6gKILxj9yZ+icAAikgBdxDYcic1cjgabZ1XmS7rGVKBEtdrjMp0c7sX+cq9bXOSNgi RtnGwLijmi+v5mWmw9Xc3CE6TcAUveD7iaYvFdn6izhUmz0lkstErIAFmnwBJAp5rFYy06 OrLxkt0u0SaVgSI/ie9LecZ9dOnw2Ory98cJsPeHKNMdDG8T9xScGhgR6dI3JEJ6d0dCY+ 3V+eWOSikfiMZSgGs2d0Pdxp2bX7QrAaklGW21Y1hIDUaRjvZOjTCwmYgqgesw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=JscCN3sE; 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.95 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=JscCN3sE; 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: 124999105 X-Spam-Score: -0.95 X-Migadu-Scanner: scn1.migadu.com X-TUID: 4ShYnEIjA/76 * 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) -- 2.32.0