From 88d4fac29a89b68ac663a80736e1c2d72c7e8d78 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Fri, 22 Jun 2018 16:49:04 -0700 Subject: [PATCH] devops: Fix pmodel/find-package. --- src/devops/lint.scm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/devops/lint.scm b/src/devops/lint.scm index 900000ac8..dc3790a9c 100644 --- a/src/devops/lint.scm +++ b/src/devops/lint.scm @@ -72,8 +72,12 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. deffns)))) (define (pmodel/find-package pmodel package-name) - (filter (lambda (p) (equal? package-name (package/name p))) - (pmodel/packages pmodel))) + (let ((pkgs (filter (lambda (p) (equal? package-name (package/name p))) + (pmodel/packages pmodel)))) + (and (pair? pkgs) + (if (null? (cdr pkgs)) + (car pkgs) + (error "Multiple packages:" package-name))))) (define (pmodel/global-exports pmodel) (define (global-exports package) @@ -87,10 +91,8 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (append-map! global-exports (pmodel/packages pmodel))) (define (pmodel/package-bindings pmodel package-name) - (let ((package (pmodel/find-package pmodel package-name))) - (if package - (map binding/name (package/bindings package)) - (error "No such package:" package-name)))) + (map binding/name + (package/bindings (pmodel/find-package pmodel package-name)))) (define (duplicates listset) (let loop ((items listset) (duplicates '())) -- 2.25.1