From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Roelandt Subject: [PATCH v3 1/2] guix ui: add the "depends" field to package->recutils: Date: Mon, 21 Jul 2014 01:48:14 +0200 Message-ID: <1405900094-19802-1-git-send-email-tipecaml@gmail.com> References: <87mwc7bm96.fsf@gnu.org> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X90yn-00044r-4v for guix-devel@gnu.org; Sun, 20 Jul 2014 19:57:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X90ye-0000fj-1s for guix-devel@gnu.org; Sun, 20 Jul 2014 19:57:21 -0400 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:58209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X90yd-0000fN-QZ for guix-devel@gnu.org; Sun, 20 Jul 2014 19:57:11 -0400 Received: by mail-we0-f174.google.com with SMTP id x48so6816210wes.5 for ; Sun, 20 Jul 2014 16:57:10 -0700 (PDT) In-Reply-To: <87mwc7bm96.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org * guix/packages.scm (package-direct-inputs): New procedure. * tests/packages.scm: Test it. * guix/ui.scm (package->recutils): Print the dependencies of the package. --- guix/packages.scm | 8 ++++++++ guix/ui.scm | 7 +++++++ tests/packages.scm | 13 +++++++++++++ 3 files changed, 28 insertions(+) diff --git a/guix/packages.scm b/guix/packages.scm index 985a573..89f810f 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -75,6 +75,7 @@ package-location package-field-location + package-direct-inputs package-transitive-inputs package-transitive-target-inputs package-transitive-native-inputs @@ -484,6 +485,13 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET." ((input rest ...) (loop rest (cons input result)))))) +(define (package-direct-inputs package) + "Return all the direct inputs of PACKAGE---i.e, its direct inputs along +with their propagated inputs." + (append (package-inputs package) + (package-native-inputs package) + (package-propagated-inputs package))) + (define (package-transitive-inputs package) "Return the transitive inputs of PACKAGE---i.e., its direct inputs along with their propagated inputs, recursively." diff --git a/guix/ui.scm b/guix/ui.scm index 7338b82..5674439 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -453,9 +453,16 @@ WIDTH columns." (fill-paragraph str width (string-length "description: "))))) + (define (package (package-location p) location->string) (_ "unknown"))) diff --git a/tests/packages.scm b/tests/packages.scm index 6ac215b..e00d4f9 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -87,6 +87,19 @@ (with-fluids ((%file-port-name-canonicalization 'absolute)) (location-file (package-field-location %bootstrap-guile 'version)))) +(test-assert "package-direct-inputs" + (let* ((a (dummy-package "a")) + (b (dummy-package "b")) + (c (dummy-package "c")) + (d (dummy-package "d" + (inputs "c"))) + (e (dummy-package "e" + (inputs `(("a" ,a))) + (native-inputs `(("b" ,b))) + (propagated-inputs `(("d" ,d)))))) + (equal? (package-direct-inputs e) + `(("a" ,a) ("b" ,b) ("d" ,d))))) + (test-assert "package-transitive-inputs" (let* ((a (dummy-package "a")) (b (dummy-package "b" -- 1.8.4.rc3