From patchwork Wed Dec 8 20:28:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 35047 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 7DDA227BBEA; Wed, 8 Dec 2021 20:31:38 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 0961D27BBE9 for ; Wed, 8 Dec 2021 20:31:38 +0000 (GMT) Received: from localhost ([::1]:49412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mv3bF-0001M3-4s for patchwork@mira.cbaines.net; Wed, 08 Dec 2021 15:31:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mv3a0-0006lr-3y for guix-patches@gnu.org; Wed, 08 Dec 2021 15:30:21 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58364) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mv3Zq-0000RM-5k 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 1mv3Zq-00060Y-2a for guix-patches@gnu.org; Wed, 08 Dec 2021 15:30:10 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v3 20/43] guix: node-build-system: Add delete-lockfiles phase. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 08 Dec 2021 20:30:10 +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.163899536222692 (code B ref 51838); Wed, 08 Dec 2021 20:30:10 +0000 Received: (at 51838) by debbugs.gnu.org; 8 Dec 2021 20:29:22 +0000 Received: from localhost ([127.0.0.1]:41605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv3Z3-0005tp-H0 for submit@debbugs.gnu.org; Wed, 08 Dec 2021 15:29:21 -0500 Received: from mail-ua1-f41.google.com ([209.85.222.41]:44638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv3Yq-0005pf-G9 for 51838@debbugs.gnu.org; Wed, 08 Dec 2021 15:29:15 -0500 Received: by mail-ua1-f41.google.com with SMTP id p2so6851394uad.11 for <51838@debbugs.gnu.org>; Wed, 08 Dec 2021 12:29:08 -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=GmQf+3nyLP4yk1qa1kKSk5fMjvztBAE12UbCFxQNkvY=; b=h9IolEJnWkmuHo/bCQbPmsSBo5X/7BndU8II0cCMyki42VSeIikQCNgNSMDV1e7T09 z6LuaYH+XSE8lAqLx8ehdfaA7LXAzlWM8aqlVZcaVcMxE1gzS0YRqvEsWlFtMfWJCsdM Nb8lyoxMT2w0OIKlTRVl8LESMi+OlPYKYPpGkdmY0D4Trr8Rvbo6BJ3nb/3BU24eUa0j 0vLBd0JCIC/ITvuPoyJULSn8lJXdriBiRGkUn1R4QVJzIzkTKpc7P6YGVHQ0t+Ptrp/f MGLZdqDYsPsDCu/5Lvi9DjeBQzBbltx1eHVZDHYHiCTYRnBYtmUpNFeDZBipse24k/3s T31w== 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=GmQf+3nyLP4yk1qa1kKSk5fMjvztBAE12UbCFxQNkvY=; b=o1Czd+SKkp/qAyNlI4cZthugL9OUiCpeF/irmmcI7JYL3aeVp8Tf0f/neUf8ugdc5d 1eF2X3FvFct/ceMGLUnu+hZXl/u++VK7VGNqO/dNztUdq07i7xJPeB2eO0ezg+zJxRSW +v1ab4QTiLGP4Jk0E9xn1RB1y7hKgtOSyfouImBCzcSy2luc5Hq1mXoX7wBrd763Ard1 WMUAwYCb7dQJiYtOJq2VKQSD7WKv+dLdufqy1eAJsmybc9oVyVbOa0BbJVx1wabEDShg eJBY5LoN75q4XEt3LDV3VF/6fWLv8sY8SrVW6w4HePpQueJejRoYMumPF3OGaVxqGNC5 evBg== X-Gm-Message-State: AOAM532CXFd3XLPvn6M6VAFZWbIVhvXBhRGC7op6aZEnQhqGGi+HWXOB hnJkAJ+MIYyRSUh/UKqhTOc0gHjWjfnKGaczbzU= X-Google-Smtp-Source: ABdhPJylVEkCxiJqA6C1ioMt9LJ91O4WD29rIEnyC526CdRzM2/QpEhu63BQ/q48KdB58g3Na2dJJA== X-Received: by 2002:a9f:2c4a:: with SMTP id s10mr11151294uaj.50.1638995341962; Wed, 08 Dec 2021 12:29:01 -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 q26sm2648089vsp.23.2021.12.08.12.29.01 for <51838@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Dec 2021 12:29:01 -0800 (PST) From: Philip McGrath Date: Wed, 8 Dec 2021 15:28:15 -0500 Message-Id: <20211208202838.752542-21-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 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-lockfiles): New function. Remove 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they exist. Because these files specify dependency both exact versions and integrity hashes, they only cause problems for Guix. (%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'. --- gnu/packages/node.scm | 12 ------------ guix/build/node-build-system.scm | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index 6d48816c77..5289e2fe4f 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -488,12 +488,6 @@ (define-public node-llparse-builder-bootstrap "typescript") #:phases (modify-phases %standard-phases - (add-before 'configure 'remove-package-lock - ;; Having package-lock.json seems to cause npm - ;; to look for things on the internet in the configure phase, - ;; even if we have them properly installed. - (lambda args - (delete-file-recursively "package-lock.json"))) (replace 'build (lambda* (#:key inputs #:allow-other-keys) (let ((esbuild (string-append (assoc-ref inputs "esbuild") @@ -621,12 +615,6 @@ (define-public node-llparse-bootstrap "typescript") #:phases (modify-phases %standard-phases - (add-before 'configure 'remove-package-lock - ;; Having package-lock.json seems to cause npm - ;; to look for things on the internet in the configure phase, - ;; even if we have them properly installed. - (lambda args - (delete-file-recursively "package-lock.json"))) (replace 'build (lambda* (#:key inputs #:allow-other-keys) (let ((esbuild (string-append (assoc-ref inputs "esbuild") diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm index 249b3deee6..892104b6d2 100644 --- a/guix/build/node-build-system.scm +++ b/guix/build/node-build-system.scm @@ -118,6 +118,17 @@ (define (resolve-dependencies meta-alist meta-key) (write-json package-meta out)))) #t) +(define* (delete-lockfiles #:key inputs #:allow-other-keys) + "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they +exist." + (for-each (lambda (pth) + (when (file-exists? pth) + (delete-file pth))) + '("package-lock.json" + "yarn.lock" + "npm-shrinkwrap.json")) + #t) + (define* (configure #:key outputs inputs #:allow-other-keys) (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm"))) (invoke npm "--offline" "--ignore-scripts" "install") @@ -168,6 +179,7 @@ (define %standard-phases (modify-phases gnu:%standard-phases (add-after 'unpack 'set-home set-home) (add-before 'configure 'patch-dependencies patch-dependencies) + (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles) (replace 'configure configure) (replace 'build build) (replace 'check check)