From patchwork Thu Dec 30 07:38:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 531 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 93C9627BBE9; Thu, 30 Dec 2021 07:41:55 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D098D27BBEA for ; Thu, 30 Dec 2021 07:41:54 +0000 (GMT) Received: from localhost ([::1]:52452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2q4P-0006rd-6k for patchwork@mira.cbaines.net; Thu, 30 Dec 2021 02:41:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2q3a-0006om-Iu for guix-patches@gnu.org; Thu, 30 Dec 2021 02:41:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2q3a-0007sF-9I for guix-patches@gnu.org; Thu, 30 Dec 2021 02:41:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n2q3Z-0006TQ-Uk for guix-patches@gnu.org; Thu, 30 Dec 2021 02:41:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Dec 2021 07:41:01 +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 Cc: Timothy Sample , Pierre Langlois , Jelle Licht , Philip McGrath , Liliana Marie Prikler Received: via spool by 51838-submit@debbugs.gnu.org id=B51838.164085004524813 (code B ref 51838); Thu, 30 Dec 2021 07:41:01 +0000 Received: (at 51838) by debbugs.gnu.org; 30 Dec 2021 07:40:45 +0000 Received: from localhost ([127.0.0.1]:50944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2q3J-0006S9-6Q for submit@debbugs.gnu.org; Thu, 30 Dec 2021 02:40:45 -0500 Received: from mail-ua1-f41.google.com ([209.85.222.41]:43728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2q3B-0006Ri-AY for 51838@debbugs.gnu.org; Thu, 30 Dec 2021 02:40:44 -0500 Received: by mail-ua1-f41.google.com with SMTP id i5so26200986uaq.10 for <51838@debbugs.gnu.org>; Wed, 29 Dec 2021 23:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2v2HHbRJ2nYQ1/JvKI71mn0S9IkGm1njr+iKd9iz2Pg=; b=VALSa1FzyGQNO7Lhv2nnMbY1LTWa/hHssd5N3F6juKmpkotZFa8vp3jYiLbLN8JlFf SnIl/rUTlLqZL7vZcKrxpwWGYh+o5M2Et+ssQrm5W5IG2cr6ywLwTOJPnqWjFuTNkRhr CCP9fPQ07j3FLNn0ltIOE2rhOe1wqB0RUp5Lu4B7KoksNEw0SK4s/c099TeWEfp4X/bL dzoTqIRgnjwXbH96h8QBDvhkh6OCCQ4wWChKh8OSsSy/Yd91iwkwzAmmRx80gdQA9z6O SUMZyC6hXi6F5lQnkKK9BKpK3fAZ8YlKF0vCpGTNZAaz/J/uWF7eJfxRpuPfjCqRnZR8 PjSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2v2HHbRJ2nYQ1/JvKI71mn0S9IkGm1njr+iKd9iz2Pg=; b=6gJ0ervimZrT84WXhskpzCJEE1rvPEeXgDRfy8XXKilLWwTyb5iknnwKlNSM5AGxW+ gAWf0QGreGZkmBWcwXazv5igScJr8jrVjAH6mpGnI45hN9d4Mz4tvIY6nm0EGpfdLyw6 /xH+4ioHAF4R8Jbe5CqR67jWAFOL64viqLKA/x6vUJ4RgSYD6UYiPfXEOSKlFvuOvGIr hwhJrmbekOrbuaM2UD3cbJAj6XZwcocb2FwcLWEBPXIubOBYTc4JGxua6187fpwP3Lgy 2TGCEgB4DirNPmQrY63WSy3QT5oq1wHjExxTZMii3PqbAnMLTjvG/rwDlNO7T8H/7BNS HEsw== X-Gm-Message-State: AOAM531vxawu0R/aVmDANOuHz7yUqZTwnZKx26a7g6I0ZCkT79Dwfigy rz8bDUv/L0VGG9tFoRFw5wPCmJH1VW9nh7Sf X-Google-Smtp-Source: ABdhPJxjWffXZkRwo7JxUI2O/rj6CxAEoXgIev/jAjQNr1sYnrrthSkO3tFJ9Tl0rHDHZBu3oTCxNg== X-Received: by 2002:a05:6102:316e:: with SMTP id l14mr9080927vsm.8.1640850031573; Wed, 29 Dec 2021 23:40:31 -0800 (PST) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with UTF8SMTPSA id f20sm4688564vsl.31.2021.12.29.23.40.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Dec 2021 23:40:31 -0800 (PST) From: Philip McGrath Date: Thu, 30 Dec 2021 02:38:38 -0500 Message-Id: <20211230073919.30327-1-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <082a81964a43ae5f735ad2ca433d0dfe00859c35.camel@gmail.com> References: <082a81964a43ae5f735ad2ca433d0dfe00859c35.camel@gmail.com> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi Liliana (and everyone), Thanks for taking care of the earlier patches from the series! It sounds like (guix build json) is going to be around for a reasonably long time, and I'm ok with that. In the hope of clearing a path to move forward, I'm sending v6 of this patch series, immediately followed by a closely-related v7: I strongly prefer v7, but I would be ok with either version being applied if one of them can achieve consensus. (If v6 is merged, I'll send a separate patch series to propose '#:absent-dependencies'.) I've put the two versions up on GitLab as and , respectively. I've re-organized the patches in the series somewhat to facilitate a minimal, side-by-side comparison between '#:absent-dependencies' and this approach: On 12/20/21 17:00, Liliana Marie Prikler wrote: > (add-after 'patch-dependencies 'drop-junk > (lambda _ > (with-atomic-json-replacement "package.json" > (lambda (json) (delete-dependencies json '("node-tap")))))) The series is now organized as follows: - The first 4 patches are identical in v6 and v7: - Patches 01 & 02/41 are non-controversial build system changes ('delete-lockfiles' and libuv). - Patch 03/41 adds to (guix build node-build-system) several utility functions for transforming JSON in the representation used by (guix build json), especially functional update of tagged JSON objects. It also adjusts the rest of (guix build node-build-system) to make use of those functions, eliminating all uses of 'assoc-set!' and other procedures that mutate assosciation lists. Of the new functions, only 'with-atomic-json-file-replacement' is exported for now: my hope is that further (valuable and important!) discussion about the API design of these functions or their implementations need not block either v6 or v7 of this series. - Patch 04/41 adds the 'avoid-node-gyp-rebuild' phase. I've re-worked the implementation to use the new helper functions. - Patch 05/41 is the truly significant difference between v6 and v7: it implements the strategy for dealing with missing dependencies. In v6, it exports a new public function 'delete-dependencies' from (guix build node-build-system). In v7, it adds '#:absent-dependencies'. One difference from previous versions of this series is that it handles '#:absent-dependencies' in a new 'delete-dependencies' phase, which makes the change even more self-contained. - Patches 06 through 17/41 adjust existing packages to make use of the approach to missing dependencies from patch 05/41 of each series. - Patches 18 through 41/41 add the new packages excercising native addon support, again differing based on the approach from patch 05/41. The other slight difference from previous versions of this series is that, where applicable, I've adjusted the new package definitions to use 'with-atomic-json-file-replacement' and never to use 'assoc-set!' or other procedures that mutate assosciation lists. I continue to think that '#:absent-dependencies' is a good approach, in brief, as Jelle put it in , because: On 12/20/21 18:10, Jelle Licht wrote: > Liliana Marie Prikler writes: >> Am Montag, dem 20.12.2021 um 14:33 -0500 schrieb Philip McGrath: >>> If we took your final suggestion above, I think we'd have something >>> like this: >>> >>> ``` >>> #:phases >>> (modify-phases %standard-phases >>> (add-after 'unpack 'delete-dependencies >>> (make-delete-dependencies-phase '("node-tap")))) >>> ``` >>> >>> That seems pretty similar to, under the current patch series: >>> >>> ``` >>> #:absent-dependencies '("node-tap") >>> ``` >> That is the point, but please don't add a function called "make-delete- >> dependencies-phase". We have lambda. We can easily add with-atomic- >> json-replacement. We can also add a "delete-dependencies" function >> that takes a json and a list of dependencies if you so want. >> >> So in short >> >> (add-after 'patch-dependencies 'drop-junk >> (lambda _ >> (with-atomic-json-replacement "package.json" >> (lambda (json) (delete-dependencies json '("node-tap")))))) >> >> would be the "verbose" style of disabling a list of dependencies. >> > > I think you are _really_ underestimating how many packages will need a > phase like this in the future. I would agree with this approach if it > were only needed incidentally, similar to the frequency of patching > version requirements in setup.py or requirements.txt for python > packages. > > Pretty much everything except the '("node-tap") list will be identical > between packages; how do you propose we reduce this duplication? At this > point I feel like I'm rehasing the opposite of your last point, so let > me rephrase; how many times do you want to see/type/copy+paste the above > snippet before you would consider exposing this functionality on a > higher level? > Additionally, I think having a phase in '%standard-phases' is a good way of addressing the need to use 'delete-dependencies' after the 'patch-dependencies' phase, which I explain in patch v6 05/41. But, again, I could live with either v6 or v7 being applied if one of them can achieve consensus. So, without further ado, here is v6! -Philip Philip McGrath (41): guix: node-build-system: Add delete-lockfiles phase. guix: node-build-system: Add implicit libuv input. guix: node-build-system: Add JSON utilities. guix: node-build-system: Add avoid-node-gyp-rebuild phase. guix: node-build-system: Add 'delete-dependencies' helper function. gnu: node-semver-bootstrap: Use 'delete-dependencies'. gnu: node-ms-bootstrap: Use 'delete-dependencies'. gnu: node-binary-search-bootstrap: Use 'delete-dependencies'. gnu: node-debug-bootstrap: Use 'delete-dependencies'. gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'. gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'. gnu: node-llparse-bootstrap: Use 'delete-dependencies'. gnu: node-semver: Use 'delete-dependencies'. gnu: node-wrappy: Use 'delete-dependencies'. gnu: node-once: Use 'delete-dependencies'. gnu: node-irc-colors: Use 'delete-dependencies'. gnu: node-irc: Use 'delete-dependencies'. gnu: Add node-inherits. gnu: Add node-safe-buffer. gnu: Add node-string-decoder. gnu: Add node-readable-stream. gnu: Add node-nan. gnu: Add node-openzwave-shared. gnu: Add node-addon-api. gnu: Add node-sqlite3. gnu: Add node-file-uri-to-path. gnu: Add node-bindings. gnu: Add node-segfault-handler. gnu: Add node-ms. gnu: Add node-debug. gnu: Add node-serialport-binding-abstract. gnu: Add node-serialport-parser-delimiter. gnu: Add node-serialport-parser-readline. gnu: Add node-serialport-bindings. gnu: Add node-serialport-parser-regex. gnu: Add node-serialport-parser-ready. gnu: Add node-serialport-parser-inter-byte-timeout. gnu: Add node-serialport-parser-cctalk. gnu: Add node-serialport-parser-byte-length. gnu: Add node-serialport-stream. gnu: Add node-serialport. gnu/packages/node-xyz.scm | 1013 +++++++++++++++++++++++++++++- gnu/packages/node.scm | 78 ++- gnu/packages/zwave.scm | 64 ++ guix/build-system/node.scm | 9 +- guix/build/node-build-system.scm | 355 ++++++++++- 5 files changed, 1464 insertions(+), 55 deletions(-)