From patchwork Tue Mar 18 07:24:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 40319 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 01D2327BBEA; Tue, 18 Mar 2025 07:28:29 +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=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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=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 BEFEC27BBE2 for ; Tue, 18 Mar 2025 07:28:28 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuRMl-0007t1-8b; Tue, 18 Mar 2025 03:28:01 -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 1tuRMK-0007ee-QA for guix-patches@gnu.org; Tue, 18 Mar 2025 03:27:37 -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 1tuRM2-0001UR-Cr; Tue, 18 Mar 2025 03:27:30 -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=5qQlcUDJKcIJRSsAYETyiYSl2VuOHkW+jrIWbdq138k=; b=nuc+InZ2IVP0i/KFgUc01D4zfI9LE2fb6KQJxy++/BxLmqlZB5hnajCUVoarkkfB+8xvej2XatXt3+WRH3QWRIIx/ojyOLe9nLOOyfqFzJuVW02Y2TFwcy3D1MlOOxNUjFiXzRhdWiVB+lUkL1IoB1K5iB4OB/pkRY+cDijy6NAhHfCwu3CCe4l4X7vyLGH8XQG0rPL4K8Z1G8Nd0/yNWSVLcp4HNj2BgXwUfialHdySIwgv1Rp3ZQIaO256zc03uR+ow8fjP4PUr07pPnNAHMjhRUMNSsjPpoGjiduXWf7rg3zmqnQhoEFoKyxixA7So8i/zYsXWuvYMZnnoSvDEA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tuRM2-0004qQ-12; Tue, 18 Mar 2025 03:27:14 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH rust-team 13/18] scripts: import: Skip existing definition for =?utf-8?b?4oCYLS1pbnNlcnTigJk=?= option. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, 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: Tue, 18 Mar 2025 07:27:13 +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 , Hilton Chain , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Hilton Chain , 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.174228281218332 (code B ref 77093); Tue, 18 Mar 2025 07:27:13 +0000 Received: (at 77093) by debbugs.gnu.org; 18 Mar 2025 07:26:52 +0000 Received: from localhost ([127.0.0.1]:35935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tuRLf-0004lN-8r for submit@debbugs.gnu.org; Tue, 18 Mar 2025 03:26:52 -0400 Received: from mx.boiledscript.com ([2a01:4f8:10b:392::42]:45406) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tuRL7-0004fy-QF for 77093@debbugs.gnu.org; Tue, 18 Mar 2025 03:26:18 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1742282776; 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=5qQlcUDJKcIJRSsAYETyiYSl2VuOHkW+jrIWbdq138k=; b=ShrXe/vJRG+8s58sUY0py4enWpGLq3+Sb07jkBahF46m19P95MuG0QfI6wAHmWUBoXjV3D oeFp0nETZLfXmB9lFhN392MzDe8AXVYJKLH/PAZHzMbQVkV9C1c8n22tzMQ7m92JYsTKuH H9VCcK2L412UJ896YHRF8nrKXwrpsBKg21028TZUMCEkXXLK+CinC2fUV76pVOSH+7RLSx g7jvHagqUSlwHHG8X+jSZJ3CS68CwzxhuCJR43TKlOkiuBOKqeLp0ibrOdtOhjtpoox/2M TaBlth5Qpgvd58JqRKhpJkln14ziNtGGwxQ2snl2Hur3hRmI/YUoMwMiHBe8tg== Date: Tue, 18 Mar 2025 15:24:26 +0800 Message-ID: <3ee5a87b5fafdd42516307d25f3dea62144781d4.1742281797.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 X-MS-Reactions: disallow 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 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index 1b2c35f3b1..d8e1ed3e6f 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -137,16 +137,18 @@ (define-command (guix-import . args) (lambda (expr) (match expr (((? definer? definer) term _ ...) - (let ((source-properties - (find-definition-insertion-location + ;; Skip existing definition. + (unless (find-definition-location file term #:definer definer) + (let ((source-properties + (find-definition-insertion-location file term #:definer definer))) - (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))))))))) + (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)