[PATCH 1/2] gnu: node-lts: Simplify snippet.

  • Done
  • quality assurance status badge
Details
2 participants
  • ???
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Ricardo Wurmus
Severity
normal
R
R
Ricardo Wurmus wrote on 13 Jul 2023 10:30
(address . guix-patches@gnu.org)(name . Ricardo Wurmus)(address . rekado@elephly.net)
b5e817925299a377b7948cb7f683126ed2f57ff6.1689237014.git.rekado@elephly.net
* gnu/packages/node.scm (node-lts)[source]: Remove quasiquote, trailing #T,
and IF with explicit booleans.
---
gnu/packages/node.scm | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

Toggle diff (43 lines)
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 7695614b3a..c0bb4f2342 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -7,7 +7,7 @@
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018-2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2020, 2021 Pierre Langlois <pierre.langlois@gmx.com>
-;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020, 2023 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
@@ -748,13 +748,12 @@ (define-public node-lts
"0vcc132z7lkxnw5clmiz6sp6ccmw35pyb69hczphrig5frfmqkva"))
(modules '((guix build utils)))
(snippet
- `(begin
+ '(begin
;; openssl.cnf is required for build.
(for-each delete-file-recursively
(find-files "deps/openssl"
(lambda (file stat)
- (if (string-contains file "nodejs-openssl.cnf")
- #f #t))))
+ (not (string-contains file "nodejs-openssl.cnf")))))
;; Remove bundled software, where possible
(for-each delete-file-recursively
'("deps/cares"
@@ -764,8 +763,7 @@ (define-public node-lts
(substitute* "Makefile"
;; Remove references to bundled software.
(("deps/uv/uv.gyp") "")
- (("deps/zlib/zlib.gyp") ""))
- #t))))
+ (("deps/zlib/zlib.gyp") ""))))))
(arguments
(substitute-keyword-arguments (package-arguments node)
((#:configure-flags configure-flags)

base-commit: 2794caed7c813f2ec4249236de36eaccafee8361
--
2.40.1
R
R
Ricardo Wurmus wrote on 13 Jul 2023 10:47
[PATCH 2/2] gnu: node-lts: Install files irrespective of number of hardlinks.
(address . 64592@debbugs.gnu.org)(name . Ricardo Wurmus)(address . rekado@elephly.net)
bf627ed888d76a4795e8053baf4c56029380a0b2.1689236917.git.rekado@elephly.net
* gnu/packages/node.scm (node-lts)[arguments]: Add build phase
'ignore-number-of-hardlinks.
---
gnu/packages/node.scm | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)

Toggle diff (44 lines)
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index c0bb4f2342..8ba57dd4e0 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -874,7 +874,36 @@ (define-public node-lts
(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"))))))))
+ "deps/llhttp/include/llhttp.h"))))
+ ;; npm installs dependencies by copying their files over a tar
+ ;; stream. A file with more than one hardlink is marked as a
+ ;; "Link". pacote/lib/fetcher.js calls node-tar's extractor with a
+ ;; filter that ignores any "Link" entries. This means that
+ ;; dependending on the number of hardlinks on files in a node-*
+ ;; package *some* of its files may not be installed when generating
+ ;; another package's "node_modules" directory. The build output
+ ;; would differ depending on irrelevant file system state.
+ ;;
+ ;; To avoid this, we patch node-tar to treat files with hardlinks
+ ;; the same as any other file, so that node-tar has no choice but
+ ;; to extract all of them --- independent of pacote's filter.
+ ;;
+ ;; Why not patch pacote's filter instead? This has led to subtle
+ ;; differences in where the files are installed, so it's easier to
+ ;; just ensure that files with hardlinks are always treated as
+ ;; regular files.
+ ;;
+ ;; Discussion:
+ ;; https://lists.gnu.org/archive/html/guix-devel/2023-07/msg00040.html
+ ;; Upstream bug report:
+ ;; https://github.com/npm/pacote/issues/285
+ (add-after 'install 'ignore-number-of-hardlinks
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((file (string-append (assoc-ref outputs "out")
+ "/lib/node_modules/npm/node_modules"
+ "/tar/lib/write-entry.js")))
+ (substitute* file
+ (("this.stat.nlink > 1") "false")))))))))
(native-inputs
(list ;; Runtime dependencies for binaries used as a bootstrap.
c-ares-for-node
--
2.40.1
?
Re: bug#64592: [PATCH 1/2] gnu: node-lts: Simplify snippet.
(name . bug#64592)(address . 64592-done@debbugs.gnu.org)
87fs5hh2jq.fsf@envs.net
Pushed as 5dc2a88f99e2e448f7e9ca842a4a0d072a8f8f20, close issue...
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 64592@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 64592
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch