From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6MJBHQJjzWHgxgAAgWs5BA (envelope-from ) for ; Thu, 30 Dec 2021 08:42:58 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 6DPxFQJjzWHjXAEAG6o9tA (envelope-from ) for ; Thu, 30 Dec 2021 08:42:58 +0100 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 aspmx1.migadu.com (Postfix) with ESMTPS id 207B8BBDC for ; Thu, 30 Dec 2021 08:42:58 +0100 (CET) Received: from localhost ([::1]:53504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2q5R-0007j9-94 for larch@yhetil.org; Thu, 30 Dec 2021 02:42:57 -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 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=1640850178; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=ne8pGJ9kUtXMj5bwYXTGGl5XtxTwLREPsPAiNa/6+bI=; b=MVVd5DdXqv4ofse8kv8GIdrV0kECIvaTEyOnjHWH1yyRtrUMUvPIDK5cL4jWR9q4GeRjuZ w/BUQ3imae3CgJUOQNc50SWp9bgKAsdQv2TVp6WKyWmpgaG+set7aJ7KPUDSkDj7YW1/BI U9RJd6oGVKQ6LQtJa7cnSMV1/qaFQ9uv57mh417w0z0dt9i5YUFAnGX3RNfGnP++DO4cJy qMinoM1segkJ0JXQQICnti76JQj2BGXR9K6sIzGPlXzFIgB/jmZVuueXbLEuflltAKST7w d60OaGjPwpl+jg6G9SLzcKihyBcGoHWoNPCYfQ6zmi2gNS854tMBH/C4yrL+wg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640850178; a=rsa-sha256; cv=none; b=OqpDISmx/PS5YDxGRw7yqV/fVwfB594N8YY7yfbl9djYDGFaaf1voUnrMluF90hnvCdTTC nNpe+gyO0ywye+xduPIaE6HgjC8JceCscFf7g0SG1TNHKfoAX+9bRGR1vIzVRfQbaI0ehZ 3QVrJiVF5t/RwdWd6ezxhwpE1m/Q0FRa9ReQdOyv9Zgk31alLzhzyuB3cA2QrxWkWfdlIL OBI6c9GZx0Wrrpw+ALY3wIcxFBGGGg+EPUnWahD4pA5/jYUZC00iB75kXKSYMhfCb4IcFd LLDwNXN5drxbCQq3PIQ+NrDzm6aWz3WchPt1hs7rWHPoCbX0jHrKXHTXJJ6i6A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=a2itEVbw; dmarc=none; spf=pass (aspmx1.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: 0.93 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=a2itEVbw; dmarc=none; spf=pass (aspmx1.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: 207B8BBDC X-Spam-Score: 0.93 X-Migadu-Scanner: scn1.migadu.com X-TUID: uM2v4yDXX9Nn * 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." -- 2.32.0