Skip to content

Commit 256c87a

Browse files
committed
Update `eldev--global-cache-url-retrieve-synchronously' for changes in commit 6459ae9, otherwise packages from custom remote package archives were effectively uninstallable (issue #32).
1 parent dc8e1eb commit 256c87a

File tree

7 files changed

+69
-2
lines changed

7 files changed

+69
-2
lines changed

eldev.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,8 +1657,11 @@ Since 0.2."
16571657
;; somehow includes a slash.
16581658
(when (string-match-p (rx bos (1+ (any "a-zA-Z0-9" "-" ".+_@")) eos) filename)
16591659
(dolist (known eldev--known-package-archives)
1660-
(when (string= archive-url (cdr (nth 1 known)))
1661-
(throw 'dir (symbol-name (car known)))))
1660+
(let ((known-archive-url (cdr (nth 1 known))))
1661+
;; Because of stable/unstable archive, URL is, in
1662+
;; fact, not necessarily an URL.
1663+
(when (and (stringp known-archive-url) (string= archive-url known-archive-url))
1664+
(throw 'dir (symbol-name (car known))))))
16621665
;; Contents of other archives also gets cached, but
16631666
;; with encoded URL as directory name in case different
16641667
;; projects use the same archive under different names

test/README

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ package-archive-*/
2828
makes results more predictable, because real packages in real
2929
archives could change.
3030

31+
org-pseudoarchive/
32+
33+
Archive emulating Org snapshot archive, used to test that Eldev
34+
knows how to install more recent versions of built-in packages.
35+
3136
dependency-*/
3237

3338
Test "projects" also available from the local test archives above.

test/integration/misc.el

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,21 @@
3131
(should (string-match-p (rx "version 999.999 is required") stderr))
3232
(should (= exit-code 1)))))
3333

34+
;; https://github.com/doublep/eldev/issues/32
35+
;;
36+
;; Eldev would fail to provide Org snapshot to a project that depends on Org version newer
37+
;; than what is built into Emacs, even if appropriate package archive was configured. Was
38+
;; triggered by the bug in `eldev--global-cache-url-retrieve-synchronously'.
39+
(ert-deftest eldev-issue-32 ()
40+
(let ((eldev--test-project "issue-32-project"))
41+
(eldev--test-delete-cache)
42+
;; Test that it fails when no archive is configured.
43+
(eldev--test-run nil ("prepare")
44+
(should (= exit-code 1)))
45+
(eldev--test-delete-cache)
46+
;; But with an appropriate archive it should work.
47+
(eldev--test-run nil ("--setup" `(eldev-use-package-archive `("org" . "https://orgmode.org/elpa/")) "prepare")
48+
(should (= exit-code 0)))))
49+
3450

3551
(provide 'test/integration/misc)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
;;; issue-32-project.el --- A project that needs Org newer than what is built into Emacs
2+
3+
;; Version: 1.0
4+
;; Homepage: https://example.com/
5+
;; Package-Requires: ((org "20000000"))
6+
7+
;;; Commentary:
8+
9+
;;; Code:
10+
11+
(provide 'issue-32-project)
12+
13+
;;; issue-32-project.el ends here

test/misc.el

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,23 @@
1212
(should (= exit-code 1))))
1313

1414

15+
;; https://github.com/doublep/eldev/issues/32
16+
;;
17+
;; Eldev would fail to provide Org snapshot to a project that depends on Org version newer
18+
;; than what is built into Emacs, even if appropriate package archive was configured. It
19+
;; actually worked locally (bug in our `eldev--global-cache-url-retrieve-synchronously',
20+
;; was triggered only for remote URLs), see corresponding integration tests. This one is
21+
;; added for completeness, to catch potential errors in the future.
22+
(ert-deftest eldev-issue-32-local ()
23+
(let ((eldev--test-project "issue-32-project"))
24+
(eldev--test-delete-cache)
25+
;; Test that it fails when no archive is configured.
26+
(eldev--test-run nil ("prepare")
27+
(should (= exit-code 1)))
28+
(eldev--test-delete-cache)
29+
;; But with an appropriate archive it should work.
30+
(eldev--test-run nil ("--setup" `(eldev-use-package-archive `("org-pseudoarchive" . ,(expand-file-name "../org-pseudoarchive"))) "prepare")
31+
(should (= exit-code 0)))))
32+
33+
1534
(provide 'test/integration/misc)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(1
2+
(org . [(99999999 9999) nil "Fake of an Org snapshot" single nil]))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
;;; org.el --- Fake of an Org snapshot
2+
3+
;; Version: 99999999.9999
4+
5+
(defvar org-version "99999999.9999")
6+
7+
(provide 'org)
8+
9+
;;; org.el ends here

0 commit comments

Comments
 (0)