From patchwork Thu Dec 30 07:38:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 35767 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 C30AD27BBEA; Thu, 30 Dec 2021 07:43:09 +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 8ADCA27BBE9 for ; Thu, 30 Dec 2021 07:43:09 +0000 (GMT) Received: from localhost ([::1]:53504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2q5c-0007j9-Ng for patchwork@mira.cbaines.net; Thu, 30 Dec 2021 02:43:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2q4Z-0007KJ-AS for guix-patches@gnu.org; Thu, 30 Dec 2021 02:42:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39451) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2q4Y-00080r-Vr for guix-patches@gnu.org; Thu, 30 Dec 2021 02:42:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n2q4Y-0006Yq-Tl for guix-patches@gnu.org; Thu, 30 Dec 2021 02:42:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Dec 2021 07:42:02 +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.164085007524983 (code B ref 51838); Thu, 30 Dec 2021 07:42:02 +0000 Received: (at 51838) by debbugs.gnu.org; 30 Dec 2021 07:41:15 +0000 Received: from localhost ([127.0.0.1]:50963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2q3m-0006Ul-RQ for submit@debbugs.gnu.org; Thu, 30 Dec 2021 02:41:15 -0500 Received: from mail-ua1-f41.google.com ([209.85.222.41]:42918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2q3c-0006T3-Sv for 51838@debbugs.gnu.org; Thu, 30 Dec 2021 02:41:05 -0500 Received: by mail-ua1-f41.google.com with SMTP id p1so19174104uap.9 for <51838@debbugs.gnu.org>; Wed, 29 Dec 2021 23:41:04 -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=ne8pGJ9kUtXMj5bwYXTGGl5XtxTwLREPsPAiNa/6+bI=; b=a2itEVbw1crUFFIZTMDmR9MsE654TVEaBaJumtTonQS8reFJLS49C4YhYpdIYA+yTq Jzvm4xke7NsfTTalpp7wUHRF0Fo6y4gorhDnK+w3l9FNihzAeWiSSHr+q7ua/W6ubHql 9PYrO8i6qKh6s7VxdgL3hD8OFmVp/B3So9P3+TWRGC0r54UvM7BoYkAY7MDs3TUYaEXZ cb8hv5UnTPWfEEEzVDjPKsOvVnsQPeqfjeb1yi8nKpvo2+L9DO7xl01Au8fadGdiwSse iHKDyIumos1gF5z5g8SolQ4UCNuQrnAKZwEXNLsg3IXWTBS+r/ytsZXlqbB0kPRrgjYc 0uuw== 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=ne8pGJ9kUtXMj5bwYXTGGl5XtxTwLREPsPAiNa/6+bI=; b=p8hgsVzKwoiaqAR35QUNZCVtXTdQjqric8sqFxre6HgXWCXisXmC2qSzHDZZT5hY0g MPv2BVHIidZQ33rwDqr6jicVnwKQiPN7QzDh1hTOmIf98oBvR8JLQnff4ux3MN0QEBGh LSflBIFXanwi9wPLqoUjdnsDJoQJJGkYMx/YgyMPJ+/r6y/D1KEwxh2EVFh3N7sUMPov zvBi+1FmI3g+wKQXAbC73Vp0DjdSBwFF0HPEhlW24olfWZGqAJSggzzjC1HDslWuP2Fn Q2YsFoyo+CIlWqrDxfweKIx25tP6PKNRENLzpoBNlrcHxY9zYUKBSn2CeHG8B/xwgwhG 9dNg== X-Gm-Message-State: AOAM530Aednjs+oW4qT86kUC9FqF7zBiiS4xUb38Q3weraG8Cc03nWeE HsOzPdZZgoNrn+XHlh8kQz6V/vPFsWrjszpH X-Google-Smtp-Source: ABdhPJye95wIi/kc2ltOwkDr3m92jFT71CQtpAmUDQwQwI549SEKlmUlSbIP+Jg6bhnHnM03iC7ZEQ== X-Received: by 2002:a05:6102:1358:: with SMTP id j24mr8944436vsl.60.1640850059475; Wed, 29 Dec 2021 23:40:59 -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 z11sm4017626uac.13.2021.12.29.23.40.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Dec 2021 23:40:59 -0800 (PST) From: Philip McGrath Date: Thu, 30 Dec 2021 02:38:43 -0500 Message-Id: <20211230073919.30327-6-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211230073919.30327-1-philip@philipmcgrath.com> References: <082a81964a43ae5f735ad2ca433d0dfe00859c35.camel@gmail.com> <20211230073919.30327-1-philip@philipmcgrath.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 * guix/build/node-build-system.scm (delete-dependencies): New exported procedure. Functionally updates a "package.json"-like value by removing specified npm packages from the "dependencies" and "devDependencies" objects. --- guix/build/node-build-system.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm index dc8b6a41c2..9967223b86 100644 --- a/guix/build/node-build-system.scm +++ b/guix/build/node-build-system.scm @@ -27,6 +27,7 @@ (define-module (guix build node-build-system) #:use-module (srfi srfi-1) #:export (%standard-phases with-atomic-json-file-replacement + delete-dependencies node-build)) ;; Commentary: @@ -325,6 +326,23 @@ (define resolve-dependencies deps)))))) #t) +(define (delete-dependencies pkg-meta absent-dependencies) + "Functionally update PKG-META, a json object corresponding to a +'package.json' file, to allow building without the ABSENT-DEPENDENCIES. To +avoid reintroducing the ABSENT-DEPENDENCIES, only use this procedure after the +'patch-dependencies' phase." + (define delete-fom-jsobject + (match-lambda + (('@ . alist) + (cons '@ (filter (match-lambda + ((k . v) + (not (member k absent-dependencies)))) + alist))))) + (jsobject-update* + pkg-meta + "devDependencies" '(@) delete-fom-jsobject + "dependencies" '(@) delete-fom-jsobject)) + (define* (delete-lockfiles #:key inputs #:allow-other-keys) "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they exist."