-
Notifications
You must be signed in to change notification settings - Fork 78
Fix quickloading :defsystem-depends-on dependencies. #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix quickloading :defsystem-depends-on dependencies. #122
Conversation
Is there a way to make this work with older ASDFs than 3.1.7? |
hrm, good question. without that change ASDF signals a rather general error, so i'm afraid not, but @fare may have an idea. |
I think the specific error is embedded in the general error, maybe that could be dug out? |
oh, that's a good catch! i'm trying to do that now. |
@xach i can get hold of the nested condition, but it contains a missing-dependency with:
any ideas how to be smart about it? the current ql code skips trying if parent is nil. i assume it's because missing-dependency may be signalled for non-sytems, i.e. for a file that is part of an asdf system? |
A missing file also signals a missing dependency, yes. Don't know how the two situations might easily be distinguished, except by the context in which they are signaled, maybe. |
i don't have any sane ideas... :/ but FTR, i was sloppy with my wording: this patch doesn't require a recent ASDF per se. it will "merely" remain broken wrt :defsystem-depends-on with an ASDF that doesn't include a fix for the above mentioned ASDF bug. |
Any insane ideas? I don't mind workarounds. |
i was thinking of looking at the backtrace, but it's not that urgent... :) then i checked asdf-cache, but the visible binding only has this entry: with non-trivial efforts we could parse the defsystem and deal with the :defsystem-depends-on entry proactively, before asking ASDF to load the system. but this again smells like "this is not that urgent", and/or "it may be easier to patch, release and update ASDF". |
Quicklisp dist creation already proactively indexes |
@xach i was wondering, is there a reason why ql tries to catch |
63028c1
to
96f26b8
Compare
this patch is less tested than i would like it to be, but i publish it here for feedback. |
Attila, it would be much more robust if the very same sysdef-*-search function that handled already-downloaded QL systems would also do the downloading, etc. (possibly controlled by a special boolean variable). Indeed, only in THAT setup is it ensured that the priority of systems does not depend on the order in which they are downloaded or not. Otherwise, you may run into e.g. prebuilt systems that override the QL systems if not downloaded yet, but not if already downloaded. |
ed78a25
to
bb47de4
Compare
updated the patch to have only one hook as @fare suggested. in its current form it skips calling the entire but at least it works as expected, properly downloading :defsystem-depends-on, too. |
If you can come up with a simple test file that demonstrates what ASDF should be doing that it isn't doing (or shouldn't that it is), I can probably fix ASDF to behave properly. Looking at a backtrace is insane, but ASDF could maintain in a special variable the information you need. What information do you need? Right now, I'm not sure how I can help. |
It's OK for you to make up new API function in your test file, as long as you document what you think it should be doing. |
concept failed with the find-system hook -- i think. @fare ASDF calls SYSDEF-PRELOADED-SYSTEM-SEARCH (e.g. to find itself) after consulting the user registered hooks, so in an earlier hook I have no chance to know that the system will be found later on (and thus don't try to download anything). I think the proper solution would be something like an unless maybe if ASDF could move its own search functions into the hooks and then i could register mine after them, which would be more or less equivalent to an so, to sum it up: find-system hooks, in their current form, are not a reliable way to identify the situation when asdf:find-system gives up, which is exactly what ql needs to hook into. |
Proposed workaround: |
Regarding the failure at http://paste.lisp.org/display/159756 |
bb47de4
to
56b56d0
Compare
Attila, I don't see anything wrong with this patch to QL as far as ASDF is concerned. I still don't understand why it's not better and easier to "just" hook at the end of system-definition-search-functions with a special case to handle sysdef-preloaded-system-search. |
dunno, i also don't see the reverse. the reason i settled with this is that it's a less intrusive patch relative to what ql did previously. and i don't see how a hook would be any less coupled with ASDF internals, or in general a better solution. not saying i'm right, just that i don't see. |
Using the ASDF would make it "work by construction", and wouldn't require restarting things while potentially leaving incomplete side-effects in mid-air. Also, no special wrapper would be required, just a flag to enable or disable download. |
ok, that sounds convincing. so, here's the hook variant: https://github.com/attila-lendvai/quicklisp-client/tree/defsystem-depends-on-with-find-system-hook and here's the nonintrusive variant: https://github.com/attila-lendvai/quicklisp-client/tree/defsystem-depends-on-fix |
damn it! the hook variant is broken, i'll look at it tomorrow afternoon, eu time... |
ok, here's the issue with the find-system hook:
the culprit is probably
@fare is this an ASDF bug? or a misuse of the hook? |
So require-system asks whether registered systems are loaded. That should be OK as long as your find-system hook doesn't actually load a system, but only loads its .asd, as it probably should. |
So, I could have registered-systems return the system objects instead of their names, and that would save a trip through find-system and it hook. Still, a find-system hook should not actually be loading the system (as per load-op or load-system), only loading its .asd. |
Try ASDF commit c0fca7ac66bbf510f68d00d8e030c98c11204439 |
a summary of the situation. i have two proposed solutions as follows: the hook variantit is @fare's preferred way. it installs a hook into asdf:system-definition-search-functions. this hook does one thing only: for each missing system name it looks them up in the ql database and offers/tries to install them one by one, from inside the hook. requires a very recent ASDF. note that it does not load the systems, and thus in its current form it eliminates the fancy load-strategy code and the macroexpand output (i commented them out in the commit to mark this fact). this commit is not ready as is, it's more of a proof of concept that needs to be cleaned up if @xach chooses this variant. i don't have the bird's eye view perspective on quicklisp, so the cleanup probably needs to be done by @xach, or i need guidance. this variant is more flexible in that it can be enabled with a https://github.com/attila-lendvai/quicklisp-client/tree/defsystem-depends-on-with-find-system-hook the just-patch-it variantthis is a non-intrusive change that tries to identify the internal state of asdf and decide based on that. works as is, also with older ASDF's, and is ready to be merged. the downside is that it relies on decoding ASDF's internal state from the signalled system not found error (as opposed to using a published API). as of today ASDF's error is not very clear about the situation, and the ql code doesn't make much sense without looking at ASDF's code. https://github.com/attila-lendvai/quicklisp-client/tree/defsystem-depends-on-fix |
An automatic batching variant or the installer would have its defsystem return a proxy object, and an operate method that installs batched systems, change-class the proxy objects, and restarts the operate method. That's if batching is needed. |
This helps with e.g. not needlessly triggering find-system hooks, or invalidating the loadedness status because there was a system update. quicklisp/quicklisp-client#122 (comment)
@fare, do you see anything effecting/simplifying this issue in the 3.3.0 release and its internal refactorings? |
another possible solution: #128 |
as reported in #108, the original bug that motivated this PR has been fixed. closing this and opening a new issue to discuss potentially installing/supporting |
Requires at least ASDF 3.1.7, or maybe newer, depending
on when the ASDF fix will be released.
the relevant ASDF changes: https://gitlab.common-lisp.net/asdf/asdf/merge_requests/1
note: the diff is mostly whitespace, it just moves part of the computation inside the handler-case.