From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kNRgIZ4WsWE0CQAAgWs5BA (envelope-from ) for ; Wed, 08 Dec 2021 21:33:34 +0100 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id AHkjHZ4WsWFXHQAAB5/wlQ (envelope-from ) for ; Wed, 08 Dec 2021 20:33:34 +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 1CE7C2DA27 for ; Wed, 8 Dec 2021 21:33:33 +0100 (CET) Received: from localhost ([::1]:53576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mv3d5-0004Kl-LL for larch@yhetil.org; Wed, 08 Dec 2021 15:33:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mv3a0-0006ls-4E for guix-patches@gnu.org; Wed, 08 Dec 2021 15:30:21 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58373) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mv3Zu-0000Rf-Vn for guix-patches@gnu.org; Wed, 08 Dec 2021 15:30:19 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mv3Zu-00061j-Su for guix-patches@gnu.org; Wed, 08 Dec 2021 15:30:14 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v3 29/43] gnu: Add node-sqlite3. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 08 Dec 2021 20:30:14 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51838 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51838@debbugs.gnu.org Received: via spool by 51838-submit@debbugs.gnu.org id=B51838.163899539322844 (code B ref 51838); Wed, 08 Dec 2021 20:30:14 +0000 Received: (at 51838) by debbugs.gnu.org; 8 Dec 2021 20:29:53 +0000 Received: from localhost ([127.0.0.1]:41633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv3ZY-0005wI-By for submit@debbugs.gnu.org; Wed, 08 Dec 2021 15:29:52 -0500 Received: from mail-vk1-f173.google.com ([209.85.221.173]:47003) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv3Yy-0005rE-NG for 51838@debbugs.gnu.org; Wed, 08 Dec 2021 15:29:18 -0500 Received: by mail-vk1-f173.google.com with SMTP id m16so2302168vkl.13 for <51838@debbugs.gnu.org>; Wed, 08 Dec 2021 12:29:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=HwHKjvqPi/qexahkWysEoNyVq/q9nvVYXJGGLFS5Zi8=; b=IGMAdZaqWuFoKQ3yzWDf4aWZ34FozJPDexdATGRs7/DlnN+na/UuyhSJBqtI/AmPNn w+B3qCaDVd+hHryv6S6NGl9M41yMN/nVK5MRaITRUYcs5OdznMGVDXb2h4GSFZPHXZh2 8rKW9Gu2E/Se+Q6eOSpW3N1qOhufl4QKOUNu3bvLMiszWB6UiDowqiJta6EcHbTPmMpA d0c9JM1y4UJ5JMsGiJJKFjgIr1dlTNieT364jFdYAVzzjhzBw38ybJg2+O2Y4Fcotz7z eaAckV0MfSwKqMbx4lx8YBpWvsBCucNTtIsmHUft4dFnXNmuwObXGZ6vZLyanHyYfGz/ n7PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HwHKjvqPi/qexahkWysEoNyVq/q9nvVYXJGGLFS5Zi8=; b=xH3yLTYHORPLIRPJmlqgZDmvmjrb26VOar2fpdi7OcJSHKcoIljyvUlQOM3x972aGq h7YL+wUDccv1i7VKMmDwbE4SNT7iddIE43j+ann2sWjkzVr8n77mOi+qCyC8wWCesKUK PFxPDw6vI/ksLf3zW/GvckCKRJ8Uc+9mKKXBFwS6zVL8AWlLQfLg7Yv8ja24ONXY8NVZ FY19E2ZuEyjRWbFzCQY5/lMAA0UvFd7o8qC0piKnvkI0Cx2QypP+mYDlG2RVmHd+PIWy JFmmEKoxURXpjWS9mVLifjGfUfB0s+gg7FJf2dIN4NYOazt4rxVjvS0e2He4aanHPABx 0Jug== X-Gm-Message-State: AOAM532DTlHbqyOsEhW7XIVRx9MEqE/qC/FubjBkb6OzfUrhXXudRP25 wuGSBoHRHGrJEAFokE6J6BKqeuh8EVtnh407hzE= X-Google-Smtp-Source: ABdhPJyTBgMlfBJVc8JfnlmzbyPzmyBvY/Fo/iz6l38744e+u6osDzEnnC/6kUvdktf/fzEhLfWglg== X-Received: by 2002:a05:6122:1812:: with SMTP id ay18mr1295277vkb.18.1638995351055; Wed, 08 Dec 2021 12:29:11 -0800 (PST) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with ESMTPSA id w22sm2636177vsk.11.2021.12.08.12.29.10 for <51838@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Dec 2021 12:29:10 -0800 (PST) From: Philip McGrath Date: Wed, 8 Dec 2021 15:28:24 -0500 Message-Id: <20211208202838.752542-30-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211208202838.752542-1-philip@philipmcgrath.com> References: <46a042bc08eb72a068b1e8c69bfe28cf2d4b2e53.camel@gmail.com> <20211208202838.752542-1-philip@philipmcgrath.com> 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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1638995614; 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:dkim-signature; bh=HwHKjvqPi/qexahkWysEoNyVq/q9nvVYXJGGLFS5Zi8=; b=NOrMbrxaAvsBP1ps3/sJAFZJOZQc3n1DzE+gQMdtZhChWX37XAFKRnVWCFtIENcRduUstn KwWazFB11UjO2D6eDIscNFPqNRdertb0vxLCZEdVCJbu6TwNfR+4r5OUCxYuW7cXALeKzw MwrJIbON3lOre2ugFzupoG8sFZg5KTNen8e0szGNIanZ0UiCQfBttT0qz9lPXruRHimc3l NyupEdQbnLG1HBxRUvGUHaH+uDYhIZEcebVNuIhyI0K3xH1MB1i2K9YYQ/hTjTJTHbWJmW YqwKW6UvPz1XVtvNK15WAr7T0cI8hJ5rP4JbP8ZpFj3MisP3fvkxjV+6QSCj2Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638995614; a=rsa-sha256; cv=none; b=saA6IQNAREE2+RNh8Y06atB8mrwIEM1NzGg2YMsAWjA05+4yRJTfRZRb0JP6Ay01rjYAE+ 5POCqJTcobP+pcpBMgOyyRHd9FW+cHX2tiJ3qimFSt3nUWlQ7XU0N4MzX2Urgod8Mek5qL e3XkYrS8KB3t5ThfmZsUjhPV5qA4K8YOrqI8FOa3LRTU7urlOAEOawzhGZTzptZ6xn5mtT heL848FB4X2xVBjQFuLvQvGgWWXevhYrnHtv3LsySSY8ihpJHksMifxa1zGmPKd1pkS6rL 4JUhIHRTXTCl7ZDNZxAA7Sy6M6lOGPBi2d93BpsbZ+5lcRCtfbIwBxzcDcCN/g== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=IGMAdZaq; dmarc=none; spf=pass (aspmx2.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.45 Authentication-Results: aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=IGMAdZaq; dmarc=none; spf=pass (aspmx2.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1CE7C2DA27 X-Spam-Score: -1.45 X-Migadu-Scanner: scn0.migadu.com X-TUID: CON+3YuuaJ5E * gnu/packages/node-xyz.scm (node-sqlite3): New variable. --- gnu/packages/node-xyz.scm | 118 +++++++++++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 3 deletions(-) diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm index 60dbfc163c..b979d0cd53 100644 --- a/gnu/packages/node-xyz.scm +++ b/gnu/packages/node-xyz.scm @@ -615,7 +615,8 @@ (define-public node-addon-api (sha256 (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch")))) (inputs - `(("python" ,python))) + `(("python" ,python) + ("node-safe-buffer" ,node-safe-buffer))) (build-system node-build-system) (arguments `(#:absent-dependencies @@ -630,8 +631,7 @@ (define-public node-addon-api "eslint-plugin-promise" "fs-extra" "path" - "pre-commit" - "safe-buffer") + "pre-commit") #:phases (modify-phases %standard-phases (add-after 'unpack 'skip-js-tests @@ -660,3 +660,115 @@ (define-public node-addon-api @code{libuv} (included in a project via @code{#include }) are not ABI-stable across Node.js major versions.") (license license:expat))) + +(define-public node-sqlite3 + (package + (name "node-sqlite3") + (version "5.0.2") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mapbox/node-sqlite3") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h")) + (snippet + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + ;; unbundle sqlite + (for-each delete-file-recursively + (find-files "deps" + (lambda (pth stat) + (gzip-file? pth))))))))) + (inputs + `(("node-addon-api" ,node-addon-api) + ("python" ,python) + ("sqlite" ,sqlite))) + (build-system node-build-system) + (arguments + `(#:tests? + #f ; FIXME: tests depend on node-mocha + #:modules + ((guix build node-build-system) + (guix build json) + (srfi srfi-1) + (ice-9 match) + (guix build utils)) + #:absent-dependencies + `(;; Normally, this is "built" using @mapbox/node-pre-gyp, + ;; which publishes or downloads pre-built binaries + ;; or falls back to building from source. + ;; Here, we patch out all of that and just build directly. + ;; It would be better to patch a version of @mapbox/node-pre-gyp + ;; that always builds from source, as Debian does, + ;; but there are a number of dependencies that need + ;; to be packaged or removed. + "@mapbox/node-pre-gyp" + "node-pre-gyp" ;; deprecated name still used in some places + "aws-sdk" + "@mapbox/cloudfriend" + ;; Confusingly, this is only a dependency beceuse of + ;; @mapbox/node-pre-gyp: with that removed, + ;; npm will use its own copy: + "node-gyp" + ;; These we'd like, we just don't have them yet: + "eslint" + "mocha") + #:phases + (modify-phases %standard-phases + (add-before 'configure 'npm-config-sqlite + ;; We need this step even if we do replace @mapbox/node-pre-gyp + ;; because the package expects to build its bundled sqlite + (lambda* (#:key inputs #:allow-other-keys) + (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite")))) + (add-after 'install 'patch-binding-path + (lambda* (#:key outputs #:allow-other-keys) + (with-directory-excursion + (string-append (assoc-ref outputs "out") + "/lib/node_modules/sqlite3/lib") + (match (find-files "binding" "\\.node$") + ((rel-path) + (with-atomic-file-replacement "sqlite3-binding.js" + (lambda (in out) + (format out "var binding = require('./~a');\n" rel-path) + (display "module.exports = exports = binding;\n" out)))))))) + (add-after 'patch-dependencies 'avoid-node-pre-gyp + (lambda args + (substitute* ".npmignore" + (("lib/binding") + "#lib/binding # <- patched for Guix")) + (with-atomic-file-replacement "package.json" + (lambda (in out) + (let* ((js (read-json in)) + (alist (match js + (('@ . alist) alist))) + (scripts-alist (match (assoc-ref alist "scripts") + (('@ . alist) alist))) + (scripts-alist + ;; install script would use node-pre-gyp + (assoc-remove! scripts-alist "install")) + (alist + (assoc-set! alist "scripts" (cons '@ scripts-alist))) + (binary-alist (match (assoc-ref alist "binary") + (('@ . alist) alist))) + (js (cons '@ alist))) + ;; compensate for lack of @mapbox/node-pre-gyp + (setenv "GYP_DEFINES" + (string-append + "module_name=" + (assoc-ref binary-alist "module_name") + " " + "module_path=" + (assoc-ref binary-alist "module_path"))) + (write-json js + out))))))))) + (home-page "https://github.com/mapbox/node-sqlite3") + (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js") + (description + "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous, +non-blocking bindings for SQLite3, written in modern C++ and tested for memory +leaks.") + (license license:bsd-3))) -- 2.32.0