GNU bug report logs - #77093
[PATCH rust-team 00/18] New Rust packaging workflow based on lockfile importer.

Previous Next

Package: guix-patches;

Reported by: Hilton Chain <hako <at> ultrarare.space>

Date: Tue, 18 Mar 2025 07:18:02 UTC

Severity: normal

Tags: patch

Full log


Message #146 received at 77093 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: 77093 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>,
 Efraim Flashner <efraim <at> flashner.co.il>
Subject: [PATCH rust-team v2 12/17] scripts: import: Skip existing definition for ‘--insert’ option.
Date: Tue, 18 Mar 2025 22:26:55 +0800
* 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)
-- 
2.48.1





This bug report was last modified 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.