mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
scripts: import: Skip existing definition for ‘--insert’ option.
* guix/scripts/import.scm (guix-import): Skip existing definition for ‘--insert’ option. Change-Id: I2c4242669f974b263a018ab0cf56538bd7c81d06
This commit is contained in:
parent
2ca0b957f2
commit
d9b767640c
1 changed files with 13 additions and 10 deletions
|
@ -152,16 +152,19 @@ PROC callback."
|
||||||
(lambda (expr)
|
(lambda (expr)
|
||||||
(match expr
|
(match expr
|
||||||
(((? define-prefix? define-prefix) term _ ...)
|
(((? define-prefix? define-prefix) term _ ...)
|
||||||
(let ((source-properties
|
;; Skip existing definition.
|
||||||
(find-definition-insertion-location
|
(unless (find-definition-location
|
||||||
file term #:define-prefix define-prefix)))
|
file term #:define-prefix define-prefix)
|
||||||
(if source-properties
|
(let ((source-properties
|
||||||
(insert-expression source-properties expr)
|
(find-definition-insertion-location
|
||||||
(let ((port (open-file file "a")))
|
file term #:define-prefix define-prefix)))
|
||||||
(pretty-print-with-comments port expr)
|
(if source-properties
|
||||||
(newline port)
|
(insert-expression source-properties expr)
|
||||||
(newline port)
|
(let ((port (open-file file "a")))
|
||||||
(close-port port)))))))))
|
(pretty-print-with-comments port expr)
|
||||||
|
(newline port)
|
||||||
|
(newline port)
|
||||||
|
(close-port port))))))))))
|
||||||
(import-as-definitions importer
|
(import-as-definitions importer
|
||||||
(cons (string-append "--file-to-insert=" file)
|
(cons (string-append "--file-to-insert=" file)
|
||||||
args)
|
args)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue