From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mOWAGj8OVmA9NgAA0tVLHw (envelope-from ) for ; Sat, 20 Mar 2021 15:01:19 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id aIBCFj8OVmB1UQAAbx9fmQ (envelope-from ) for ; Sat, 20 Mar 2021 15:01:19 +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 aspmx2.migadu.com (Postfix) with ESMTPS id 12902924C for ; Sat, 20 Mar 2021 16:01:19 +0100 (CET) Received: from localhost ([::1]:52564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNd6M-0000nW-2g for larch@yhetil.org; Sat, 20 Mar 2021 11:01:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNd5F-0008TT-3R for guix-patches@gnu.org; Sat, 20 Mar 2021 11:00:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41478) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lNd5E-0001db-RL for guix-patches@gnu.org; Sat, 20 Mar 2021 11:00:08 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lNd5E-0000Or-R7 for guix-patches@gnu.org; Sat, 20 Mar 2021 11:00:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47282] [PATCH 13/13] gnu: node: Add node-lts Resent-From: Jelle Licht Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 20 Mar 2021 15:00:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47282 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47282@debbugs.gnu.org Received: via spool by 47282-submit@debbugs.gnu.org id=B47282.16162524001406 (code B ref 47282); Sat, 20 Mar 2021 15:00:08 +0000 Received: (at 47282) by debbugs.gnu.org; 20 Mar 2021 15:00:00 +0000 Received: from localhost ([127.0.0.1]:53012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lNd55-0000MX-Oi for submit@debbugs.gnu.org; Sat, 20 Mar 2021 11:00:00 -0400 Received: from mail1.fsfe.org ([217.69.89.151]:47286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lNd4j-0000L1-So for 47282@debbugs.gnu.org; Sat, 20 Mar 2021 10:59:38 -0400 From: Jelle Licht Date: Sat, 20 Mar 2021 15:59:25 +0100 Message-Id: <20210320145925.12500-13-jlicht@fsfe.org> In-Reply-To: <20210320145925.12500-1-jlicht@fsfe.org> References: <20210320145925.12500-1-jlicht@fsfe.org> 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616252479; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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; bh=7G1X+6eR2uzM/lv/S4iFytRj0Vc+8H+59k/HKIzshDM=; b=eF+KZcdZ9OHzemEDRL4IhPCJvYHOrG3+XE7NaR4ujU0+2O0a6/LbZnJNL9v2SsvBetLmPE epyweOm4M48d+mRyiBaLDLg7KcbrCIiin9jv01z6FXuJHm8e7ayznpaFzze/miZY8L8oEJ VDe9gQulZOYwhHDVNlbREN1FwQl+mL3WRbQpVf3/otOra2hYK77PYzLScZ9iR6DidXW1jD C9wT01T4XStye2kLf5RZxu/fD0PmgB9sbgy/w1AoLVCsnSOfTjFBj0LROTB3GPj3ELhVXW Y/afixmSwzqYHXplHP/Fevdw9AdYSr88DfQpqm2SJYxbQ/JuzQpFbqb20nowvQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616252479; a=rsa-sha256; cv=none; b=FGmvP9dQeBPk/9wqNge1ZFz6m4F69TIrX73DU/Y4AzmpD2wXLhyEpydt5kjjsUnredfPyD Qdnuh87rpeAo/9xePggRR4hoTaxshF7CvbpYRBcNHo+k5WNqD5dG9XDnpEEWyXfI96nDzw uVx5L1h3wndD/jq4H1s54T/oxyQknWqenoYYJrhd7CSTf+aQ/Cv0QjdZ904AGeADdXYAb0 A18qSHpHnL5S/ZuwmmtaWSV3bOjemNsLVJoKPxzYPuHKfobMKk16FnvctTzpMGGi7TywBw a8DnaUGWrRvhlXePJ719fRY+yF8BSt6CV9bEOab7Trx29zidBZtVLB/c5z2IsA== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=fsfe.org (policy=none); spf=pass (aspmx2.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 2.69 Authentication-Results: aspmx2.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=fsfe.org (policy=none); spf=pass (aspmx2.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 12902924C X-Spam-Score: 2.69 X-Migadu-Scanner: scn0.migadu.com X-TUID: hVHEtSOY95gf * gnu/packages/node.scm (node-lts): New package. wip --- gnu/packages/node.scm | 156 ++++++++++++++++++++++++++++++++++++- guix/build-system/node.scm | 2 +- 2 files changed, 153 insertions(+), 5 deletions(-) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index d44bec7ca4..2a7e9ca2fa 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -542,7 +542,7 @@ definition into a C output.") (define-public llhttp-bootstrap (package (name "llhttp") - (version "2.1.0") + (version "2.2.1") (source (origin (method git-fetch) (uri (git-reference @@ -551,7 +551,7 @@ definition into a C output.") (file-name (git-file-name name version)) (sha256 (base32 - "08ylnirqrk63h0ww1m79p0bh6rwayrhd4v28p353qlp3qcffwwb0")) + "093ag8w0y8irsy0ph7sk06rrs03ic3is41wgxjkgwvc2qys9iqdr")) (modules '((guix build utils))) (snippet '(begin @@ -566,7 +566,7 @@ definition into a C output.") #t)))) (build-system gnu-build-system) (arguments - `(#:tests? #f ; no tests + `(#:tests? #f ; no tests #:make-flags (list "CLANG=gcc" (string-append "DESTDIR=" (assoc-ref %outputs "out")) "PREFIX=") @@ -592,6 +592,8 @@ definition into a C output.") (let* ((out (assoc-ref outputs "out")) (src-dir (string-append out "/src"))) (install-file "build/c/llhttp.c" src-dir) + (install-file "src/native/api.c" src-dir) + (install-file "src/native/http.c" src-dir) #t)))))) (native-inputs `(("esbuild" ,esbuild) @@ -599,13 +601,159 @@ definition into a C output.") ("node-semver" ,node-semver-bootstrap) ("node-llparse-bootstrap" ,node-llparse-bootstrap))) (home-page "https://github.com/nodejs/llhttp") - (properties '((hidden? . #t))) + ;; (properties '((hidden? . #t))) (synopsis "Port of @code{http_parser} to @code{llparse}") (description "@code{llhttp} is a port of @code{http_parser} to TypeScript. @code{llparse} is used to generate the output C source file, which can be compiled and linked with the embedder's program (like @code{Node.js}).") (license license:expat))) +(define-public node-lts + (package + (inherit node) + (version "14.16.0") + (source (origin + (method url-fetch) + (uri (string-append "https://nodejs.org/dist/v" version + "/node-v" version ".tar.xz")) + (sha256 + (base32 + "19nz2mhmn6ikahxqyna1dn25pb5v3z9vsz9zb2flb6zp2yk4hxjf")) + (modules '((guix build utils))) + (snippet + `(begin + ;; Remove bundled software, where possible + (for-each delete-file-recursively + '("deps/cares" + "deps/icu-small" + "deps/nghttp2" + "deps/openssl" + "deps/zlib")) + (substitute* "Makefile" + ;; Remove references to bundled software. + (("deps/uv/uv.gyp") "") + (("deps/zlib/zlib.gyp") "")) + #t)))) + (arguments + (substitute-keyword-arguments (package-arguments node) + ((#:configure-flags configure-flags) + ''("--shared-cares" + "--shared-libuv" + "--shared-nghttp2" + "--shared-openssl" + "--shared-zlib" + "--shared-brotli" + "--with-intl=system-icu")) + ((#:phases phases) + `(modify-phases ,phases + (replace 'configure + ;; Node's configure script is actually a python script, so we can't + ;; run it with bash. + (lambda* (#:key outputs (configure-flags '()) inputs + #:allow-other-keys) + (let* ((prefix (assoc-ref outputs "out")) + (flags (cons (string-append "--prefix=" prefix) + 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" (string-append (assoc-ref inputs "gcc") "/bin/gcc")) + (apply invoke + (string-append (assoc-ref inputs "python") + "/bin/python3") + "configure" flags)))) + (replace 'patch-files + (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") + (("'/bin/sh'") + (string-append "'" (which "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 "'" (which "env") "'"))) + ;; Because we have a custom version of llhttp, we should expect a superset of supported http methods. + (substitute* '("test/parallel/test-http-methods.js") + (("assert\\.deepStrictEqual\\(http\\.METHODS, methods\\.sort\\(\\)\\);") + "methods.every(v => assert(http.METHODS.includes(v)));")) + + ;; 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")) + + ;; This requires a DNS resolver. + (for-each delete-file + '("test/parallel/test-dns.js" + "test/parallel/test-dns-lookupService-promises.js")) + + ;; TODO: why does this fail. It seems to _almost_ pass, but it parses 1 byte? + (delete-file "test/parallel/test-http-server-destroy-socket-on-client-error.js") + + ;; TODO: this seems to fail because of spawning processes? + (delete-file "test/parallel/test-fs-write-sigxfsz.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 (string-prefix? "arm" (%current-system)) + '((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")) + ;; (llhttp-src (assoc-ref inputs "llhttp-sources")) + ) + (copy-file (string-append llhttp "/src/llhttp.c") + "deps/llhttp/src/llhttp.c") + (copy-file (string-append llhttp "/src/api.c") + "deps/llhttp/src/api.c") + (copy-file (string-append llhttp "/src/http.c") + "deps/llhttp/src/http.c") + (copy-file (string-append llhttp "/include/llhttp.h") + "deps/llhttp/include/llhttp.h")) + #t)))))) + (inputs + `(("c-ares" ,c-ares) + ("icu4c" ,icu4c-67) + ("libuv" ,libuv-node) + ("llhttp" ,llhttp-bootstrap) + ("google-brotli" ,google-brotli) + ("nghttp2" ,nghttp2 "lib") + ("openssl" ,openssl) + ("zlib" ,zlib))) + (native-inputs + (alist-replace "python" (list python-3) + (package-native-inputs node))))) + (define-public libnode (package/inherit node (name "libnode") diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm index 560f0ee4da..5737c8ea6e 100644 --- a/guix/build-system/node.scm +++ b/guix/build-system/node.scm @@ -39,7 +39,7 @@ "Return the default Node package." ;; Lazily resolve the binding to avoid a circular dependency. (let ((node (resolve-interface '(gnu packages node)))) - (module-ref node 'node))) + (module-ref node 'node-lts))) (define* (lower name #:key source inputs native-inputs outputs system target -- 2.31.0