Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Querying ASDF for dependencies

1 view
Skip to first unread message

RG

unread,
Mar 16, 2010, 10:55:50 PM3/16/10
to
Is there a way that I can query ASDF for the dependencies of a package
without actually loading the package?

rg

D Herring

unread,
Mar 17, 2010, 12:13:19 AM3/17/10
to
On 03/16/2010 10:55 PM, RG wrote:
> Is there a way that I can query ASDF for the dependencies of a package
> without actually loading the package?

Yes and no. Here's the hack I wrote for LibCL. It may use
unsupported internals. Need to check whether it works with the latest
version.

;; this is fragile...
(defun get-deps (package)
"Find the ASDF dependencies for PACKAGE"
(if (listp package)
(mapcan 'get-deps package)
(let ((component (asdf:find-component nil package)))
(unless component
(error "ASDF could not find ~A.~%Make sure
asdf:*central-registry* was updated according to configure-libcl.lisp"
package))
(let ((stuff (asdf:component-depends-on
'asdf:load-source-op
component)))
(when (car stuff)
(destructuring-bind ((op &rest deps)) stuff
(unless (eql op 'asdf:load-source-op)
(error "unknown failure"))
(loop for d in deps
collecting (intern (string (if (listp d)
(second d)
d)) :keyword))))))))

As to the "no". Simply doing asdf:find-component may result in side
effects, both in the package of interest and in random other packages
before it. These side effects include dumping fasls. There are
several asd files that force things to load early in order to extend
ASDF by defining custom classes.

Here's a relevant shell snippet (it grew organically).
DST=/some/path
sbcl --noinform --noprint --no-sysinit --no-userinit \
--eval '(require :asdf)' \
--eval "(setf asdf:*central-registry* (list #P\"$DST/.asdf/\"))" \
--eval '(require :asdf-binary-locations)' \
--eval "(setf asdf:*default-toplevel-directory* #P\"$DST/.tmp/\")" \
--eval '(setf asdf:*centralize-lisp-binaries* t)' \
--eval '(load "libcl-init/packages.lisp")' \
--eval '(libcl-util::output-index)' \
--eval '(libcl-util::output-package-list "packages.txt")' \
--eval '(quit)'
rm -rf $DST/.tmp/

Again, this snippet supposes the old (~2009) ASDF behavior; current
ASDF merged asdf-binary-locations, renamed it to
asdf-output-locations, and otherwise changed the interface. I'm not
sure the new interface even supports the above behavior even after a
rewrite.

- Daniel

RG

unread,
Mar 17, 2010, 3:24:02 AM3/17/10
to
In article <hnpkt1$jbu$1...@news.eternal-september.org>,
D Herring <dher...@at.tentpost.dot.com> wrote:

Thanks.

rg

0 new messages