gnu: base: Add cautionary comments for canonical-package, %final-inputs usage.

* gnu/packages/base.scm (canonical-package, %final-inputs): Add comments.

Change-Id: I8b2f5802127dbde169850a7931a64fb5eb503b7c
This commit is contained in:
Maxim Cournoyer 2024-02-01 12:51:07 -05:00 committed by Ludovic Courtès
parent 96e2eeee74
commit b07c028a84
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -84,6 +84,10 @@ (define-module (gnu packages base)
libc-utf8-locales-for-target
make-ld-wrapper
libiconv-if-needed
;; Beware: the following should not be used the top level to avoid
;; introducing circular module dependencies.
canonical-package
%final-inputs))
;;; Commentary:
@ -1778,12 +1782,18 @@ (define* (libiconv-if-needed #:optional (target (%current-target-system)))
(list libiconv)
'()))
(define-public (canonical-package package)
;;; Beware: canonical-package should not be used at the top level, to avoid
;;; eagerly resolving (gnu packages commencement), which would introduce
;;; circular module dependencies.
(define (canonical-package package)
;; Avoid circular dependency by lazily resolving 'commencement'.
(let* ((iface (resolve-interface '(gnu packages commencement)))
(proc (module-ref iface 'canonical-package)))
(proc package)))
;;; Beware: %final-inputs should not be used at the top level, to avoid
;;; eagerly resolving (gnu packages commencement), which would introduce
;;; circular module dependencies.
(define* (%final-inputs #:optional (system (%current-system)))
"Return the list of \"final inputs\"."
;; Avoid circular dependency by lazily resolving 'commencement'.