mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
guix build: Warn when attempting to build an unsupported package.
Fixes <https://issues.guix.gnu.org/51801>. Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>. * guix/scripts/build.scm (options->derivations)[warn-if-unsupported]: New procedure. [compute-derivation]: Use it. * tests/guix-build.sh: Add test.
This commit is contained in:
parent
5a57313918
commit
0ca26437cb
2 changed files with 31 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2021 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
|
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
|
||||||
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
||||||
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
|
||||||
|
@ -559,11 +559,29 @@ (define systems
|
||||||
(define things-to-build
|
(define things-to-build
|
||||||
(map transform (options->things-to-build opts)))
|
(map transform (options->things-to-build opts)))
|
||||||
|
|
||||||
|
(define warn-if-unsupported
|
||||||
|
(let ((target (assoc-ref opts 'target)))
|
||||||
|
(if target
|
||||||
|
(lambda (package system)
|
||||||
|
;; We cannot tell whether PACKAGE supports TARGET.
|
||||||
|
package)
|
||||||
|
(lambda (package system)
|
||||||
|
(match package
|
||||||
|
((? package? package)
|
||||||
|
(unless (supported-package? package system)
|
||||||
|
(warning (package-location package)
|
||||||
|
(G_ "package ~a does not support ~a~%")
|
||||||
|
(package-full-name package) system))
|
||||||
|
package)
|
||||||
|
(x x))))))
|
||||||
|
|
||||||
(define (compute-derivation obj system)
|
(define (compute-derivation obj system)
|
||||||
;; Compute the derivation of OBJ for SYSTEM.
|
;; Compute the derivation of OBJ for SYSTEM.
|
||||||
(match obj
|
(match obj
|
||||||
((? package? p)
|
((? package? p)
|
||||||
(let ((p (or (and graft? (package-replacement p)) p)))
|
(let ((p (warn-if-unsupported
|
||||||
|
(or (and graft? (package-replacement p)) p)
|
||||||
|
system)))
|
||||||
(match src
|
(match src
|
||||||
(#f
|
(#f
|
||||||
(list (package->derivation store p system)))
|
(list (package->derivation store p system)))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# GNU Guix --- Functional package management for GNU
|
# GNU Guix --- Functional package management for GNU
|
||||||
# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
|
# Copyright © 2012-2014, 2016-2022 Ludovic Courtès <ludo@gnu.org>
|
||||||
# Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
# Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
||||||
# Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
|
# Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
|
||||||
#
|
#
|
||||||
|
@ -31,6 +31,16 @@ guix build --version
|
||||||
guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S
|
guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S
|
||||||
test "`guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S`" = ""
|
test "`guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S`" = ""
|
||||||
|
|
||||||
|
# Warn when attempting to build an unsupported package.
|
||||||
|
case "$(guix build intelmetool -s armhf-linux -v0 -n 2>&1)" in
|
||||||
|
*warning:*intelmetool*support*armhf*)
|
||||||
|
true
|
||||||
|
break;;
|
||||||
|
*)
|
||||||
|
false;
|
||||||
|
break;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Should pass.
|
# Should pass.
|
||||||
guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' | \
|
guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' | \
|
||||||
grep -e '-guile-'
|
grep -e '-guile-'
|
||||||
|
|
Loading…
Reference in a new issue