From patchwork Thu Sep 30 22:56:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 33476 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 73E3127BBE3; Thu, 30 Sep 2021 23:59:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CB64927BBE1 for ; Thu, 30 Sep 2021 23:59:09 +0100 (BST) Received: from localhost ([::1]:37224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mW51A-0008Qv-Ln for patchwork@mira.cbaines.net; Thu, 30 Sep 2021 18:59:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mW514-0008QZ-80 for guix-patches@gnu.org; Thu, 30 Sep 2021 18:59:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42740) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mW514-0000k7-0u for guix-patches@gnu.org; Thu, 30 Sep 2021 18:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mW513-0000d4-WF for guix-patches@gnu.org; Thu, 30 Sep 2021 18:59:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH 1/3] gnu: node: Avoid duplicating build phases. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Sep 2021 22:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49946@debbugs.gnu.org Cc: Pierre Langlois , Maxime Devos , Philip McGrath Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.16330427412411 (code B ref 49946); Thu, 30 Sep 2021 22:59:01 +0000 Received: (at 49946) by debbugs.gnu.org; 30 Sep 2021 22:59:01 +0000 Received: from localhost ([127.0.0.1]:54286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW512-0000cp-Er for submit@debbugs.gnu.org; Thu, 30 Sep 2021 18:59:00 -0400 Received: from mail-qt1-f180.google.com ([209.85.160.180]:44009) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW510-0000cb-7u for 49946@debbugs.gnu.org; Thu, 30 Sep 2021 18:58:59 -0400 Received: by mail-qt1-f180.google.com with SMTP id a13so7290898qtw.10 for <49946@debbugs.gnu.org>; Thu, 30 Sep 2021 15:58:58 -0700 (PDT) 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=MycQHhB6Tae9cF8f5+uyJE1zoQYz4DNSrnHhFvr65MM=; b=VJfoDUPu1FCcpHKOLexzvMpa4/MPPWQPjwkVe3cVElLjosZqT4dymttirkgiUUdnSk WyJZHJ/2nNPv3CL20A9P7kNsfZNR+5p8ALzcFlDoWQ/ydjiZo6HhyDovmePUAMLa0DVj 0ePjU7T/ohXYl4cfJ8wJlzFLtT6BMd1devyPLTdfZ9gR97kTKOesjlt1DdLDAZ6c9Ive DXBxuz/He/OB7i4r5iVGLA8/PG/UAcYUv2JAv52/tjG6U5fFxPwPl5CbZTHNdvmLk3u6 NYQSulqb0TKKqcc127KYa4TQ43e+Ej1K2YKo0KkfY52q+5yr0DRUEVw+qZm3cGOlpuWM lnPw== 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=MycQHhB6Tae9cF8f5+uyJE1zoQYz4DNSrnHhFvr65MM=; b=ir0uwtsga0ZIQGJMBzQ7IwYfkLqfkFPtC2tWJMT6UcT3i6DsCfeKf+MC35WlPshEkM LyTDRcLHQlhqHCQY2sLFtER07oN3afXVseYpmiyj2Pg8PtfBW4NNpAs1/6rx4r5OSPZL ofbF/eArczKOs+8HvXbbXCNT1C1wriHlOVtUNVNZzxsCwz42mSfiDirdIQwpG8sFiod8 wKXEVLsUhw0Q6r+gG4QDsgU89mIQW8Fppap6fqoJKqG1LLQQ5QGxe5dDTQx6WH4elGdY +0bH/2x4KNADz2UJXQuoWDimnEPM2SoNDVYHbGV4xkKkLicY3/Xl4SeifN4LSgeQrBQt Ch3Q== X-Gm-Message-State: AOAM53018PtxfUE/F1mui1dcsReIRubiUiymsdwkW39PrOArQF8C4o5Q YyVig+bqoloNbrom5Fw4Z3aW8xg5Xf1fvM+f X-Google-Smtp-Source: ABdhPJydDbz9Y/Iz9hMZbuyaDyxQx52UxsJaoRI6/sWGmsUz/QgrUZBnPUNYjuInn8TzjhFN6ovExA== X-Received: by 2002:aed:2794:: with SMTP id a20mr9432174qtd.243.1633042732508; Thu, 30 Sep 2021 15:58:52 -0700 (PDT) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with ESMTPSA id z19sm2268817qts.96.2021.09.30.15.58.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Sep 2021 15:58:52 -0700 (PDT) From: Philip McGrath Date: Thu, 30 Sep 2021 18:56:10 -0400 Message-Id: <20210930225611.2143194-2-philip@philipmcgrath.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210930225611.2143194-1-philip@philipmcgrath.com> References: <682f2ed3-90bd-a9f8-1193-34bef399ca62@philipmcgrath.com> <87h7fztt60.fsf@gmx.com> <20210808233354.6745-1-pierre.langlois@gmx.com> <20210808233354.6745-8-pierre.langlois@gmx.com> <42e10baddb6afe308f67c3240bf5da8159e6f118.camel@telenet.be> <87o88gq5p5.fsf@gmx.com> <20210930225611.2143194-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 those phases and 'configure to work unmodified on node-lts. (node, node-lts)[inputs]: Use bash-minimal rather than bash. (node-lts)[arguments]: Inherit 'patch-hardcoded-program-references, 'delete-problemating-tests, 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 | 150 +++++++++++------------------------------- 1 file changed, 39 insertions(+), 111 deletions(-) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index f8ac95884c..34c2bfa9d4 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 @@ #: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,18 +131,28 @@ "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) + (define (delete-file-if-exists pth) + (when (file-exists? pth) + (delete-file pth))) ;; 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 + (for-each delete-file-if-exists '("test/parallel/test-cluster-master-error.js" "test/parallel/test-cluster-master-kill.js" ;; See also . + ;; (no longer exists in node-lts) "test/sequential/test-performance.js")) - ;; This requires a DNS resolver. - (delete-file "test/parallel/test-dns.js") + ;; These require a DNS resolver. + (for-each delete-file-if-exists + '("test/parallel/test-dns.js" + ;; not in the bootstrap node: + "test/parallel/test-dns-lookupService-promises.js")) + ;; FIXME: This test fails randomly: ;; https://github.com/nodejs/node/issues/31213 @@ -217,9 +236,13 @@ (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 +279,7 @@ (variable "NODE_PATH") (files '("lib/node_modules"))))) (inputs - `(("bash" ,bash) + `(("bash" ,bash-minimal) ("coreutils" ,coreutils) ("c-ares" ,c-ares) ("http-parser" ,http-parser) @@ -711,103 +734,8 @@ source files.") 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 + (add-after 'delete-problematic-tests 'replace-llhttp-sources (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 - '("test/parallel/test-cluster-master-error.js" - "test/parallel/test-cluster-master-kill.js")) - - ;; These require a DNS resolver. - (for-each delete-file - '("test/parallel/test-dns.js" - "test/parallel/test-dns-lookupService-promises.js")) - - ;; FIXME: This test fails randomly: - ;; https://github.com/nodejs/node/issues/31213 - (delete-file "test/parallel/test-net-listen-after-destroying-stdin.js") - - ;; FIXME: These tests fail on armhf-linux: - ;; https://github.com/nodejs/node/issues/31970 - ,@(if (target-arm32?) - '((for-each delete-file - '("test/parallel/test-zlib.js" - "test/parallel/test-zlib-brotli.js" - "test/parallel/test-zlib-brotli-flush.js" - "test/parallel/test-zlib-brotli-from-brotli.js" - "test/parallel/test-zlib-brotli-from-string.js" - "test/parallel/test-zlib-convenience-methods.js" - "test/parallel/test-zlib-random-byte-pipes.js" - "test/parallel/test-zlib-write-after-flush.js"))) - '()) - - ;; These tests have an expiry date: they depend on the validity of - ;; TLS certificates that are bundled with the source. We want this - ;; package to be reproducible forever, so remove those. - ;; TODO: Regenerate certs instead. - (for-each delete-file - '("test/parallel/test-tls-passphrase.js" - "test/parallel/test-tls-server-verify.js")) - ;; Replace pre-generated llhttp sources (let ((llhttp (assoc-ref inputs "llhttp"))) (copy-file (string-append llhttp "/src/llhttp.c") @@ -834,7 +762,7 @@ source files.") ("python" ,python) ("util-linux" ,util-linux))) (inputs - `(("bash" ,bash) + `(("bash" ,bash-minimal) ("coreutils" ,coreutils) ("c-ares" ,c-ares) ("icu4c" ,icu4c-67) From patchwork Thu Sep 30 22:56:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 33477 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 60CAB27BBE3; Fri, 1 Oct 2021 00:00:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 27C4927BBE1 for ; Fri, 1 Oct 2021 00:00:25 +0100 (BST) Received: from localhost ([::1]:37576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mW52O-0000HU-98 for patchwork@mira.cbaines.net; Thu, 30 Sep 2021 19:00:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mW523-0000H3-07 for guix-patches@gnu.org; Thu, 30 Sep 2021 19:00:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mW522-0001eW-Mw for guix-patches@gnu.org; Thu, 30 Sep 2021 19:00:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mW522-0000fM-K7 for guix-patches@gnu.org; Thu, 30 Sep 2021 19:00:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH 2/3] gnu: node: Update to 10.24.1 for bootstrapping. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Sep 2021 23:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49946@debbugs.gnu.org Cc: Pierre Langlois , Maxime Devos , Philip McGrath Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.16330427602468 (code B ref 49946); Thu, 30 Sep 2021 23:00:02 +0000 Received: (at 49946) by debbugs.gnu.org; 30 Sep 2021 22:59:20 +0000 Received: from localhost ([127.0.0.1]:54290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW51M-0000dj-2e for submit@debbugs.gnu.org; Thu, 30 Sep 2021 18:59:20 -0400 Received: from mail-qk1-f178.google.com ([209.85.222.178]:46763) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW51J-0000dV-2i for 49946@debbugs.gnu.org; Thu, 30 Sep 2021 18:59:19 -0400 Received: by mail-qk1-f178.google.com with SMTP id b65so7419857qkc.13 for <49946@debbugs.gnu.org>; Thu, 30 Sep 2021 15:59:16 -0700 (PDT) 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=xIIEemZ8YowYTB74cFaQaWT8OHrrgh5qRh247bCYlQQ=; b=S4AYahNi1Mkr2s7IMLu0Q+K4wSKifgm9gRwtxUzCVVnOjCusdiAkMyGyoMmyK3c9hG uzsXFRjiZUV0M50YrEXFykAX/p8v+gqoQDjkPLu3PO3SdCroiOR9Exk4jVIfIqyIDSt8 WEhEOz/LUSWYvHKfdXBlofKP5zSJ8TQfUWLO1JY6/0hRywwdWIcjKJdtMK84ag5wDidW 6lW8roz+uxAI/oNo/3Yb2gNpvtYIMZTNCGgX/rQqtxEw5CG8jyxjt4zm8/TWraAFR23F kD4L3gZf8XF1+dvjCgFrmLXxzbWfeg6Fsgh6pyk0tm4DjSQrfeaBQ0ofLKZjVOncPPdB TSxw== 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=xIIEemZ8YowYTB74cFaQaWT8OHrrgh5qRh247bCYlQQ=; b=Fnc7IY5q/ReO40gjH40FetAFaiuSyHmghg5CsVZ2Oy4bd9rqC8CAxdXNDVDLT5Fah4 vvw4c8ueRMiatZdtwMDMu3TLLdZs6508rBAmMTy6XWZ2Wj40JFSkzvT1dXqs8KuVec+o 7Crm7wkBP0dABAtElEe0Gow5w8a6/gHhdsLRi+kd+Ow1Jq3Ph3PA/T5qpIJO1WEQV5qt wnNLWCfPT+3gtG/jCHdoUeb+GmxufrxfpHlFxAQzqRtSlb9EIFSyK0ruZhQhjAhEgy+o TLMzXHzMl1vJAimq1woVDHhccgD1ibVni7gdfOSOh/Fm6VZC/wN3Ttoo239zsdYAg8sC QgMw== X-Gm-Message-State: AOAM530oJ3YjrTQ5FweXUQGh58n286R49NqfdzPhFnE7mUq6teJyesPB BdGUMY+8M751ZYeZY7ZH6AVa7Xef1D5QvJNf X-Google-Smtp-Source: ABdhPJxSPlMM0IMi1Vk1ee7m7KFP9sj6JEcfGYtuEutP0l6QYEaTGrIwVwLnSQS9gvYkh5nS/3Y+zw== X-Received: by 2002:a05:620a:554:: with SMTP id o20mr6967338qko.30.1633042751489; Thu, 30 Sep 2021 15:59:11 -0700 (PDT) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with ESMTPSA id o5sm985933qkl.50.2021.09.30.15.59.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Sep 2021 15:59:11 -0700 (PDT) From: Philip McGrath Date: Thu, 30 Sep 2021 18:56:12 -0400 Message-Id: <20210930225611.2143194-3-philip@philipmcgrath.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210930225611.2143194-1-philip@philipmcgrath.com> References: <682f2ed3-90bd-a9f8-1193-34bef399ca62@philipmcgrath.com> <87h7fztt60.fsf@gmx.com> <20210808233354.6745-1-pierre.langlois@gmx.com> <20210808233354.6745-8-pierre.langlois@gmx.com> <42e10baddb6afe308f67c3240bf5da8159e6f118.camel@telenet.be> <87o88gq5p5.fsf@gmx.com> <20210930225611.2143194-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): Update to 10.24.1. --- gnu/packages/node.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index 34c2bfa9d4..6d9c3ccc71 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -57,14 +57,14 @@ (define-public node (package (name "node") - (version "10.24.0") + (version "10.24.1") (source (origin (method url-fetch) (uri (string-append "https://nodejs.org/dist/v" version "/node-v" version ".tar.xz")) (sha256 (base32 - "1k1srdis23782hnd1ymgczs78x9gqhv77v0am7yb54gqcspp70hm")) + "032801kg24j04xmf09m0vxzlcz86sv21s24lv9l4cfv08k1c4byp")) (modules '((guix build utils))) (snippet `(begin From patchwork Thu Sep 30 22:56:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 33478 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 EDFD527BBE3; Fri, 1 Oct 2021 00:00:39 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6172227BBE1 for ; Fri, 1 Oct 2021 00:00:39 +0100 (BST) Received: from localhost ([::1]:37602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mW52b-0000Iq-4s for patchwork@mira.cbaines.net; Thu, 30 Sep 2021 19:00:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mW523-0000HI-Ds for guix-patches@gnu.org; Thu, 30 Sep 2021 19:00:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mW523-0001es-4O for guix-patches@gnu.org; Thu, 30 Sep 2021 19:00:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mW523-0000fZ-42 for guix-patches@gnu.org; Thu, 30 Sep 2021 19:00:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH 3/3] guix: node-build-system: Support compiling addons with node-gyp. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Sep 2021 23:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49946@debbugs.gnu.org Cc: Pierre Langlois , Maxime Devos , Philip McGrath Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.16330427992526 (code B ref 49946); Thu, 30 Sep 2021 23:00:03 +0000 Received: (at 49946) by debbugs.gnu.org; 30 Sep 2021 22:59:59 +0000 Received: from localhost ([127.0.0.1]:54293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW51v-0000eb-Ac for submit@debbugs.gnu.org; Thu, 30 Sep 2021 18:59:58 -0400 Received: from mail-qk1-f173.google.com ([209.85.222.173]:33729) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW51t-0000eL-12 for 49946@debbugs.gnu.org; Thu, 30 Sep 2021 18:59:54 -0400 Received: by mail-qk1-f173.google.com with SMTP id d207so7523836qkg.0 for <49946@debbugs.gnu.org>; Thu, 30 Sep 2021 15:59:52 -0700 (PDT) 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=MEAkXxHZyy5STr2gwnfyP0AmLavcDqzfePCTPSpj+lE=; b=Bd9f/DCXxqgMChpWzC3aVC+p6GBzcBwU89Vg2dNOIgyp8R6YpvHbjsvjyB4T0Q+061 Sfxl5EXUT/hZzeRcipNIkLVfQ+x9DuvhYrT7TFmpOgMFqSTqqEiDztpflpqR8oyixa9x mNc4uBn1J4GAs4rPQVUbpXIaewyBzIyOKGpbyLI2TbJd9U7QGuEgbT2FyMMx84kxMAxl U6l81zyfAm+IIMM+uXUxOLEvXHFnZU8eCsOSHnex//shLz49MskKDOnpZ5eb242HCDjp RYKKJAh+l43+stavAlFjBjqJnga5o3yqeq8IdTofHIrBeMFK8fbJZKvDpeKPiWmkNWh/ yN/Q== 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=MEAkXxHZyy5STr2gwnfyP0AmLavcDqzfePCTPSpj+lE=; b=fqHTo/gr7+CcnRB2N5I5uE0B6JJ75qFa1amQfUpJT08kmS/J523nQVgBxgLXs/XfO8 OsynvrHqBEicNSpUc7XpzO3XtdtamUh0mX3+pGwukMU1exJemON+B41FXdUJC2/dSwEQ uUmvfcitNjF/tt072LEeyaut4PtShaLY054YEj6FxRJuOJ7LZ/t96Cr5s2/oJeaps4oy znwclLT+OZSECkHbbpag10oidsMd8MGzAXEecf7hGhBwbWYfjfWsoOwJAzktAtqCJyNA pXsrVEn4wQlW/C66crozw/toBBUSw7eB1jGMWG12avyF6WSJiThAByd3aMPnEMQFvlVh g+6g== X-Gm-Message-State: AOAM533Wp8hYGdANbaFRwk0zjrj0vX6qhB3qB1u3VUZNhaoDpjEx7j6C aVE3hJCJnDEq4RX0PZS7a4xnqkPcadxb6VDu X-Google-Smtp-Source: ABdhPJxXcBu1IU2gqprrhOV6cpt8s1SkuB5RKNYAKeXsLyoKWSGLXIdstdOgup+cxzGL1fBGhiLfyQ== X-Received: by 2002:a37:9202:: with SMTP id u2mr7129058qkd.454.1633042787361; Thu, 30 Sep 2021 15:59:47 -0700 (PDT) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with ESMTPSA id w7sm2468864qtc.29.2021.09.30.15.59.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Sep 2021 15:59:47 -0700 (PDT) From: Philip McGrath Date: Thu, 30 Sep 2021 18:56:14 -0400 Message-Id: <20210930225611.2143194-4-philip@philipmcgrath.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210930225611.2143194-1-philip@philipmcgrath.com> References: <682f2ed3-90bd-a9f8-1193-34bef399ca62@philipmcgrath.com> <87h7fztt60.fsf@gmx.com> <20210808233354.6745-1-pierre.langlois@gmx.com> <20210808233354.6745-8-pierre.langlois@gmx.com> <42e10baddb6afe308f67c3240bf5da8159e6f118.camel@telenet.be> <87o88gq5p5.fsf@gmx.com> <20210930225611.2143194-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]: 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. * guix/build-system/node.scm (lower): Add optional #:python argument. * guix/build/node-build-system.scm (set-node-gyp-paths): New function. Sets the "npm_config_nodedir" and "npm_config_python" environment variables. (%standard-phases): Add 'set-node-gyp-paths after 'set-paths. Co-authored-by: Pierre Langlois --- gnu/packages/node.scm | 33 +++++++++++++++++--------------- guix/build-system/node.scm | 7 ++++++- guix/build/node-build-system.scm | 9 +++++++++ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index 6d9c3ccc71..805a4f18fc 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -244,21 +244,22 @@ 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"))))) + (with-directory-excursion (string-append prefix "/lib/node_modules") + (for-each + (lambda (file) + (patch-shebang file path)) + (find-files "." + (lambda (file stat) + (and (eq? 'regular (stat:type stat)) + (not (zero? (logand (stat:mode stat) #o100))))) + #:stat lstat))))))))) (native-inputs `(;; Runtime dependencies for binaries used as a bootstrap. ("c-ares" ,c-ares) @@ -281,6 +282,7 @@ (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) @@ -764,6 +766,7 @@ source files.") (inputs `(("bash" ,bash-minimal) ("coreutils" ,coreutils) + ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3) ("c-ares" ,c-ares) ("icu4c" ,icu4c-67) ("libuv" ,libuv-for-node) diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm index 98f63f87ef..3e49e67ff6 100644 --- a/guix/build-system/node.scm +++ b/guix/build-system/node.scm @@ -1,6 +1,8 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Jelle Licht ;;; Copyright © 2019 Timothy Sample +;;; Copyright © 2021 Pierre Langlois +;;; Copyright © 2021 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,6 +26,7 @@ #:use-module (guix search-paths) #:use-module (guix build-system) #:use-module (guix build-system gnu) + #:use-module (guix build-system python) #:use-module (ice-9 match) #:export (%node-build-system-modules node-build @@ -44,11 +47,12 @@ (define* (lower name #:key source inputs native-inputs outputs system target (node (default-node)) + (python (default-python)) ;; for node-gyp #:allow-other-keys #:rest arguments) "Return a bag for NAME." (define private-keywords - '(#:source #:target #:node #:inputs #:native-inputs)) + '(#:source #:target #:node #:python #:inputs #:native-inputs)) (and (not target) ;XXX: no cross-compilation (bag @@ -62,6 +66,7 @@ ;; Keep the standard inputs of 'gnu-build-system'. ,@(standard-packages))) (build-inputs `(("node" ,node) + ("python" ,python) ,@native-inputs)) (outputs outputs) (build node-build) diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm index 70a367618e..5e62eb4784 100644 --- a/guix/build/node-build-system.scm +++ b/guix/build/node-build-system.scm @@ -2,6 +2,8 @@ ;;; Copyright © 2015 David Thompson ;;; Copyright © 2016, 2020 Jelle Licht ;;; Copyright © 2019, 2021 Timothy Sample +;;; Copyright © 2021 Pierre Langlois +;;; Copyright © 2021 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -46,6 +48,12 @@ (format #t "set HOME to ~s~%" (getenv "HOME"))))))) #t) +(define* (set-node-gyp-paths #:key inputs #:allow-other-keys) + "Initialize environment variables needed for building native addons." + (setenv "npm_config_nodedir" (assoc-ref inputs "node")) + (setenv "npm_config_python" (assoc-ref inputs "python")) + #t) + (define (module-name module) (let* ((package.json (string-append module "/package.json")) (package-meta (call-with-input-file package.json read-json))) @@ -144,6 +152,7 @@ (define %standard-phases (modify-phases gnu:%standard-phases + (add-after 'set-paths 'set-node-gyp-paths set-node-gyp-paths) (add-after 'unpack 'set-home set-home) (add-before 'configure 'patch-dependencies patch-dependencies) (replace 'configure configure)