Make 'doom update' Skip local packages

i.e. packages with a user-specified :local-repo
This commit is contained in:
Henrik Lissner 2019-12-14 20:50:16 -05:00
parent 7b709eed34
commit 8dd647b9bd
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -136,7 +136,9 @@ declaration) or dependency thereof that hasn't already been."
(defun doom-cli-packages-update ()
"Updates packages."
(print! (start "Updating packages (this may take a while)..."))
(let ((straight--packages-to-rebuild (make-hash-table :test #'equal))
;; TODO Refactor me
(let ((straight--repos-dir (straight--repos-dir))
(straight--packages-to-rebuild (make-hash-table :test #'equal))
(total (hash-table-count straight--repo-cache))
(i 1)
errors)
@ -144,8 +146,11 @@ declaration) or dependency thereof that hasn't already been."
(dolist (recipe (hash-table-values straight--repo-cache))
(straight--with-plist recipe (package type local-repo)
(condition-case-unless-debug e
(let* ((default-directory (straight--repos-dir local-repo))
(commit (straight-vc-get-commit type local-repo)))
(let ((default-directory (straight--repos-dir local-repo)))
(if (not (file-in-directory-p default-directory straight--repos-dir))
(print! (warn "[%d/%d] Skipping %s because it is local")
i total package)
(let ((commit (straight-vc-get-commit type local-repo)))
(if (not (straight-vc-fetch-from-remote recipe))
(print! (warn "\033[K(%d/%d) Failed to fetch %s" i total package))
(let ((output (straight--process-get-output)))
@ -166,7 +171,7 @@ declaration) or dependency thereof that hasn't already been."
(print! "%s" (straight--process-get-output))))))
(print! (success "(%d/%d) %s updated (%s -> %s)") i total package
(substring commit 0 7)
(substring newcommit 0 7))))))
(substring newcommit 0 7))))))))
(cl-incf i))
(user-error
(signal 'user-error (error-message-string e)))