I am trying to use oauth2.el for some local shenanigans and would like to see how others are using it. Is there a way I can query elpa/melpa for dependencies to this (or any other package)?
1 Answer
Not sure about querying the package archive directly, but you can do something along the lines of:
(let ((needle 'oauth2)
(resolve-deps-recursively t)
curr-deps
all-rdeps)
(dolist (curr package-archive-contents all-rdeps)
;; (car curr) => pkg
;; (cadr curr) => pkg-desc
(setq curr-deps (if resolve-deps-recursively
(package--dependencies (car curr))
(mapcar #'car (package-desc-reqs (cadr curr)))))
(when (memq needle curr-deps)
(push (car curr) all-rdeps))))
This will find all reverse dependencies of needle
. If resolve-deps-recursively
is non-nil, it will, as the name suggests, resolve dependencies recursively. In other words, if pkg1
depends on pkg2
which depends on [...] which depends on pkgn
which depends on needle
, pkg1
will appear in the result.
Given my package-archive-contents
, I get the following results for 'oauth2
:
;; with recursive dependency resolution
'(flim google-contacts mu-cite oauth2-request org-onenote semi slack smudge wanderlust)
;; without recursive dependency resolution
'(flim google-contacts oauth2-request org-onenote slack smudge)