From patchwork Mon Apr 28 16:23:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42120 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 9671427BC4A; Mon, 28 Apr 2025 17:34:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 7081827BC49 for ; Mon, 28 Apr 2025 17:34:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPl-0007tJ-9z; Mon, 28 Apr 2025 12:33:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u9ROw-0007b1-FI for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:14 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u9ROu-0004OA-Vs; Mon, 28 Apr 2025 12:32:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=vz0BB2zDWaXfFQtsQEoFu6+jA9vZY8RfyoKzYSzTNVk=; b=EangmPc18oKh3z8245yXunpJ6YbRIDHGPtYz7Qhj0cE2FxgIaBvXmSkjW3UTjECeprWehRutM2UzmxWcdGhyzltZJtqLKz/Loa/cw5am4mr9s5vN+ltW4Fa4XoPIxhRGhZdj5tH7O21gaKYOzgpjG7988xZTmq5Q9kHAhwsNQOW5SMqZg3xofqbTnKdXP5sdmDVkBYdafM0ZqkXCRLSEliGxkLh+5gVhIGT7ydbYbwAu4WkxPdm8/WjtfGFHQsrEsLNryb3ifDabRsmc5/kPE/lQOPq29LsQZfwLWjNHppIl8sANw1jf98myJaFH/C6M0bjZ6RCGuuQHONDvooHqgQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROt-0003I6-K5; Mon, 28 Apr 2025 12:32:11 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 05/22] scripts: import: Skip existing definition for =?utf-8?b?4oCYLS1pbnNlcnTigJk=?= option. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:11 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585789512209 (code B ref 77093); Mon, 28 Apr 2025 16:32:11 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:35 +0000 Received: from localhost ([127.0.0.1]:32830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROG-0003AC-2g for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:34 -0400 Received: from mail.boiledscript.com ([2a01:4f8:242:4aeb::42]:50944) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9RO9-00038c-4Q for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:25 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857883; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vz0BB2zDWaXfFQtsQEoFu6+jA9vZY8RfyoKzYSzTNVk=; b=H201kyuYdZkHY8YzgmifHbZ4LYlD8EHTuCd330UTw+h445hYx/LJl0jHXwal5cy4SxpnuT UG4/cKdd5AWaB3cgd2u+Rz7YGq3EqVE/WgxUmCbykZEVA7qMqgV3CMuEguKwNzI79Pv9zb eTyKpa8q9YrD9WIhY9w3NLG5eWrxZHdDUBk196lVmw8Cvb/ciALO5hLZyZFC2oKafq/enO MsLSp8OMQ8thLAv2UsWfHyRz5J4gGjh9H58O4i8q79AYy1CidrCt/mKvDJ+uja+Y/Fwg44 WrznhwI9jHP6NW3jjh6ziUagDn8E87ht7ZIHV3099dlxqw9gzW4bkMwe05I0vw== Date: Tue, 29 Apr 2025 00:23:02 +0800 Message-ID: <734ad3e1be29a9ba7fd87152746de3db29154dcb.1745855744.git.hako@ultrarare.space> In-Reply-To: References: 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/import.scm (guix-import): Skip existing definition for ‘--insert’ option. Change-Id: I2c4242669f974b263a018ab0cf56538bd7c81d06 --- guix/scripts/import.scm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index c620911893..a80893ce5f 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -147,16 +147,19 @@ (define-command (guix-import . args) (lambda (expr) (match expr (((? define-prefix? define-prefix) term _ ...) - (let ((source-properties - (find-definition-insertion-location - file term #:define-prefix define-prefix))) - (if source-properties - (insert-expression source-properties expr) - (let ((port (open-file file "a"))) - (pretty-print-with-comments port expr) - (newline port) - (newline port) - (close-port port))))))))) + ;; Skip existing definition. + (unless (find-definition-location + file term #:define-prefix define-prefix) + (let ((source-properties + (find-definition-insertion-location + file term #:define-prefix define-prefix))) + (if source-properties + (insert-expression source-properties expr) + (let ((port (open-file file "a"))) + (pretty-print-with-comments port expr) + (newline port) + (newline port) + (close-port port)))))))))) (import-as-definitions importer (cons (string-append "--file-to-insert=" file) args)