From patchwork Tue Mar 18 14:26:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 40342 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 9BA6627BBEA; Tue, 18 Mar 2025 14:31:24 +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 64BE027BBE2 for ; Tue, 18 Mar 2025 14:31:24 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuXyL-0007E7-2B; Tue, 18 Mar 2025 10:31:13 -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 1tuXxb-0006QA-Mb for guix-patches@gnu.org; Tue, 18 Mar 2025 10:30:30 -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 1tuXxX-0001xz-8f; Tue, 18 Mar 2025 10:30:25 -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=WGvHTrbjVrTWfbllNr3p4AZWghFWH2g/oDoIhRm6W2s=; b=ltFquoZpRox6WrRahbabCp2Ruaa2IlKqk7F3DHO8jo5vwXi3+/Xw1VXGS8lEyPcjX0EyyiBqrhGqgliSx23en27U9+ruWIbi9EFz8/X6PDD/9o+eGZk5u2QXWl5kBPNqMEN9t7pYMdkHKhBM/g+OPt8QZqvm++Cj53pd8Rr0ojlii44GgmKsAl1Bt/uefCOfSsbqUhGA8oxeURA5xN8O1XzdAmiDbo1YxFvnslelEKtQ04jqiOh4lSvbLH56JL3/MntwMD6gKXTTFgIedloEyMzXGqRjAmrWmJUedlo874jzAj2zMxOuwtht8Us0b7vK40JiqtPZ/tzxLOOkapu+XQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tuXxU-0004xL-Bb; Tue, 18 Mar 2025 10:30:20 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH rust-team v2 12/17] 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: Tue, 18 Mar 2025 14:30:20 +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 , Efraim Flashner , 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.174230818218453 (code B ref 77093); Tue, 18 Mar 2025 14:30:20 +0000 Received: (at 77093) by debbugs.gnu.org; 18 Mar 2025 14:29:42 +0000 Received: from localhost ([127.0.0.1]:41746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tuXwq-0004nP-CO for submit@debbugs.gnu.org; Tue, 18 Mar 2025 10:29:41 -0400 Received: from mx.boiledscript.com ([88.99.243.112]:34732) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tuXvA-0004W2-Sk for 77093@debbugs.gnu.org; Tue, 18 Mar 2025 10:27:57 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1742308075; 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=WGvHTrbjVrTWfbllNr3p4AZWghFWH2g/oDoIhRm6W2s=; b=G2aGzYzWbSodqrD4micPgmM8oGw3wVpdLr9dCA7LdTR+wHrENKn+2+qD4TtAxVAFu+Wxan ctyWGgCg3R1CvJikUPhiGX6A125zdvWIguafVzsyzKeb9IoMcEAFV7vbi5vvhfUhtfHg3t ThMXoOIHxooGVPOWsKCVDjQH4CaxzLct/AhauNya4FwE0x1lscuj8mu1BSaIadDOsgfYyB ETtPSwYAjCtnTyROaHVRtH4UlYemMAgmHItIAskRg+gz4+FFUg3U0qRvqaX6gZKy+mywvM Lx8jVatsEdM2FIFmy/MUNock98wyQAkwf8PTA2uadiZbWJmB3IndhkEN4wSHyA== Date: Tue, 18 Mar 2025 22:26:55 +0800 Message-ID: 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 e99796a430..f6e2985ed9 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -136,16 +136,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)