Skip to content

Commit dc2472a

Browse files
authored
0 parents  commit dc2472a

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed

README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
This patch fixes two problems:
2+
3+
* Is that quicklisp is unable to load primary system's dependencies, which are subsystems of other primary system not mentioned in the quicklisp distribution's metadata. Issue https://github.com/quicklisp/quicklisp-client/pull/139
4+
* When asdf system is known to ASDF, quicklisp client ignores it's dependencies and again, if the system depends on a subsystem of other primary system, ASDF can't load it and quicklisp client too.
5+
6+
## How to reproduce the problem
7+
8+
For example, I have `reblocks-ui-docs` ASDF system. One of it's subsystems depends on `reblocks/doc/example` subsystem of other package-inferred system available from Quicklisp.
9+
10+
Checkout this repository somewhere:
11+
12+
```
13+
git clone https://github.com/40ants/reblocks-ui /tmp/reblocks-ui
14+
```
15+
16+
Then start lisp and add this path to `asdf:*central-registry*`:
17+
18+
```lisp
19+
CL-USER> (push "/tmp/reblocks-ui/" asdf:*central-registry*)
20+
```
21+
22+
Try to quickload the system:
23+
24+
```
25+
CL-USER> (ql:quickload "reblocks-ui-docs")
26+
```
27+
28+
During quickload `reblocks-ui-docs` ASDF tries to load `reblocks/doc/example` and fails. QL client handles the condition, but can't find it in the metadata:
29+
30+
```lisp
31+
System "reblocks/doc/example" not found
32+
[Condition of type QUICKLISP-CLIENT:SYSTEM-NOT-FOUND]
33+
34+
Restarts:
35+
0: [CONTINUE] Try again
36+
1: [ABORT] Give up on "reblocks/doc/example"
37+
2: [ABORT] Give up on "reblocks-ui-docs"
38+
3: [REGISTER-LOCAL-PROJECTS] Register local projects and try again.
39+
4: [RETRY] Retry SLY mREPL evaluation request.
40+
5: [*ABORT] Return to SLY's top level.
41+
--more--
42+
43+
Backtrace:
44+
0: ((LABELS QUICKLISP-CLIENT::RECURSE :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) "reblocks/doc/example")
45+
1: (QL-DIST::CALL-WITH-CONSISTENT-DISTS #<FUNCTION (LAMBDA NIL :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) {1004074BFB}>)
46+
2: (QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY "reblocks/doc/example")
47+
3: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "reblocks/doc/example" :PROMPT NIL)
48+
4: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "reblocks-ui-docs" :PROMPT NIL)
49+
5: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T)) #<unused argument> #<FUNCTION (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:$
50+
6: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION :AROUND (QL-IMPL:SBCL T)) #<QL-IMPL:SBCL {10051FD7F3}> #<FUNCTION (FLET QUICKLISP-CLI$
51+
7: ((:METHOD QUICKLISP-CLIENT:QUICKLOAD (T)) "reblocks-ui-docs" :PROMPT NIL :SILENT NIL :VERBOSE NIL) [fast-method]
52+
8: (QL-DIST::CALL-WITH-CONSISTENT-DISTS #<FUNCTION (LAMBDA NIL :IN QUICKLISP-CLIENT:QUICKLOAD) {100135CCDB}>)
53+
9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (QUICKLISP-CLIENT:QUICKLOAD "reblocks-ui-docs") #<NULL-LEXENV>)
54+
10: (EVAL (QUICKLISP-CLIENT:QUICKLOAD "reblocks-ui-docs"))
55+
11: ((LAMBDA NIL :IN SLYNK-MREPL::MREPL-EVAL-1))
56+
```
57+
58+
If we look at load strategy for `reblocks/doc/example`, then we'll see that quicklisp client have no idea how to load it:
59+
60+
```lisp
61+
CL-USER> (time (ignore-errors (quicklisp-client::compute-load-strategy "reblocks/doc/example")))
62+
Evaluation took:
63+
0.028 seconds of real time
64+
0.026195 seconds of total run time (0.026195 user, 0.000000 system)
65+
92.86% CPU
66+
12 forms interpreted
67+
52,479,390 processor cycles
68+
7,386,224 bytes consed
69+
70+
NIL
71+
#<QUICKLISP-CLIENT:SYSTEM-NOT-FOUND {1004978233}>
72+
```
73+
74+
## With my fix
75+
76+
But with my fix quicklisp client will attempt to find a primary system `reblocks` in the dist metadata and load strategy for `reblocks/doc/example` will look like this:
77+
78+
```lisp
79+
CL-USER> (time (ignore-errors (quicklisp-client::compute-load-strategy "reblocks/doc/example")))
80+
Evaluation took:
81+
0.024 seconds of real time
82+
0.023418 seconds of total run time (0.016144 user, 0.007274 system)
83+
95.83% CPU
84+
642 forms interpreted
85+
47,100,320 processor cycles
86+
3,574,560 bytes consed
87+
88+
#<QUICKLISP-CLIENT::LOAD-STRATEGY "reblocks/doc/example" (2 asdf, 103 quicklisp)>
89+
CL-USER> (describe *)
90+
#<QUICKLISP-CLIENT::LOAD-STRATEGY "reblocks/doc/example" (2 asdf, 103 ..
91+
[standard-object]
92+
93+
Slots with :INSTANCE allocation:
94+
NAME = "reblocks/doc/example"
95+
ASDF-SYSTEMS = (#<ASDF/SYSTEM:SYSTEM "uiop"> #<ASDF/SYSTEM:SYSTEM "asdf">)
96+
QUICKLISP-SYSTEMS = (#<QL-DIST:SYSTEM yason / yason-20230214-git / #1=quicklisp #2=2023-10..
97+
```
98+
99+
This way the `reblocks-ui-docs` and be quickloaded just fine as well as `reblocks/doc/example`!

quicklisp-fix.lisp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
(in-package #:quicklisp)
2+
3+
(defun compute-load-strategy (name)
4+
(setf name (string-downcase name))
5+
(let ((asdf-systems nil)
6+
(quicklisp-systems nil)
7+
(already-processed (make-hash-table :test 'equal)))
8+
(labels ((recurse (name)
9+
(setf (gethash name already-processed)
10+
t)
11+
(let ((asdf-system (asdf:find-system name nil))
12+
(quicklisp-system (find-system name)))
13+
(cond
14+
(asdf-system
15+
(push asdf-system asdf-systems))
16+
17+
(quicklisp-system
18+
(push quicklisp-system quicklisp-systems)
19+
(dolist (subname (required-systems quicklisp-system))
20+
(unless (gethash subname already-processed)
21+
(recurse subname))))
22+
23+
(t
24+
(cond
25+
((string-equal
26+
(asdf:primary-system-name name)
27+
name)
28+
(cerror "Try again"
29+
'system-not-found
30+
:name name)
31+
(recurse name))
32+
(t
33+
(recurse (asdf:primary-system-name name)))))))))
34+
(with-consistent-dists
35+
(recurse name)))
36+
(make-instance 'load-strategy
37+
:name name
38+
:asdf-systems (remove-duplicates asdf-systems)
39+
:quicklisp-systems (remove-duplicates quicklisp-systems))))

0 commit comments

Comments
 (0)