guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/05: packages: Add 'supported-package?'.


From: Ludovic Courtès
Subject: 01/05: packages: Add 'supported-package?'.
Date: Sun, 19 Apr 2015 21:35:00 +0000

civodul pushed a commit to branch master
in repository guix.

commit bbceb0ef8a1e05faaa15c5b4135275fb4572b8d9
Author: Ludovic Courtès <address@hidden>
Date:   Sun Apr 19 16:49:09 2015 +0200

    packages: Add 'supported-package?'.
    
    * guix/packages.scm (supported-package?): New procedure.
    * tests/packages.scm ("supported-package?"): New test.
    * build-aux/hydra/gnu-system.scm (package->job): Use it instead of
      'package-transitive-supported-systems'.
---
 build-aux/hydra/gnu-system.scm |    3 +--
 guix/packages.scm              |    6 ++++++
 tests/packages.scm             |    8 ++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm
index 01e2859..b1432f6 100644
--- a/build-aux/hydra/gnu-system.scm
+++ b/build-aux/hydra/gnu-system.scm
@@ -204,8 +204,7 @@ all its dependencies, and ready to be installed on 
non-GuixSD distributions.")
 valid."
       (cond ((member package base-packages)
              #f)
-            ((member system
-                     (package-transitive-supported-systems package))
+            ((supported-package? package system)
              (package-job store (job-name package) package system))
             (else
              #f)))))
diff --git a/guix/packages.scm b/guix/packages.scm
index 8ebe8d0..fde46d5 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -95,6 +95,7 @@
             package-grafts
 
             %supported-systems
+            supported-package?
 
             &package-error
             package-error?
@@ -581,6 +582,11 @@ supported by its dependencies."
         (package-supported-systems package)
         (bag-direct-inputs (package->bag package))))
 
+(define* (supported-package? package #:optional (system (%current-system)))
+  "Return true if PACKAGE is supported on SYSTEM--i.e., if PACKAGE and all its
+dependencies are known to build on SYSTEM."
+  (member system (package-transitive-supported-systems package)))
+
 (define (bag-direct-inputs bag)
   "Same as 'package-direct-inputs', but applied to a bag."
   (append (bag-build-inputs bag)
diff --git a/tests/packages.scm b/tests/packages.scm
index 3007b50..9191032 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -166,6 +166,14 @@
               `("does-not-exist" "foobar" ,@%supported-systems)))))
     (package-transitive-supported-systems p)))
 
+(test-assert "supported-package?"
+  (let ((p (dummy-package "foo"
+             (build-system gnu-build-system)
+             (supported-systems '("x86_64-linux" "does-not-exist")))))
+    (and (supported-package? p "x86_64-linux")
+         (not (supported-package? p "does-not-exist"))
+         (not (supported-package? p "i686-linux")))))
+
 (test-skip (if (not %store) 8 0))
 
 (test-assert "package-source-derivation, file"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]