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 iP6SMSLwu2HcNAEAgWs5BA (envelope-from ) for ; Fri, 17 Dec 2021 03:04:18 +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 CHFPLSLwu2HYdgAAB5/wlQ (envelope-from ) for ; Fri, 17 Dec 2021 02:04:18 +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 41C5635399 for ; Fri, 17 Dec 2021 03:04:18 +0100 (CET) Received: from localhost ([::1]:50188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1my2bZ-0002cd-GT for larch@yhetil.org; Thu, 16 Dec 2021 21:04:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1my2bK-0002c7-Qq for guix-patches@gnu.org; Thu, 16 Dec 2021 21:04:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:53947) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1my2bK-0007NM-Fn for guix-patches@gnu.org; Thu, 16 Dec 2021 21:04:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1my2bK-000511-Bc for guix-patches@gnu.org; Thu, 16 Dec 2021 21:04:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v5 01/45] gnu: node: Avoid duplicating build phases. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Dec 2021 02:04: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.163970663219239 (code B ref 51838); Fri, 17 Dec 2021 02:04:02 +0000 Received: (at 51838) by debbugs.gnu.org; 17 Dec 2021 02:03:52 +0000 Received: from localhost ([127.0.0.1]:37256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1my2bA-00050E-3B for submit@debbugs.gnu.org; Thu, 16 Dec 2021 21:03:52 -0500 Received: from mail-qk1-f172.google.com ([209.85.222.172]:35610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1my2b7-0004zt-VE for 51838@debbugs.gnu.org; Thu, 16 Dec 2021 21:03:50 -0500 Received: by mail-qk1-f172.google.com with SMTP id m192so808798qke.2 for <51838@debbugs.gnu.org>; Thu, 16 Dec 2021 18:03:49 -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=9G9JU5GMY9JQ9bis8V5NVUyL/WQZGAwZPgOXXsTKZr0=; b=hVh4HV1eurOxd4CA/yrrMhG1LBe+NrthbQ75v58TGUOeMLtool20eeXAT8rBZJOYT8 nj5qIlHJX/SH8Abf1MCKZqk1XhrRlmGvgeZSv75RQUQpHWa6aiEQtbYOt9nR/m2vgwyA FcpkKUYetCMf+fkFGMftLk4KV04sWNnGSC7JkcIU6s1Y+AaBFJHLtLXezD8vSr9C2gtg OPlR9Wv1vOUg6mKOHzqFaiFohmQXHtkTSLlEVL2jjH/8Ug2AyLjENM2w3So2CoUOhKrP 9m/RoARm42vLpwNNqHTqzUEg8yt379UQCXNBaJngduDxuMg6+Zr9PsPzkFK7+RdttDW7 At+g== 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=9G9JU5GMY9JQ9bis8V5NVUyL/WQZGAwZPgOXXsTKZr0=; b=U4V1r7nVZYEy7UqT/+Klrw85JnWPG2+cuj65ZNMCHU6o84JXjUwVpI0xl7pPfuJk/j 3p9KPyX+LCiz9cKqY5yPXmlUIT/biry2v+swHcQ0cRUvR0knLvv+xYb+/Jc9J7hgLDg5 mTMnFe41H0SuFygdcf8jL8sQMn2j+gNmXZuh6NfkLhvUjZ9c14IJPmJsccqQKHgbBeRP fGYSpv1Hw9XnF/RtScu2fuq1N9P6DLAqoShiFWLWqM8dQgck9bkPF7cz71cIPCgeft2f QoK5Iq3Dey1iCp4g3vfd6rkOuW2UA7eE7CjIYio4XMVoeytwP+0FWbo52Mc1p08XM8li 1/OQ== X-Gm-Message-State: AOAM531SCHu1LiA+Lu71zTtEkbOQHglWy9qq/uwljmiaWRKMGLPQcFl/ hQJblfRkpCt5NwIFmlcP1lgM9kPyQlEfaieHTc4= X-Google-Smtp-Source: ABdhPJzbhT39NukABPzYXwPHhZV3G5DUerHnbh4wDmOKu8dTWVa5uQLdwaduWK+k0viXpTJNIt+dRQ== X-Received: by 2002:a05:620a:108d:: with SMTP id g13mr557486qkk.338.1639706624261; Thu, 16 Dec 2021 18:03:44 -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 l14sm3736558qki.133.2021.12.16.18.03.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Dec 2021 18:03:44 -0800 (PST) From: Philip McGrath Date: Thu, 16 Dec 2021 21:02:41 -0500 Message-Id: <20211217020325.520821-2-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-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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1639706658; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=9G9JU5GMY9JQ9bis8V5NVUyL/WQZGAwZPgOXXsTKZr0=; b=QF9T7i7IGt4k/xfPi7vOfYAZPxlUWLbzAHC74iRIT3+AuLJOEwIlHEWjT8WdHueEyOQBs7 Pb1uEIXHjzsNkfXdzd/TTIyMCWjRkLqLmlTqhP8iJyeEIpvLyFQ3OOA2Tfz5k/gTmHXQoq DStcwAUeSJ9zJ8lksSP7x+Gx35Q/xJvPT+NgsI+XxxId44T2qE6hkukVniovLZNyqfW/Y8 oGxjXMhIBdDF3WzGjJ+JNyfh/gmczPyvTgeZfYzsuFculNrEkQ+yPKxmhj+oPSrLaOrEbF lJLKIZ2FuXJ8F6ZiifMGOyc7r9I4AcaF6I1LyOmupPT9opEz2KeKvMqXXRXvbg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1639706658; a=rsa-sha256; cv=none; b=p+phGvKW7kgS5pLQVhFbNiw/bS3u7UBC8zhkXfrrxcwl0tnBqYs4qMU1hQEL13EZT++sdp aD8fD15ekGH2wKmklXEQ6mpKimsC5je+aMvWAfRwWv+QGt85PGjgwfNFmP0KWeqSRvljKQ miBDhZ74X9bC52VdIeL/tIP0+Qp4230endZsMxl+VrHG+mlFsN4YYlrkw7lEopYPgXAYeE GyJRknICtWlsx5qY/zzGMOud3hsDwdmq+IjCl67w8K5GeXZyeVUJV3loyoSvWNAbgC/fp/ AHRjzB1McFBt6lNBkk7Y9hj9Gq+cuQdDQsx4uNY/cgMuSMV1VN8fbM9ky0E7xw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=hVh4HV1e; 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=hVh4HV1e; 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: 41C5635399 X-Spam-Score: -0.49 X-Migadu-Scanner: scn0.migadu.com X-TUID: 33+QHWq2Xkij * 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 | 107 ++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 72 deletions(-) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index 6b543acf6f..1635df5b1a 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2020 Ricardo Wurmus ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2021 Guillaume Le Vaillant +;;; Copyright © 2021 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -106,14 +107,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'"))) @@ -123,7 +132,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. @@ -218,9 +230,16 @@ (define-public node (setenv "CXX" ,(cxx-for-target)) (setenv "PKG_CONFIG" ,(pkg-config-for-target)) (apply invoke - (search-input-file (or native-inputs inputs) - "/bin/python") - "configure" flags)))) + (let ((inpts (or native-inputs inputs))) + (with-exception-handler + (lambda (e) + (if (search-error? e) + (search-input-file inpts "/bin/python3") + (raise-exception e))) + (lambda () + (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") @@ -256,7 +275,7 @@ (define-public node (variable "NODE_PATH") (files '("lib/node_modules"))))) (inputs - (list bash + (list bash-minimal coreutils c-ares http-parser @@ -705,65 +724,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 - (search-input-file (or native-inputs inputs) - "/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 @@ -802,8 +764,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") @@ -830,7 +793,7 @@ (define-public node-lts python util-linux)) (inputs - (list bash + (list bash-minimal coreutils c-ares-for-node icu4c-67 -- 2.32.0