[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/12: guix build: Warn when attempting to build an unsupported package.
From: |
guix-commits |
Subject: |
04/12: guix build: Warn when attempting to build an unsupported package. |
Date: |
Fri, 18 Feb 2022 08:15:57 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 0ca26437cb36822f9f74ee1a6dbc714477378b13
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Feb 17 16:23:42 2022 +0100
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.
---
guix/scripts/build.scm | 22 ++++++++++++++++++++--
tests/guix-build.sh | 12 +++++++++++-
2 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 97e2f5a167..d9cdb6e5e0 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -1,5 +1,5 @@
;;; 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 © 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
@@ -559,11 +559,29 @@ build."
(define things-to-build
(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)
;; Compute the derivation of OBJ for SYSTEM.
(match obj
((? 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
(#f
(list (package->derivation store p system)))
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 86e41e2927..9cbf8fe26d 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -1,5 +1,5 @@
# 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 © 2021 Chris Marusich <cmmarusich@gmail.com>
#
@@ -31,6 +31,16 @@ guix build --version
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.
guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' | \
grep -e '-guile-'
- branch master updated (40d418b326 -> 33ce3f1c86), guix-commits, 2022/02/18
- 05/12: services: qemu-guest-agent: Fix implementation., guix-commits, 2022/02/18
- 02/12: packages: 'package-transitive-supported-systems' ignores '%current-target-system'., guix-commits, 2022/02/18
- 07/12: gnu: upower: Update to 0.99.15., guix-commits, 2022/02/18
- 06/12: gnu: upower: Make it auto-updatable., guix-commits, 2022/02/18
- 11/12: gnu: upower: Remove obsolete phase, guix-commits, 2022/02/18
- 08/12: gnu: umockdev: Use G-expressions., guix-commits, 2022/02/18
- 04/12: guix build: Warn when attempting to build an unsupported package.,
guix-commits <=
- 03/12: profiles: 'profile-derivation' rejects unsupported packages., guix-commits, 2022/02/18
- 01/12: doc: Typographical tweaks., guix-commits, 2022/02/18
- 10/12: gnu: umockdev: Reference libumockdev by absolute path., guix-commits, 2022/02/18
- 09/12: gnu: umockdev: Reference 'env' and 'sh' by absolute path., guix-commits, 2022/02/18
- 12/12: gnu: lsh: Build with optimizations., guix-commits, 2022/02/18