fix(cli): rebuild dependents when updating packages
Library packages (like compat and transient) offer macros. Therefore, any package that uses them (dependents) needs to be recompiled when these are updated, but straight currently doesn't do this. As a temporary workaround, this commit forces dependents to be rebuilt after updates. This is a bit too brute-force, but will do until v3, which will manage dependency graphs and their complexities more efficiently.
This commit is contained in:
parent
b0f91f6403
commit
52d413f448
1 changed files with 28 additions and 8 deletions
|
@ -476,14 +476,34 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(print-group! (print! (item "%s" output))))
|
||||
(cl-return)))
|
||||
(puthash local-repo t repos-to-rebuild)
|
||||
;; HACK: Rebuild all packages that depend on PACKAGE after
|
||||
;; updating it. This ensures their bytecode don't contain stale
|
||||
;; references to symbols in silent dependencies.
|
||||
;; TODO: Allow `package!' to control this.
|
||||
;; TODO: Add cache+optimization step for this rebuild table.
|
||||
(letf! ((dependents (straight-dependents package))
|
||||
(n 0)
|
||||
(defun* add-to-rebuild (tree)
|
||||
(cond ((null tree) nil)
|
||||
((stringp tree)
|
||||
(unless (gethash tree packages-to-rebuild)
|
||||
(cl-incf n 1)
|
||||
(puthash tree t packages-to-rebuild)))
|
||||
((listp tree)
|
||||
(add-to-rebuild (car tree))
|
||||
(add-to-rebuild (cdr tree))))))
|
||||
(add-to-rebuild dependents)
|
||||
(puthash package t packages-to-rebuild)
|
||||
(print! (success "\033[K(%d/%d) %s: %s -> %s%s")
|
||||
(print! (success "\033[K(%d/%d) %s: %s -> %s%s%s")
|
||||
i total local-repo
|
||||
(doom-packages--abbrev-commit ref)
|
||||
(doom-packages--abbrev-commit target-ref)
|
||||
(if (and (integerp commits) (> commits 0))
|
||||
(format " [%d commit(s)]" commits)
|
||||
""))
|
||||
"")
|
||||
(if (> n 0)
|
||||
(format " (w/ %d dependents)" n)
|
||||
"")))
|
||||
(unless (string-empty-p output)
|
||||
(let ((lines (split-string output "\n")))
|
||||
(setq output
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue