From patchwork Mon Sep 2 17:13:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Giacomo Leidi X-Patchwork-Id: 15270 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 B8CEE17354; Mon, 2 Sep 2019 18:14:22 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 450F717348 for ; Mon, 2 Sep 2019 18:14:22 +0100 (BST) Received: from localhost ([::1]:38692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4puH-00012U-GP for patchwork@mira.cbaines.net; Mon, 02 Sep 2019 13:14:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58016) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4ptz-00012I-V7 for guix-patches@gnu.org; Mon, 02 Sep 2019 13:14:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i4pty-0007Qo-Bk for guix-patches@gnu.org; Mon, 02 Sep 2019 13:14:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50090) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i4ptx-0007QO-Rh for guix-patches@gnu.org; Mon, 02 Sep 2019 13:14:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i4ptx-00037q-KE for guix-patches@gnu.org; Mon, 02 Sep 2019 13:14:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#36599] [PATCH] gnu: Add node-semver. Resent-From: goodoldpaul@autistici.org Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 02 Sep 2019 17:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36599 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 36599@debbugs.gnu.org Received: via spool by 36599-submit@debbugs.gnu.org id=B36599.156744439911938 (code B ref 36599); Mon, 02 Sep 2019 17:14:01 +0000 Received: (at 36599) by debbugs.gnu.org; 2 Sep 2019 17:13:19 +0000 Received: from localhost ([127.0.0.1]:58911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i4ptC-00036O-DL for submit@debbugs.gnu.org; Mon, 02 Sep 2019 13:13:19 -0400 Received: from latitanza.investici.org ([82.94.249.234]:43263) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i4pt9-00036E-Cs for 36599@debbugs.gnu.org; Mon, 02 Sep 2019 13:13:12 -0400 Received: from contumacia-webmail.investici.org (contumacia.vpn0.investici.org [10.0.0.11]) by latitanza.investici.org (Postfix) with ESMTP id 844EA1204DA for <36599@debbugs.gnu.org>; Mon, 2 Sep 2019 17:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1567444389; bh=aRoDky4gwR1d8gYHPuMzAT1HVXf4Hjz+0qcFSXf1E50=; h=Date:From:To:Subject:In-Reply-To:References:From; b=cmlw5J/5Kmnzb4PWGbkKbh0uDa/dGXaLBkXQbLHAIAaVHux7g3z3s8QbGM6vVUsSm TdWpcZsyXDNhStV4bUMixBaNv/wa9Snx/Rk7bcWimug1dbujgQMTS5h57v1J+rItU1 8iwcZm/rnTPcUFje5iMVyc0LIU+Va8SsrWD3oGwA= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: goodoldpaul@autistici.org) by contumacia-webmail.investici.org (Postfix) with ESMTPA id 6B467C06F6 for <36599@debbugs.gnu.org>; Mon, 2 Sep 2019 17:13:09 +0000 (UTC) MIME-Version: 1.0 Date: Mon, 02 Sep 2019 17:13:09 +0000 From: goodoldpaul@autistici.org In-Reply-To: <74DCA7FB-6960-4E6A-8DB5-326E065B5DEB@lepiller.eu> References: <20190711121221.16123-1-goodoldpaul@autistici.org> <87a7bmamnv.fsf@gnu.org> <74DCA7FB-6960-4E6A-8DB5-326E065B5DEB@lepiller.eu> Message-ID: X-Sender: goodoldpaul@autistici.org User-Agent: Roundcube Webmail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 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. From 88991ab20c81b86ae82ed9c7102d3cd163ee3f98 Mon Sep 17 00:00:00 2001 From: Giacomo Leidi 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 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 # Copyright © 2019 Guillaume Le Vaillant # Copyright © 2019 John Soo +# Copyright © 2019 Giacomo Leidi # # 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 +;;; +;;; 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 . + +(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