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: > Le 2 septembre 2019 14:49:08 GMT+02:00, "Ludovic Courtès" > a écrit : >> Hi Giacomo, >> >> This patch seems to have been forgotten… >> >> Giacomo Leidi 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.