packages: Honor target system for the inputs to ‘patch-and-repack’.

* guix/packages.scm (%standard-patch-inputs): Add ‘system’ parameter.
Parameterize ‘%current-system’.
(patch-and-repack): Pass SYSTEM to ‘%standard-patch-inputs’.

Change-Id: Ic8ad93303332fd1eefba0a93a314f99db782eda6
This commit is contained in:
Ludovic Courtès 2023-12-03 00:50:40 +01:00
parent 3dda74a546
commit 2447c1b608
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -849,14 +849,15 @@ (define (patch-vulnerabilities patch)
'()))))
(append-map patch-vulnerabilities patches)))
(define (%standard-patch-inputs)
(define (%standard-patch-inputs system)
(let* ((canonical (module-ref (resolve-interface '(gnu packages base))
'canonical-package))
(ref (lambda (module var)
;; Make sure 'canonical-package' is not influenced by
;; '%current-target-system' since we're going to use the
;; native package anyway.
(parameterize ((%current-target-system #f))
(parameterize ((%current-target-system #f)
(%current-system system))
(canonical
(module-ref (resolve-interface module) var))))))
`(("tar" ,(ref '(gnu packages base) 'tar))
@ -867,7 +868,8 @@ (define (%standard-patch-inputs)
("unzip" ,(ref '(gnu packages compression) 'unzip))
("patch" ,(ref '(gnu packages base) 'patch))
("locales"
,(parameterize ((%current-target-system #f))
,(parameterize ((%current-target-system #f)
(%current-system system))
(canonical
((module-ref (resolve-interface '(gnu packages base))
'libc-utf8-locales-for-target))))))))
@ -913,7 +915,7 @@ (define source-file-name
(define lookup-input
;; The default value of the 'patch-inputs' field, and thus INPUTS is #f,
;; so deal with that.
(let ((inputs (or inputs (%standard-patch-inputs))))
(let ((inputs (or inputs (%standard-patch-inputs system))))
(lambda (name)
(match (assoc-ref inputs name)
((package) package)