Guard against strange derivations for packages

Where the requested system doesn't match that of the returned derivation. This
seems to happen for packages like dev86, wine and go.
This commit is contained in:
Christopher Baines 2020-04-24 21:37:35 +01:00
parent 0ec2673493
commit 4d4ee801c0

View file

@ -514,8 +514,8 @@ WHERE job_id = $1"
("riscv64-linux-gnu" . "") ; TODO I don't know? ("riscv64-linux-gnu" . "") ; TODO I don't know?
("i586-pc-gnu" . "i586-gnu"))) ("i586-pc-gnu" . "i586-gnu")))
;; TODO Currently unused
(define package-transitive-supported-systems-supports-multiple-arguments? #t) (define package-transitive-supported-systems-supports-multiple-arguments? #t)
(define (get-supported-systems package system) (define (get-supported-systems package system)
(or (and package-transitive-supported-systems-supports-multiple-arguments? (or (and package-transitive-supported-systems-supports-multiple-arguments?
(catch (catch
@ -551,18 +551,29 @@ WHERE job_id = $1"
(lambda () (lambda ()
(guard (c ((package-cross-build-system-error? c) (guard (c ((package-cross-build-system-error? c)
#f)) #f))
(list inferior-package-id (let ((derivation
system
target
(let ((file-name
(derivation-file-name
(if target (if target
(package-cross-derivation store package (package-cross-derivation store package
target target
system) system)
(package-derivation store package system))))) (package-derivation store package system))))
;; You don't always get what you ask for, so check
(if (string=? system (derivation-system derivation))
(list inferior-package-id
system
target
(let ((file-name
(derivation-file-name derivation)))
(add-temp-root store file-name) (add-temp-root store file-name)
file-name)))) file-name))
(begin
(simple-format
(current-error-port)
"warning: request for ~A derivation for ~A produced a derivation for system ~A\n"
system
(package-name package)
(derivation-system derivation))
#f)))))
(lambda args (lambda args
;; misc-error #f ~A ~S (No ;; misc-error #f ~A ~S (No
;; cross-compilation for ;; cross-compilation for