Skip to content

Commit

Permalink
epkg-provided: exclude bundled libraries by default
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tarsius committed Feb 5, 2017
1 parent 80ad642 commit 521026f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
25 changes: 17 additions & 8 deletions epkg.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion epkg.org
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion epkg.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 521026f

Please sign in to comment.