Skip to content

Commit

Permalink
Fix commit 4ed8bc4 resulting in slightly wrong output (in verbose mode).
Browse files Browse the repository at this point in the history
  • Loading branch information
doublep committed Dec 14, 2024
1 parent 4292523 commit ce536cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
23 changes: 12 additions & 11 deletions eldev.el
Original file line number Diff line number Diff line change
Expand Up @@ -2729,23 +2729,24 @@ Since 0.2."
(signal 'eldev-error `(:hint ,(unless self `("Check output of `%s dependency-tree'" ,(eldev-shell-command t)))
"Cannot upgrade %s: `%s' has no such dependencies" ,(eldev-message-enumerate "package" (nreverse unknown-packages)) ,package-name))))
(dolist (dependency planned-packages)
;; Warning: can fall into infinite loop if we don't skip VC-fetched
;; packages here. Not sure how to test...
(when (or self (null (eldev--loading-mode (car dependency) t)))
(when (or self (null (eldev--loading-mode (car dependency))))
(setf non-local-plan-size (1+ non-local-plan-size))
;; If we determine that archive X has to be used for installing or
;; upgrading, always fetch more prioritized archives first: maybe we
;; skipped them only because cached contents files are too old.
(let ((used-archive (package-desc-archive (car dependency)))
(archive-scan archive-statuses))
(while archive-scan
(let ((archive (pop archive-scan)))
(cond ((string= used-archive (caar archive))
(setf archive-scan nil))
((not (eq (cdr archive) 'fetched-now))
(setf (cdr archive) nil
refetching-wanted t)
(eldev-verbose "Will refetch contents of package archive `%s' to make sure that `%s' really needs to be used" (caar archive) used-archive))))))))
;; Warning: can fall into infinite loop if we don't skip VC-fetched
;; packages here. Not sure how to test...
(unless (string= used-archive eldev--internal-vc-pseudoarchive)
(while archive-scan
(let ((archive (pop archive-scan)))
(cond ((string= used-archive (caar archive))
(setf archive-scan nil))
((not (eq (cdr archive) 'fetched-now))
(setf (cdr archive) nil
refetching-wanted t)
(eldev-verbose "Will refetch contents of package archive `%s' to make sure that `%s' really needs to be used" (caar archive) used-archive)))))))))
(when refetching-wanted
(throw 'refetch-archives t))
(when (and dry-run (> non-local-plan-size 0))
Expand Down
4 changes: 2 additions & 2 deletions test/vc-repositories.el
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
:description "Using original version of `dependency-a'"
(should (equal (butlast (eldev--test-line-list stdout)) '("\"Hello\"" "nil")))
(should (string-match-p (eldev--test-unstable-version-rx '(1 0 99) t) (nth 2 (eldev--test-line-list stdout))))
(should (string-match-p (format "Installing.+dependency-a.+from.+%s" (regexp-quote dependency-a-dir)) stderr))
(should (string-match-p (format "1/1.+Installing.+dependency-a.+from.+%s" (regexp-quote dependency-a-dir)) stderr))
(should (= exit-code 0)))
(let ((default-directory dependency-a-dir))
(eldev-with-file-buffer "dependency-a.el"
Expand All @@ -180,7 +180,7 @@
(eldev--test-run nil (:eval `("--setup" ,`(eldev-use-vc-repository 'dependency-a :git ,dependency-a-dir)
,@command))
:description "Upgrading"
(should (string-match-p (format "Upgrading.+dependency-a.+from.+%s" (regexp-quote dependency-a-dir)) stderr))
(should (string-match-p (format "1.1.+Upgrading.+dependency-a.+from.+%s" (regexp-quote dependency-a-dir)) stderr))
(should (= exit-code 0)))
(eldev--test-run nil ("--setup" `(eldev-use-vc-repository 'dependency-a :git ,dependency-a-dir)
"eval" `(dependency-a-hello) `(dependency-a-stable) `(package-desc-version (eldev-find-package-descriptor 'dependency-a)))
Expand Down

0 comments on commit ce536cf

Please sign in to comment.