From 5a57313918a5c1bd5cf8238c2dcae64a03523952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 17 Feb 2022 16:06:39 +0100 Subject: profiles: 'profile-derivation' rejects unsupported packages. Previously user-facing commands would happily start building packages even if they do not support that system. With this change, all the user-facing commands reject unsupported packages without going further. * guix/profiles.scm (profile-derivation): Add #:allow-unsupported-packages?. Define 'check-supported-packages' and honor #:allow-unsupported-packages?. * tests/guix-pack.sh, tests/guix-package.sh, tests/guix-shell.sh: Ensure that unsupported packages are rejected. * tests/guix-system.sh: Pass "--system=armhf-linux" when attempting to build gnu/system/examples/asus-c201.tmpl. --- guix/profiles.scm | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'guix/profiles.scm') diff --git a/guix/profiles.scm b/guix/profiles.scm index 9715a769aa..bad9b95519 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -33,7 +33,7 @@ #:use-module ((guix utils) #:hide (package-name->name+version)) #:use-module ((guix build utils) #:select (package-name->name+version mkdir-p)) - #:use-module ((guix diagnostics) #:select (&fix-hint)) + #:use-module ((guix diagnostics) #:select (&fix-hint formatted-message)) #:use-module (guix i18n) #:use-module (guix records) #:use-module (guix packages) @@ -1860,6 +1860,7 @@ MANIFEST." (name "profile") (hooks %default-profile-hooks) (locales? #t) + (allow-unsupported-packages? #f) (allow-collisions? #f) (relative-symlinks? #f) system target) @@ -1868,7 +1869,9 @@ the given MANIFEST. The profile includes additional derivations returned by the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc. Unless ALLOW-COLLISIONS? is true, a '&profile-collision-error' is raised if entries in MANIFEST collide (for instance if there are two same-name packages -with a different version number.) +with a different version number.) Unless ALLOW-UNSUPPORTED-PACKAGES? is true +or TARGET is set, raise an error if MANIFEST contains a package that does not +support SYSTEM. When LOCALES? is true, the build is performed under a UTF-8 locale; this adds a dependency on the 'glibc-utf8-locales' package. @@ -1878,12 +1881,27 @@ This is one of the things to do for the result to be relocatable. When TARGET is true, it must be a GNU triplet, and the packages in MANIFEST are cross-built for TARGET." + (define (check-supported-packages system) + ;; Raise an error if a package in MANIFEST does not support SYSTEM. + (map-manifest-entries + (lambda (entry) + + (match (manifest-entry-item entry) + ((? package? package) + (unless (supported-package? package system) + (raise (formatted-message (G_ "package ~a does not support ~a") + (package-full-name package) system)))) + (_ #t))) + manifest)) + (mlet* %store-monad ((system (if system (return system) (current-system))) (target (if target (return target) (current-target-system))) + (ok? -> (or allow-unsupported-packages? target + (check-supported-packages system))) (ok? (if allow-collisions? (return #t) (check-for-collisions manifest system -- cgit v1.2.3