dev: merge branch 'master' of github.com:doomemacs
This commit is contained in:
commit
d00f642a4c
9 changed files with 179 additions and 180 deletions
|
@ -121,16 +121,16 @@ list remains lean."
|
|||
nil (mapcar (doom-rpartial #'gethash straight--repo-cache)
|
||||
(mapcar #'symbol-name straight-recipe-repositories)))
|
||||
(recipe package type local-repo)
|
||||
(let ((esc (unless init-file-debug "\033[1A"))
|
||||
(let ((esc (if init-file-debug "" "\033[1A"))
|
||||
(ref (straight-vc-get-commit type local-repo))
|
||||
newref output)
|
||||
(print! (start "\033[KUpdating recipes for %s...%s") package esc)
|
||||
(print! (start "\rUpdating recipes for %s...%s") package esc)
|
||||
(doom-packages--straight-with (straight-vc-fetch-from-remote recipe)
|
||||
(when .it
|
||||
(setq output .output)
|
||||
(straight-merge-package package)
|
||||
(unless (equal ref (setq newref (straight-vc-get-commit type local-repo)))
|
||||
(print! (success "\033[K%s updated (%s -> %s)")
|
||||
(print! (success "\r%s updated (%s -> %s)")
|
||||
package
|
||||
(doom-packages--abbrev-commit ref)
|
||||
(doom-packages--abbrev-commit newref))
|
||||
|
@ -214,7 +214,7 @@ list remains lean."
|
|||
(comp-async-runnings)))
|
||||
while (not (zerop pending))
|
||||
if (/= previous pending) do
|
||||
(print! (start "\033[KNatively compiling %d files...\033[1A" pending))
|
||||
(print! (start "\rNatively compiling %d files...\033[1A" pending))
|
||||
(setq previous pending
|
||||
timer 0)
|
||||
else do
|
||||
|
@ -362,7 +362,7 @@ list remains lean."
|
|||
;; and causing a rebuild of those packages each time `doom sync'
|
||||
;; or similar is run, so we clean it up ourselves:
|
||||
(delete-directory (straight--modified-dir) 'recursive)
|
||||
(print! (success "\033[KBuilt %d package(s)") (length built)))
|
||||
(print! (success "\rBuilt %d package(s)") (length built)))
|
||||
(print! (item "No packages need attention"))
|
||||
nil))))
|
||||
|
||||
|
@ -378,7 +378,7 @@ list remains lean."
|
|||
(packages-to-rebuild (make-hash-table :test 'equal))
|
||||
(repos-to-rebuild (make-hash-table :test 'equal))
|
||||
(total (length recipes))
|
||||
(esc (unless init-file-debug "\033[1A"))
|
||||
(esc (if init-file-debug "" "\033[1A"))
|
||||
(i 0))
|
||||
(if pinned-only-p
|
||||
(print! (start "Updating pinned packages..."))
|
||||
|
@ -411,7 +411,7 @@ list remains lean."
|
|||
output)
|
||||
(or (cond
|
||||
((not (stringp target-ref))
|
||||
(print! (start "\033[K(%d/%d) Fetching %s...%s") i total package esc)
|
||||
(print! (start "\r(%d/%d) Fetching %s...%s") i total package esc)
|
||||
(doom-packages--straight-with (straight-vc-fetch-from-remote recipe)
|
||||
(when .it
|
||||
(straight-merge-package package)
|
||||
|
@ -422,13 +422,13 @@ list remains lean."
|
|||
(cl-return)))))
|
||||
|
||||
((doom-packages--same-commit-p target-ref ref)
|
||||
(print! (item "\033[K(%d/%d) %s is up-to-date...%s") i total package esc)
|
||||
(print! (item "\r(%d/%d) %s is up-to-date...%s") i total package esc)
|
||||
(cl-return))
|
||||
|
||||
((if (straight-vc-commit-present-p recipe target-ref)
|
||||
(print! (start "\033[K(%d/%d) Checking out %s (%s)...%s")
|
||||
(print! (start "\r(%d/%d) Checking out %s (%s)...%s")
|
||||
i total package (doom-packages--abbrev-commit target-ref) esc)
|
||||
(print! (start "\033[K(%d/%d) Fetching %s...%s") i total package esc)
|
||||
(print! (start "\r(%d/%d) Fetching %s...%s") i total package esc)
|
||||
(and (straight-vc-fetch-from-remote recipe)
|
||||
(straight-vc-commit-present-p recipe target-ref)))
|
||||
(straight-vc-check-out-commit recipe target-ref)
|
||||
|
@ -437,7 +437,7 @@ list remains lean."
|
|||
commits (length (split-string output "\n" t))))
|
||||
(doom-packages--same-commit-p target-ref (straight-vc-get-commit type local-repo)))
|
||||
|
||||
((print! (start "\033[K(%d/%d) Re-cloning %s...") i total local-repo esc)
|
||||
((print! (start "\r(%d/%d) Re-cloning %s...") i total local-repo esc)
|
||||
(let ((repo (straight--repos-dir local-repo))
|
||||
(straight-vc-git-default-clone-depth 'full))
|
||||
(delete-directory repo 'recursive)
|
||||
|
@ -448,7 +448,7 @@ list remains lean."
|
|||
(setq output (doom-packages--commit-log-between ref target-ref)
|
||||
commits (length (split-string output "\n" t))))))))
|
||||
(progn
|
||||
(print! (warn "\033[K(%d/%d) Failed to fetch %s")
|
||||
(print! (warn "\r(%d/%d) Failed to fetch %s")
|
||||
i total local-repo)
|
||||
(unless (string-empty-p output)
|
||||
(print-group! (print! (item "%s" output))))
|
||||
|
@ -472,7 +472,7 @@ list remains lean."
|
|||
(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%s")
|
||||
(print! (success "\r(%d/%d) %s: %s -> %s%s%s")
|
||||
i total local-repo
|
||||
(doom-packages--abbrev-commit ref)
|
||||
(doom-packages--abbrev-commit target-ref)
|
||||
|
@ -495,15 +495,14 @@ list remains lean."
|
|||
(error
|
||||
(signal 'doom-package-error (list package e)))))))
|
||||
(print-group!
|
||||
(princ "\033[K")
|
||||
(if (hash-table-empty-p packages-to-rebuild)
|
||||
(ignore (print! (success "All %d packages are up-to-date") total))
|
||||
(ignore (print! (success "\rAll %d packages are up-to-date") total))
|
||||
(doom-packages--cli-recipes-update)
|
||||
(straight--transaction-finalize)
|
||||
(let ((default-directory (straight--build-dir)))
|
||||
(mapc (doom-rpartial #'delete-directory 'recursive)
|
||||
(hash-table-keys packages-to-rebuild)))
|
||||
(print! (success "Updated %d package(s)")
|
||||
(print! (success "\rUpdated %d package(s)")
|
||||
(hash-table-count packages-to-rebuild))
|
||||
(doom-packages-ensure)
|
||||
t))))
|
||||
|
@ -532,22 +531,22 @@ list remains lean."
|
|||
(error "No repo specified for regrafting"))
|
||||
(let ((default-directory (straight--repos-dir repo)))
|
||||
(unless (file-directory-p ".git")
|
||||
(print! (warn "\033[Krepos/%s is not a git repo, skipping" repo))
|
||||
(print! (warn "\rrepos/%s is not a git repo, skipping" repo))
|
||||
(cl-return))
|
||||
(unless (file-in-directory-p default-directory straight-base-dir)
|
||||
(print! (warn "\033[KSkipping repos/%s because it is local" repo))
|
||||
(print! (warn "\rSkipping repos/%s because it is local" repo))
|
||||
(cl-return))
|
||||
(let ((before-size (doom-directory-size default-directory)))
|
||||
(doom-call-process "git" "reset" "--hard")
|
||||
(doom-call-process "git" "clean" "-ffd")
|
||||
(if (not (zerop (car (doom-call-process "git" "replace" "--graft" "HEAD"))))
|
||||
(print! (item "\033[Krepos/%s is already compact\033[1A" repo))
|
||||
(print! (item "\rrepos/%s is already compact\033[1A" repo))
|
||||
(doom-call-process "git" "reflog" "expire" "--expire=all" "--all")
|
||||
(doom-call-process "git" "gc" "--prune=now")
|
||||
(let ((after-size (doom-directory-size default-directory)))
|
||||
(if (equal after-size before-size)
|
||||
(print! (success "\033[Krepos/%s cannot be compacted further" repo))
|
||||
(print! (success "\033[KRegrafted repos/%s (from %0.1fKB to %0.1fKB)")
|
||||
(print! (success "\rrepos/%s cannot be compacted further" repo))
|
||||
(print! (success "\rRegrafted repos/%s (from %0.1fKB to %0.1fKB)")
|
||||
repo before-size after-size)))))
|
||||
t))
|
||||
|
||||
|
@ -559,9 +558,9 @@ list remains lean."
|
|||
(let ((before-size (doom-directory-size (straight--repos-dir))))
|
||||
(print-group!
|
||||
(prog1 (delq nil (mapcar #'doom-packages--regraft-repo repos))
|
||||
(princ "\033[K")
|
||||
;; (princ "\r\033[K")
|
||||
(let ((after-size (doom-directory-size (straight--repos-dir))))
|
||||
(print! (success "Finished regrafting. Size before: %0.1fKB and after: %0.1fKB (%0.1fKB)")
|
||||
(print! (success "\rFinished regrafting. Size before: %0.1fKB and after: %0.1fKB (%0.1fKB)")
|
||||
before-size after-size
|
||||
(- after-size before-size))))))))
|
||||
|
||||
|
@ -831,5 +830,37 @@ However, in batch mode, print to stdout instead of stderr."
|
|||
(error "Package was not properly cloned due to a connection failure, please try again later")
|
||||
(signal (car e) (cdr e))))))
|
||||
|
||||
;; HACK: Fix an issue where straight wasn't byte-compiling some packages (or
|
||||
;; some files in packages) due to missing (invisible) dependencies.
|
||||
(defadvice! doom-cli--straight-byte-compile-a (recipe)
|
||||
"See https://github.com/radian-software/straight.el/pull/1132"
|
||||
:override #'straight--build-compile
|
||||
(let* ((pkg (plist-get recipe :package))
|
||||
(dir (straight--build-dir pkg))
|
||||
(emacs (concat invocation-directory invocation-name))
|
||||
(buffer straight-byte-compilation-buffer)
|
||||
(deps
|
||||
(let (tmp)
|
||||
(dolist (dep (straight--flatten (straight-dependencies pkg)) tmp)
|
||||
(let ((build-dir (straight--build-dir dep)))
|
||||
(when (file-exists-p build-dir)
|
||||
(push build-dir tmp))))))
|
||||
(print-circle nil)
|
||||
(print-length nil)
|
||||
(program
|
||||
(format "%S" `(let ((default-directory ,(straight--build-dir))
|
||||
(lp load-path))
|
||||
(setq load-path (list default-directory))
|
||||
(normal-top-level-add-subdirs-to-load-path)
|
||||
(setq load-path (append '(,dir) ',deps load-path lp))
|
||||
(byte-recompile-directory ,dir 0 'force))))
|
||||
(args (list "-Q" "--batch" "--eval" program)))
|
||||
(when buffer
|
||||
(with-current-buffer (get-buffer-create buffer)
|
||||
(insert (format "\n$ %s %s \\\n %S\n" emacs
|
||||
(string-join (butlast args) " ")
|
||||
program))))
|
||||
(apply #'call-process `(,emacs nil ,buffer nil ,@args))))
|
||||
|
||||
(provide 'doom-cli-packages)
|
||||
;;; packages.el ends here
|
||||
|
|
|
@ -308,18 +308,25 @@ based on the print level of the message. For example:
|
|||
(defun doom-print--indent (text &optional prefix)
|
||||
"Indent TEXT by WIDTH spaces. If ARGS, format TEXT with them."
|
||||
(with-temp-buffer
|
||||
(let ((width
|
||||
(cond ((null prefix)
|
||||
doom-print-indent-increment)
|
||||
((integerp prefix)
|
||||
prefix)
|
||||
((length (ansi-color-filter-apply (format "%s" prefix)))))))
|
||||
(insert (format "%s" (or text "")))
|
||||
(let* ((re "^\\( *\\)\r")
|
||||
(line-feed (if (stringp text) (string-match-p re text)))
|
||||
(width (cond ((null prefix) doom-print-indent-increment)
|
||||
((integerp prefix) prefix)
|
||||
((length (ansi-color-filter-apply (format "%s" prefix)))))))
|
||||
(insert
|
||||
(if text
|
||||
(replace-regexp-in-string re "\\1\033[K" (format "%s" text))
|
||||
""))
|
||||
(indent-rigidly (point-min) (point-max) width)
|
||||
(when (stringp prefix)
|
||||
(goto-char (point-min))
|
||||
(delete-char width)
|
||||
(insert prefix))
|
||||
(save-excursion
|
||||
(when line-feed
|
||||
(goto-char (point-min))
|
||||
(insert "\r")))
|
||||
(save-excursion
|
||||
(when (stringp prefix)
|
||||
(goto-char (point-min))
|
||||
(delete-char (+ width (if line-feed 1 0)))
|
||||
(insert prefix)))
|
||||
(buffer-string))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue