From 521026f777543b73bee6107aab089f44fb809c91 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sun, 5 Feb 2017 15:11:53 +0100 Subject: [PATCH] epkg-provided: exclude bundled libraries by default Unless the new optional argument INCLUDE-BUNDLED is non-nil, return no bundled libraries. This also affects the return value of `epkg-reverse-dependencies', which now no longer includes invalid reverse dependencies that are due to a package bundling libraries it shouldn't be bundling. That in turn affects `epkg-insert-reverse-dependencies', which is used when presenting a package description. This is what motivated this change, but it also makes sense elsewhere. --- epkg.el | 25 +++++++++++++++++-------- epkg.org | 5 ++++- epkg.texi | 5 ++++- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/epkg.el b/epkg.el index 329cb7d..8dce2b9 100644 --- a/epkg.el +++ b/epkg.el @@ -288,17 +288,26 @@ for which one of these predicates returns non-nil." NAME is the name of a package, a string." (closql-get (epkg-db) name)) -(cl-defgeneric epkg-provided (package) +(cl-defgeneric epkg-provided (package &optional include-bundled) "Return a list of features provided by PACKAGE. -\n(fn PACKAGE)") -(cl-defmethod epkg-provided ((pkg epkg-package)) - (epkg-provided (oref pkg name))) +Bundled features are excluded from the returned list unless +optional INCLUDE-BUNDLED is non-nil. -(cl-defmethod epkg-provided ((package string)) - (mapcar #'car (epkg-sql [:select feature :from provided - :where (= package $s1) - :order-by [(asc feature)]] package))) +\(fn PACKAGE &optional include-bundled)") + +(cl-defmethod epkg-provided ((pkg epkg-package) &optional include-bundled) + (epkg-provided (oref pkg name) include-bundled)) + +(cl-defmethod epkg-provided ((package string) &optional include-bundled) + (mapcar #'car (if include-bundled + (epkg-sql [:select feature :from provided + :where (= package $s1) + :order-by [(asc feature)]] package) + (epkg-sql [:select feature :from provided + :where (and (= package $s1) + (isnull drop)) + :order-by [(asc feature)]] package)))) (cl-defgeneric epkg-required (package) "Return a list of packages and features required by PACKAGE. diff --git a/epkg.org b/epkg.org index 5873f9f..b7eb66a 100644 --- a/epkg.org +++ b/epkg.org @@ -435,12 +435,15 @@ Emacsmirror, but not in a client. And the ~required~ slot only lists features but not the packages that provide them. The following functions return these values in a form that is generally more useful. -- Function: epkg-provided package +- Function: epkg-provided package &optional include-bundled This function returns a list of features provided by the package PACKAGE. PACKAGE is an ~epkg-package~ object or a package name, a string. + Bundled features are excluded from the returned list unless + optional INCLUDE-BUNDLED is non-nil. + - Function: epkg-required package This function returns a list of packages and features required by diff --git a/epkg.texi b/epkg.texi index 3b08009..0bba57b 100644 --- a/epkg.texi +++ b/epkg.texi @@ -527,11 +527,14 @@ Emacsmirror, but not in a client. And the @code{required} slot only lists features but not the packages that provide them. The following functions return these values in a form that is generally more useful. -@defun epkg-provided package +@defun epkg-provided package &optional include-bundled This function returns a list of features provided by the package PACKAGE. PACKAGE is an @code{epkg-package} object or a package name, a string. + +Bundled features are excluded from the returned list unless +optional INCLUDE-BUNDLED is non-nil. @end defun @defun epkg-required package