etc: committer: Fix crashes on missing package version fields.

* etc/committer.scm.in (change-commit-message):
Fix handling of missing package version fields.

Change-Id: Id6565dc30a25f6bd53ba2c1f82609a357c375d8c
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Martin Schitter 2025-10-20 15:07:27 +00:00 committed by Ludovic Courtès
parent 2b08ff1cf7
commit efdc2d0ad8
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -283,15 +283,20 @@ corresponding to the top-level definition containing the staged changes."
(define variable-name
(second old))
(define version
(and=> ((xpath:node-or
(match ((xpath:node-or
(xpath:sxpath '(*any* *any* package version *any*))
;; For let binding
(xpath:sxpath '(*any* *any* (*any*) package version *any*)))
(cons '*TOP* new))
first))
(format port
"gnu: ~a: Update to ~a.~%~%* ~a (~a): Update to ~a.~%"
variable-name version file-name variable-name version)
(() #f)
((version . rest) version)))
(if version
(format port
"gnu: ~a: Update to ~a.~%~%* ~a (~a): Update to ~a.~%"
variable-name version file-name variable-name version)
(format port
"gnu: ~a: Update.~%~%* ~a (~a): Update.~%"
variable-name file-name variable-name))
(for-each (lambda (field)
(let ((old-values (get-values old field))
(new-values (get-values new field)))