[PATCH] gnu: Add node-semver.

  • Done
  • quality assurance status badge
Details
4 participants
  • Efraim Flashner
  • Giacomo Leidi
  • Julien Lepiller
  • Ludovic Courtès
Owner
unassigned
Submitted by
Giacomo Leidi
Severity
normal
G
G
Giacomo Leidi wrote on 11 Jul 2019 14:12
(address . guix-patches@gnu.org)(name . Giacomo Leidi)(address . goodoldpaul@autistici.org)
20190711121221.16123-1-goodoldpaul@autistici.org
* gnu/packages/node.scm (node-semver): New variable.
---
gnu/packages/node.scm | 48 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)

Toggle diff (75 lines)
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index fc43fcb04c..2f3fe17334 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2017 Mike Gerwitz <mtg@gnu.org>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2019 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -23,10 +24,12 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages node)
- #:use-module ((guix licenses) #:select (expat))
+ #:use-module ((guix licenses) #:select (expat isc))
#:use-module (guix packages)
#:use-module (guix derivations)
#:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix build-system trivial)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages adns)
@@ -184,3 +187,46 @@ devices.")
(home-page "https://nodejs.org/")
(license expat)
(properties '((timeout . 3600))))) ; 1 h
+
+(define-public node-semver
+ (package
+ (name "node-semver")
+ (version "6.2.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/npm/node-semver.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0lqb0v7frrdr7yvxy8b2yg6rp1jilninzk76qnx5qnswxnr4gj5m"))))
+ (build-system trivial-build-system)
+ (propagated-inputs
+ `(("node" ,node)))
+ (arguments
+ '(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((source (assoc-ref %build-inputs "source"))
+ (out (assoc-ref %outputs "out"))
+ (semver-js "semver.js")
+ (entry-point (string-append "bin/" semver-js)))
+ (mkdir-p (string-append out "/bin"))
+ (setenv "PATH" (string-append (assoc-ref %build-inputs
+ "node")
+ "/bin:" (getenv "PATH")))
+ (map (lambda (file)
+ (install-file (string-append source "/" file) out))
+ (list semver-js "LICENSE" "package.json" "package-lock.json" "range.bnf"))
+ (install-file (string-append source "/" entry-point)
+ (string-append out "/bin"))
+ (patch-shebang (string-append out "/" entry-point))
+ #t))))
+ (home-page "https://github.com/npm/node-semver")
+ (synopsis "Parses semantic versions strings")
+ (description
+ "node-semver is a JavaScript implementation of the
+@uref{https://semver.org/, SemVer.org} specification.")
+ (license isc)))
--
2.22.0
L
L
Ludovic Courtès wrote on 2 Sep 2019 14:49
(name . Giacomo Leidi)(address . goodoldpaul@autistici.org)(address . 36599@debbugs.gnu.org)
87a7bmamnv.fsf@gnu.org
Hi Giacomo,

This patch seems to have been forgotten…

Giacomo Leidi <goodoldpaul@autistici.org> skribis:

Toggle quote (2 lines)
> * gnu/packages/node.scm (node-semver): New variable.

[...]

Toggle quote (14 lines)
> +(define-public node-semver
> + (package
> + (name "node-semver")
> + (version "6.2.0")
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/npm/node-semver.git")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "0lqb0v7frrdr7yvxy8b2yg6rp1jilninzk76qnx5qnswxnr4gj5m"))))

The nice thing is that the source doesn’t contain any binaries (or
“minified” code),.

Toggle quote (24 lines)
> + (build-system trivial-build-system)
> + (propagated-inputs
> + `(("node" ,node)))
> + (arguments
> + '(#:modules ((guix build utils))
> + #:builder
> + (begin
> + (use-modules (guix build utils))
> + (let* ((source (assoc-ref %build-inputs "source"))
> + (out (assoc-ref %outputs "out"))
> + (semver-js "semver.js")
> + (entry-point (string-append "bin/" semver-js)))
> + (mkdir-p (string-append out "/bin"))
> + (setenv "PATH" (string-append (assoc-ref %build-inputs
> + "node")
> + "/bin:" (getenv "PATH")))
> + (map (lambda (file)
> + (install-file (string-append source "/" file) out))
> + (list semver-js "LICENSE" "package.json" "package-lock.json" "range.bnf"))
> + (install-file (string-append source "/" entry-point)
> + (string-append out "/bin"))
> + (patch-shebang (string-append out "/" entry-point))
> + #t))))

This installs files in non-standard locations:

Toggle snippet (11 lines)
$ find $(./pre-inst-env guix build node-semver)
/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0
/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/package-lock.json
/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/bin
/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/bin/semver.js
/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/package.json
/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/semver.js
/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/range.bnf
/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/LICENSE

bin/ is fine, though should the binary be called ‘semver’ instead of
‘semver.js’?

Could you arrange so that ‘LICENSE’ goes to ‘share/doc/node-semver’?

As for the other files, I don’t know. Are they needed? Should they go
to share/node-semver?

Thanks in advance, and apologies for the loooong delay!

Ludo’.
J
J
Julien Lepiller wrote on 2 Sep 2019 16:50
(address . 36599@debbugs.gnu.org)
74DCA7FB-6960-4E6A-8DB5-326E065B5DEB@lepiller.eu
Le 2 septembre 2019 14:49:08 GMT+02:00, "Ludovic Courtès" <ludo@gnu.org> a écrit :
Toggle quote (81 lines)
>Hi Giacomo,
>
>This patch seems to have been forgotten…
>
>Giacomo Leidi <goodoldpaul@autistici.org> skribis:
>
>> * gnu/packages/node.scm (node-semver): New variable.
>
>[...]
>
>> +(define-public node-semver
>> + (package
>> + (name "node-semver")
>> + (version "6.2.0")
>> + (source (origin
>> + (method git-fetch)
>> + (uri (git-reference
>> + (url "https://github.com/npm/node-semver.git")
>> + (commit (string-append "v" version))))
>> + (file-name (git-file-name name version))
>> + (sha256
>> + (base32
>> +
>"0lqb0v7frrdr7yvxy8b2yg6rp1jilninzk76qnx5qnswxnr4gj5m"))))
>
>The nice thing is that the source doesn’t contain any binaries (or
>“minified” code),.
>
>> + (build-system trivial-build-system)
>> + (propagated-inputs
>> + `(("node" ,node)))
>> + (arguments
>> + '(#:modules ((guix build utils))
>> + #:builder
>> + (begin
>> + (use-modules (guix build utils))
>> + (let* ((source (assoc-ref %build-inputs "source"))
>> + (out (assoc-ref %outputs "out"))
>> + (semver-js "semver.js")
>> + (entry-point (string-append "bin/" semver-js)))
>> + (mkdir-p (string-append out "/bin"))
>> + (setenv "PATH" (string-append (assoc-ref %build-inputs
>> + "node")
>> + "/bin:" (getenv "PATH")))
>> + (map (lambda (file)
>> + (install-file (string-append source "/" file)
>out))
>> + (list semver-js "LICENSE" "package.json"
>"package-lock.json" "range.bnf"))
>> + (install-file (string-append source "/" entry-point)
>> + (string-append out "/bin"))
>> + (patch-shebang (string-append out "/" entry-point))
>> + #t))))
>
>This installs files in non-standard locations:
>
>--8<---------------cut here---------------start------------->8---
>$ find $(./pre-inst-env guix build node-semver)
>/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0
>/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/package-lock.json
>/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/bin
>/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/bin/semver.js
>/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/package.json
>/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/semver.js
>/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/range.bnf
>/gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/LICENSE
>--8<---------------cut here---------------end--------------->8---
>
>bin/ is fine, though should the binary be called ‘semver’ instead of
>‘semver.js’?
>
>Could you arrange so that ‘LICENSE’ goes to ‘share/doc/node-semver’?
>
>As for the other files, I don’t know. Are they needed? Should they
>go
>to share/node-semver?
>
>Thanks in advance, and apologies for the loooong delay!
>
>Ludo’.

Actually we have a node-build-system now which woull work much better than the trivial-build-system.
G
G
goodoldpaul wrote on 2 Sep 2019 19:13
(address . 36599@debbugs.gnu.org)
c90629d61c5ed8a1e4ed03f2321b7195@autistici.org
Hello everybody,
I also forgot about this patch: I was actually conviced that another
patch providing node-semver was merged with the new node-build-system.

Here's the updated package (greatly simplified, as foreseen by Julien,
thanks to the new node-build-system). I added it in a new npm.scm file
to maintain consistency with i.e. Haskell, Python or Rust. If you think
this should be put in node.scm, don't hesitate to tell!

Bye,

Giacomo

On 2019-09-02 14:50, Julien Lepiller wrote:
Toggle quote (85 lines)
> Le 2 septembre 2019 14:49:08 GMT+02:00, "Ludovic Courtès"
> <ludo@gnu.org> a écrit :
>> Hi Giacomo,
>>
>> This patch seems to have been forgotten…
>>
>> Giacomo Leidi <goodoldpaul@autistici.org> skribis:
>>
>>> * gnu/packages/node.scm (node-semver): New variable.
>>
>> [...]
>>
>>> +(define-public node-semver
>>> + (package
>>> + (name "node-semver")
>>> + (version "6.2.0")
>>> + (source (origin
>>> + (method git-fetch)
>>> + (uri (git-reference
>>> + (url "https://github.com/npm/node-semver.git")
>>> + (commit (string-append "v" version))))
>>> + (file-name (git-file-name name version))
>>> + (sha256
>>> + (base32
>>> +
>> "0lqb0v7frrdr7yvxy8b2yg6rp1jilninzk76qnx5qnswxnr4gj5m"))))
>>
>> The nice thing is that the source doesn’t contain any binaries (or
>> “minified” code),.
>>
>>> + (build-system trivial-build-system)
>>> + (propagated-inputs
>>> + `(("node" ,node)))
>>> + (arguments
>>> + '(#:modules ((guix build utils))
>>> + #:builder
>>> + (begin
>>> + (use-modules (guix build utils))
>>> + (let* ((source (assoc-ref %build-inputs "source"))
>>> + (out (assoc-ref %outputs "out"))
>>> + (semver-js "semver.js")
>>> + (entry-point (string-append "bin/" semver-js)))
>>> + (mkdir-p (string-append out "/bin"))
>>> + (setenv "PATH" (string-append (assoc-ref %build-inputs
>>> + "node")
>>> + "/bin:" (getenv "PATH")))
>>> + (map (lambda (file)
>>> + (install-file (string-append source "/" file)
>> out))
>>> + (list semver-js "LICENSE" "package.json"
>> "package-lock.json" "range.bnf"))
>>> + (install-file (string-append source "/" entry-point)
>>> + (string-append out "/bin"))
>>> + (patch-shebang (string-append out "/" entry-point))
>>> + #t))))
>>
>> This installs files in non-standard locations:
>>
>> --8<---------------cut here---------------start------------->8---
>> $ find $(./pre-inst-env guix build node-semver)
>> /gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0
>> /gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/package-lock.json
>> /gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/bin
>> /gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/bin/semver.js
>> /gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/package.json
>> /gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/semver.js
>> /gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/range.bnf
>> /gnu/store/dmclr4h1jwqp02j9bpp9xsr5pzacdmnl-node-semver-6.2.0/LICENSE
>> --8<---------------cut here---------------end--------------->8---
>>
>> bin/ is fine, though should the binary be called ‘semver’ instead of
>> ‘semver.js’?
>>
>> Could you arrange so that ‘LICENSE’ goes to ‘share/doc/node-semver’?
>>
>> As for the other files, I don’t know. Are they needed? Should they
>> go
>> to share/node-semver?
>>
>> Thanks in advance, and apologies for the loooong delay!
>>
>> Ludo’.
>
> Actually we have a node-build-system now which woull work much better
> than the trivial-build-system.
From 88991ab20c81b86ae82ed9c7102d3cd163ee3f98 Mon Sep 17 00:00:00 2001
From: Giacomo Leidi <goodoldpaul@autistici.org>
Date: Mon, 2 Sep 2019 19:03:17 +0200
Subject: [PATCH] gnu: Add node-semver.

* gnu/packages/npm.scm: New file.
* gnu/local.mk: Add it.
* gnu/packages/npm.scm (node-semver): New variable.
---
gnu/local.mk | 2 ++
gnu/packages/npm.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
create mode 100644 gnu/packages/npm.scm

Toggle diff (75 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index dbae857c38..81e52a8b9a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -22,6 +22,7 @@
# Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
# Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
# Copyright © 2019 John Soo <jsoo1@asu.edu>
+# Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
#
# This file is part of GNU Guix.
#
@@ -354,6 +355,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/ninja.scm \
%D%/packages/node.scm \
%D%/packages/noweb.scm \
+ %D%/packages/npm.scm \
%D%/packages/nss.scm \
%D%/packages/ntp.scm \
%D%/packages/nutrition.scm \
diff --git a/gnu/packages/npm.scm b/gnu/packages/npm.scm
new file mode 100644
index 0000000000..1c47dc0500
--- /dev/null
+++ b/gnu/packages/npm.scm
@@ -0,0 +1,47 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages npm)
+ #:use-module (guix build-system node)
+ #:use-module (guix git-download)
+ #:use-module ((guix licenses) #:select (isc))
+ #:use-module (guix packages))
+
+(define-public node-semver
+ (package
+ (name "node-semver")
+ (version "6.3.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/npm/node-semver.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "15xqmj5h1gz2p3v3gczjl07rm75miavqr70xw2fxgz3n880s4iyn"))))
+ (build-system node-build-system)
+ (arguments
+ `(;; FIXME: Tests depend on node-tap
+ #:tests? #f))
+ (home-page "https://github.com/npm/node-semver")
+ (synopsis "Parses semantic versions strings")
+ (description
+ "node-semver is a JavaScript implementation of the
+@uref{https://semver.org/, SemVer.org} specification.")
+ (license isc)))
--
2.23.0
G
G
goodoldpaul wrote on 8 Apr 2020 01:06
[PATCH] gnu: Add node-semver. (Updated)
(address . 36599@debbugs.gnu.org)
de74ef365d49c660a4b75905f3cc1b63@autistici.org
Hi,
this patch fell again out of my mind. Here's an update version.
From 143a217a89e4f73149c73523565a1437d8bdfa0e Mon Sep 17 00:00:00 2001
From: Giacomo Leidi <goodoldpaul@autistici.org>
Date: Wed, 8 Apr 2020 00:59:13 +0200
Subject: [PATCH] gnu: Add node-semver.

* gnu/packages/node-xyz.scm (node-semver): New variable.
---
gnu/packages/node-xyz.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (40 lines)
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 44236ec469..27cd5c18b7 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -244,3 +245,26 @@ protocol used in @code{node-lynx}.")
(description "This package provides the Node.js @code{util.deprecate()}
function with browser support.")
(license license:expat)))
+
+(define-public node-semver
+ (package
+ (name "node-semver")
+ (version "7.2.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/npm/node-semver.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
+ (build-system node-build-system)
+ (arguments
+ `(#:tests? #f)) ;; FIXME: Tests depend on node-tap
+ (home-page "https://github.com/npm/node-semver")
+ (synopsis "Parses semantic versions strings")
+ (description
+ "@code{node-semver} is a JavaScript implementation of the
+@uref{https://semver.org/, SemVer.org} specification.")
+ (license license:isc)))
--
2.26.0
E
E
Efraim Flashner wrote on 9 Apr 2020 22:01
(address . goodoldpaul@autistici.org)(address . 36599@debbugs.gnu.org)
20200409200150.GQ1518@E5400
Overall it looks good to me. I also checked npm¹ and it agrees that
there are no dependencies for this package. Do you happen to know why
there's a test directory installed? I don't know if it's supposed to be
there but it seems strange to me

$ tree /gnu/store/sgq5frrlnpip3sjjsqjrwc4czys1ry8a-node-semver-7.2.1 -d
/gnu/store/sgq5frrlnpip3sjjsqjrwc4czys1ry8a-node-semver-7.2.1
??? bin
??? lib
?   ??? node_modules
?   ??? semver
?   ??? bin
?   ??? classes
?   ??? functions
?   ??? internal
?   ??? ranges
?   ??? tap-snapshots
?   ??? test
?   ??? bin
?   ??? classes
?   ??? fixtures
?   ??? functions
?   ??? internal
?   ??? ranges
??? share
??? doc
??? node-semver-7.2.1





--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl6Pfy0ACgkQQarn3Mo9
g1F2Cw/+JeHNacFwrlml2PC6z1binGaY23yQvjeZDgx7C3azcGSYtnpIZq1wOEZa
p0COW56idjYyAusHCNc//o4X8vhXFb8PisCWmqTNbMXU8N4TZQ4u9Q5n5D3cFewj
Bw4jpyGYYLq+JdMB/hqCLHcp8n0sGzJwEAJ1fh5dg17UQ9v7aOVj65xE111oDPrS
S51kU1nQWLScmyDF7ghULg/PXOGvWvfu9f42eZHEdF0nQa613i0tEBmihieRVfxM
nVDU9aXI5btJRyU529FCoJns+9py+rhOQeAc/H4ccCCu3WQ9P4RYVSNebl5uBdPl
9o4DtcqmbMkq7YWVFgkx1Ls2fyuc3nmdyzxpFhBG7boi2+RzLwxW1NlTPCug7qgx
CEQUiwRBV8svxItjTlZyeRrqfJoada3pgRjSLWR8tV+pltWEcJEk0Uqd6Vxq0aR8
pF77q1HCdlP50dseLi1aO2YWtHhDh8lBLVunzYbqun4LZ6lo+jYjJ4spM4XQ4r5R
XzW56O6l1GXAMfenh/Yi/WKHkebt2WblYCRy30iqN6m8UQOOjStRnEZhLkNW4NwY
fxruKKryywbAE7JUmMDqW882RuiQkPGRcYQoAxUVyczAR3CKtjPTAdvC3ekNo7U0
6KKMLDhuU5Av+/vYsjLJ2Gt9RbX1sjCHtJh50aj5XHPWU8FgYnw=
=QjBn
-----END PGP SIGNATURE-----


G
G
goodoldpaul wrote on 15 Apr 2020 17:36
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 36599@debbugs.gnu.org)
c7c5b4ec926007e9611d74a7cca62d48@autistici.org
Hi Efraim,

Toggle quote (5 lines)
> Overall it looks good to me. I also checked npm¹ and it agrees that
> there are no dependencies for this package. Do you happen to know why
> there's a test directory installed? I don't know if it's supposed to be
> there but it seems strange to me

I didn't notice and I agree that tests shouldn't be installed but IIUC
it's a limitation of the node-build-system that copies recursively the
contents of the node_modules directory. I checked and it seems that
other packages using the node-build-system have the same problem (i.e.
node-color-name install test.js, node-far installs a test directory).
One way to fix this could be adding an extra phase (either to each
package or in the node-build-system with a special field indicating a
list of tests directories) where we delete the test directory from
node_modules preventing the copy.

On my system I get

orang3@frastanato ~/code/guix [env]$ du -sh
/gnu/store/5kkb1nya9ws12b2qxsn0r7904nx6v5b5-node-semver-7.2.1
732K /gnu/store/5kkb1nya9ws12b2qxsn0r7904nx6v5b5-node-semver-7.2.1

orang3@frastanato ~/code/guix [env]$ du -sh
/gnu/store/5kkb1nya9ws12b2qxsn0r7904nx6v5b5-node-semver-7.2.1/lib/node_modules/semver/test/
264K
/gnu/store/5kkb1nya9ws12b2qxsn0r7904nx6v5b5-node-semver-7.2.1/lib/node_modules/semver/test/

which is not much but amounts nearly to 1/3 of the total disk usage of
semver. If you believe that another phase deleting the tests would be
better I attached an attempt.

Giacomo
From 77ffe7c3a0be8e215f4f4ae0b780385ffe39c1a2 Mon Sep 17 00:00:00 2001
From: Giacomo Leidi <goodoldpaul@autistici.org>
Date: Wed, 8 Apr 2020 00:59:13 +0200
Subject: [PATCH] gnu: Add node-semver.

* gnu/packages/node-xyz.scm (node-semver): New variable.
---
gnu/packages/node-xyz.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (48 lines)
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 44236ec469..93328969e5 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -244,3 +245,34 @@ protocol used in @code{node-lynx}.")
(description "This package provides the Node.js @code{util.deprecate()}
function with browser support.")
(license license:expat)))
+
+(define-public node-semver
+ (package
+ (name "node-semver")
+ (version "7.2.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/npm/node-semver.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
+ (build-system node-build-system)
+ (arguments
+ `(#:tests? #f ;; FIXME: Tests depend on node-tap
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'install 'delete-tests-dir
+ (lambda _
+ ;; Delete tests to prevent installing them
+ (delete-file-recursively "test")
+ (delete-file-recursively "tap-snapshots")
+ #t)))))
+ (home-page "https://github.com/npm/node-semver")
+ (synopsis "Parses semantic versions strings")
+ (description
+ "@code{node-semver} is a JavaScript implementation of the
+@uref{https://semver.org/, SemVer.org} specification.")
+ (license license:isc)))
--
2.26.1
J
J
Julien Lepiller wrote on 15 Apr 2020 19:09
(address . 36599@debbugs.gnu.org)
E6B5A186-3A4A-43A4-A68E-0A9E174C823A@lepiller.eu
Le 15 avril 2020 11:36:06 GMT-04:00, goodoldpaul@autistici.org a écrit :
Toggle quote (35 lines)
>Hi Efraim,
>
>> Overall it looks good to me. I also checked npm¹ and it agrees that
>> there are no dependencies for this package. Do you happen to know why
>> there's a test directory installed? I don't know if it's supposed to
>be
>> there but it seems strange to me
>
>I didn't notice and I agree that tests shouldn't be installed but IIUC
>it's a limitation of the node-build-system that copies recursively the
>contents of the node_modules directory. I checked and it seems that
>other packages using the node-build-system have the same problem (i.e.
>node-color-name install test.js, node-far installs a test directory).
>One way to fix this could be adding an extra phase (either to each
>package or in the node-build-system with a special field indicating a
>list of tests directories) where we delete the test directory from
>node_modules preventing the copy.
>
>On my system I get
>
>orang3@frastanato ~/code/guix [env]$ du -sh
>/gnu/store/5kkb1nya9ws12b2qxsn0r7904nx6v5b5-node-semver-7.2.1
>732K /gnu/store/5kkb1nya9ws12b2qxsn0r7904nx6v5b5-node-semver-7.2.1
>
>orang3@frastanato ~/code/guix [env]$ du -sh
>/gnu/store/5kkb1nya9ws12b2qxsn0r7904nx6v5b5-node-semver-7.2.1/lib/node_modules/semver/test/
>264K
>/gnu/store/5kkb1nya9ws12b2qxsn0r7904nx6v5b5-node-semver-7.2.1/lib/node_modules/semver/test/
>
>which is not much but amounts nearly to 1/3 of the total disk usage of
>semver. If you believe that another phase deleting the tests would be
>better I attached an attempt.
>
>Giacomo

Does npm install the test.js files when run by ittself (in which case we replicate its behavior), or does it have a mechanism to know what files to install? If so we thould replicate that mecanism.
G
G
goodoldpaul wrote on 17 Apr 2020 16:54
(address . julien@lepiller.eu)(address . 36599@debbugs.gnu.org)
0dc7cf533fa5aa29a12e7b1da9532869@autistici.org
Hi Julien,

Toggle quote (4 lines)
> Does npm install the test.js files when run by ittself (in which case
> we replicate its behavior), or does it have a mechanism to know what
> files to install? If so we thould replicate that mecanism.

On my system I get

giacomo@frarch /tmp$ npm i semver
npm WARN saveError ENOENT: no such file or directory, open
'/tmp/package.json'
npm WARN enoent ENOENT: no such file or directory, open
'/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.

+ semver@7.3.2
added 1 package and audited 1 package in 0.626s
found 0 vulnerabilities

giacomo@frarch /tmp$ ls -l node_modules/semver/
total 48
drwxr-xr-x 2 giacomo giacomo 60 Apr 17 16:43 bin/
-rw-r--r-- 1 giacomo giacomo 2257 Oct 26 1985 CHANGELOG.md
drwxr-xr-x 2 giacomo giacomo 120 Apr 17 16:43 classes/
drwxr-xr-x 2 giacomo giacomo 520 Apr 17 16:43 functions/
-rw-r--r-- 1 giacomo giacomo 1982 Oct 26 1985 index.js
drwxr-xr-x 2 giacomo giacomo 120 Apr 17 16:43 internal/
-rw-r--r-- 1 giacomo giacomo 765 Oct 26 1985 LICENSE
-rw-r--r-- 1 giacomo giacomo 1645 Apr 17 16:43 package.json
-rw-r--r-- 1 giacomo giacomo 69 Oct 26 1985 preload.js
-rw-r--r-- 1 giacomo giacomo 619 Oct 26 1985 range.bnf
drwxr-xr-x 2 giacomo giacomo 260 Apr 17 16:43 ranges/
-rw-r--r-- 1 giacomo giacomo 22109 Oct 26 1985 README.md

so I believe that npm uses the "files" key [0] in package.json to decide
what to install.

I'm definitely available to implement that but it could take a week or
two, if we feel it should be changed right away I'm probably not the
best person to do that.

What do you think? Should I open another issue about this?

Giacomo

E
E
Efraim Flashner wrote on 17 Apr 2020 17:03
(address . goodoldpaul@autistici.org)
20200417150352.GB9867@E5400
On Fri, Apr 17, 2020 at 02:54:43PM +0000, goodoldpaul@autistici.org wrote:
Toggle quote (40 lines)
> Hi Julien,
>
> > Does npm install the test.js files when run by ittself (in which case we
> > replicate its behavior), or does it have a mechanism to know what files
> > to install? If so we thould replicate that mecanism.
>
> On my system I get
>
> giacomo@frarch /tmp$ npm i semver
> npm WARN saveError ENOENT: no such file or directory, open
> '/tmp/package.json'
> npm WARN enoent ENOENT: no such file or directory, open '/tmp/package.json'
> npm WARN tmp No description
> npm WARN tmp No repository field.
> npm WARN tmp No README data
> npm WARN tmp No license field.
>
> + semver@7.3.2
> added 1 package and audited 1 package in 0.626s
> found 0 vulnerabilities
>
> giacomo@frarch /tmp$ ls -l node_modules/semver/
> total 48
> drwxr-xr-x 2 giacomo giacomo 60 Apr 17 16:43 bin/
> -rw-r--r-- 1 giacomo giacomo 2257 Oct 26 1985 CHANGELOG.md
> drwxr-xr-x 2 giacomo giacomo 120 Apr 17 16:43 classes/
> drwxr-xr-x 2 giacomo giacomo 520 Apr 17 16:43 functions/
> -rw-r--r-- 1 giacomo giacomo 1982 Oct 26 1985 index.js
> drwxr-xr-x 2 giacomo giacomo 120 Apr 17 16:43 internal/
> -rw-r--r-- 1 giacomo giacomo 765 Oct 26 1985 LICENSE
> -rw-r--r-- 1 giacomo giacomo 1645 Apr 17 16:43 package.json
> -rw-r--r-- 1 giacomo giacomo 69 Oct 26 1985 preload.js
> -rw-r--r-- 1 giacomo giacomo 619 Oct 26 1985 range.bnf
> drwxr-xr-x 2 giacomo giacomo 260 Apr 17 16:43 ranges/
> -rw-r--r-- 1 giacomo giacomo 22109 Oct 26 1985 README.md
>
> so I believe that npm uses the "files" key [0] in package.json to decide
> what to install.
>

Thanks for looking into it.

Toggle quote (6 lines)
> I'm definitely available to implement that but it could take a week or two,
> if we feel it should be changed right away I'm probably not the best person
> to do that.
>
> What do you think? Should I open another issue about this?

I think we should fix it, but it shouldn't block getting your package
into Guix. Go ahead and open a new issue for it.

Toggle quote (8 lines)
>
> Giacomo
>
> [0]: https://github.com/npm/node-semver/blob/master/package.json#L21
>
>
>

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl6ZxVUACgkQQarn3Mo9
g1Ez5BAArRBvyE2TGRBggNLZZVUQaRF4enl2LNu68WyLc4dTVyWXnYJVdDSP4yu8
44LIfEbvGuknJrAMLzRFVDrMIkbzaT4GWbhyoWHb/SeCZrZrXWIoBIXo24xEbzHM
jIu3vLSyPDFNvLwp7pqzZEE9IleM/Q/CSNo1UvR/TzOTP7qGu82GBK92lln85Quv
ijLpKXl+ESzRAHaCJCGT3FOuU2/G6C3o3T5uZkA44zK9kbuo+kqcr6+E8xjskGN6
N90q5f49osNm4kI1cO0Oxf95TYezrIliAIQ4LtSBDeNehpyONqBr7e1qKqZN5O2F
W96KfyxNpi8DmqpUhl1sC0rJjJ/PoZam5hRZX1Z255Oad0hBviscMqkLTN2SrmJV
Y8lCG8vs+XLODA9Ij4EOMrdlXmic6vJE2iIIz7tcFSGL8HngRfeoHEoFp2E8mgYZ
PWqqGaKfhwOf5RZ8rXvOnR7dnzlG8Sg2VI8lQWY3tOxYETowAxacfmk5VgVJ9y42
cYzAIfKTsQoja8uGAru0eYIbhalJlUlc5bgsBHmYp3zMYgNGYoP4Rzz8rPbzs7d+
kuU1uhoXxj7xR7oYN+MSQeqIUMtldNIDnxo2y/kxp7Qh6Rw9RjaeUlA3gdfJGTvh
RyYWt+pNHquvnqxFD5POTCtVETNyLYPv7YyeOHxKV2PySp4Crgs=
=q62H
-----END PGP SIGNATURE-----


J
J
Julien Lepiller wrote on 17 Apr 2020 18:09
(address . goodoldpaul@autistici.org)(address . 36599@debbugs.gnu.org)
719EAB75-DF24-4FD0-AB89-1FFE4C7AF863@lepiller.eu
Le 17 avril 2020 10:54:43 GMT-04:00, goodoldpaul@autistici.org a écrit :
Toggle quote (52 lines)
>Hi Julien,
>
>> Does npm install the test.js files when run by ittself (in which case
>
>> we replicate its behavior), or does it have a mechanism to know what
>> files to install? If so we thould replicate that mecanism.
>
>On my system I get
>
>giacomo@frarch /tmp$ npm i semver
>npm WARN saveError ENOENT: no such file or directory, open
>'/tmp/package.json'
>npm WARN enoent ENOENT: no such file or directory, open
>'/tmp/package.json'
>npm WARN tmp No description
>npm WARN tmp No repository field.
>npm WARN tmp No README data
>npm WARN tmp No license field.
>
>+ semver@7.3.2
>added 1 package and audited 1 package in 0.626s
>found 0 vulnerabilities
>
>giacomo@frarch /tmp$ ls -l node_modules/semver/
>total 48
>drwxr-xr-x 2 giacomo giacomo 60 Apr 17 16:43 bin/
>-rw-r--r-- 1 giacomo giacomo 2257 Oct 26 1985 CHANGELOG.md
>drwxr-xr-x 2 giacomo giacomo 120 Apr 17 16:43 classes/
>drwxr-xr-x 2 giacomo giacomo 520 Apr 17 16:43 functions/
>-rw-r--r-- 1 giacomo giacomo 1982 Oct 26 1985 index.js
>drwxr-xr-x 2 giacomo giacomo 120 Apr 17 16:43 internal/
>-rw-r--r-- 1 giacomo giacomo 765 Oct 26 1985 LICENSE
>-rw-r--r-- 1 giacomo giacomo 1645 Apr 17 16:43 package.json
>-rw-r--r-- 1 giacomo giacomo 69 Oct 26 1985 preload.js
>-rw-r--r-- 1 giacomo giacomo 619 Oct 26 1985 range.bnf
>drwxr-xr-x 2 giacomo giacomo 260 Apr 17 16:43 ranges/
>-rw-r--r-- 1 giacomo giacomo 22109 Oct 26 1985 README.md
>
>so I believe that npm uses the "files" key [0] in package.json to
>decide
>what to install.
>
>I'm definitely available to implement that but it could take a week or
>two, if we feel it should be changed right away I'm probably not the
>best person to do that.
>
>What do you think? Should I open another issue about this?
>
>Giacomo
>
>[0]: https://github.com/npm/node-semver/blob/master/package.json#L21

We don't have to rush, and I won't implement that faster than you, so if you can and want to do it, please go ahead :). Opening a new bug to track that is a good idea. Can you do that?

Thank you!
E
E
Efraim Flashner wrote on 18 Apr 2020 20:39
(address . goodoldpaul@autistici.org)(address . 36599-done@debbugs.gnu.org)
20200418183909.GB4725@E5400
As we discussed in the other parts of this thread, I've pushed the patch
(without the extra phase to delete the tests) and closed the bug. Feel
free to open a bug about only installing the intended files.


--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl6bSU0ACgkQQarn3Mo9
g1F5mg/+IZp8zL6zvUeyzsW0qECD9ggYL9v0dEYVMmnInwualZNeM/1xHb28DC8l
0wa0J4KM7X7wYnNqSBt0zXLbNuVEniwBjrKpbykVVI5yIbYQtAobW6phiJaNOxRU
Ce5X7sXffiK4eUBGL58atBX7NmXfmY8Y6Jd1/srSye6Hsn68ZGprdz6Ie9wxiUOe
g5a+y3eLXV5/QbQ3dl146JId2NX9kCoHif0wFjQPwQkdhQNJKolQK2KcQfMDu4Gw
ghz/8DW+kL2lRA5MhLBq6F5FVP05cv9aEOv0u6PNKpucDkCu7bLbgOL7jVg6pgOB
rIUijncwKRq6lmjEHhayeT6LAAn3xr3tVXW10PdVHrZ5ok/CDUXom6Y1J/18vboG
mX+xMUmnAex6adkzr7+7H5oMFLUN0MW+b002T5f8IZB/cwLKdnt9VyN6K2SiX19L
jKcsgz06Q3R6CrG+KY7htPKyIXdqwCloE8YJcvB/Cv4kweab1FhlZAwxuSN2++dr
EMgIGB8Q/W2dOD378l3rNeYFeLAUzvu0irJLMEpQvekdGIekewH0w2YRWsyy4kLx
HjzGfaZLpGZXgjgtS3wwSs2qps7LiNCYhQGyp3dpDSzXno7DYxH5g7t/F1KIEIHs
7TjNFaHBUIm9XOSFMBwugEKipVqT0iNc89bJnacFMZLlHxmZKC8=
=1zLQ
-----END PGP SIGNATURE-----


Closed
?