@@ -502,6 +502,10 @@ You can pass BUFFER-OR-NAME to replace current buffer."
502
502
; ;
503
503
; ;; Archive
504
504
505
+ (defconst eask-package-archives-url-format
506
+ " https://raw.githubusercontent.com/emacs-eask/archives/master/%s/"
507
+ " The backup package archives url." )
508
+
505
509
(defun eask--locate-archive-contents (archive )
506
510
" Locate ARCHIVE's contents file."
507
511
(let* ((name (cond ((consp archive) (car archive))
@@ -535,38 +539,40 @@ Arguments FNC and ARGS are used for advice `:around'."
535
539
536
540
(defun eask--download-archives ()
537
541
" If archives download failed; download it manually."
538
- (dolist (archive package-archives)
539
- (cl-incf eask--action-index)
540
- (let* ((name (car archive))
541
- (local-file (eask--locate-archive-contents archive))
542
- (dir (file-name-directory local-file)) ; ~/.emacs.d/elpa/archives/{name}
543
- (file (file-name-nondirectory local-file)) ; archive-contents
544
- (url (format " https://raw.githubusercontent.com/emacs-eask/archives/master/%s / " name))
545
- (url-file (concat url file))
546
- (download-p)
547
- ; ; exclude local elpa
548
- (local-archive-p (string= name eask--local-archive-name))
549
- (fmt (eask--action-format (length package-archives))))
550
- (unless (file-exists-p local-file)
551
- (eask-with-verbosity-override 'log
552
- (when (= 1 eask--action-index) (eask-msg " " ))
553
- (eask-with-progress
554
- (format " - %s Downloading %s (%s ) manually... "
555
- (format fmt eask--action-index)
556
- (ansi-green name)
557
- (ansi-yellow url))
558
- (eask-with-verbosity 'debug
559
- (unless local-archive-p
542
+ (let ((archives (cl-remove-if (lambda (archive )
543
+ ; ; First, exclude the `local' archive.
544
+ (equal (car archive) eask--local-archive-name))
545
+ package-archives))
546
+ (one-download-p))
547
+ (dolist (archive archives)
548
+ (cl-incf eask--action-index)
549
+ (let* ((name (car archive))
550
+ (local-file (eask--locate-archive-contents archive))
551
+ (dir (file-name-directory local-file)) ; ~/.emacs.d/elpa/archives/{name}/
552
+ (contents (file-name-nondirectory local-file)) ; archive-contents
553
+ (url (format eask-package-archives-url-format name))
554
+ (url-file (concat url contents))
555
+ (download-p)
556
+ (fmt (eask--action-format (length archives))))
557
+ (unless (file-exists-p local-file)
558
+ (eask-with-verbosity-override 'log
559
+ (when (= 1 eask--action-index) (eask-println " " ))
560
+ (eask-with-progress
561
+ (format " - %s Downloading %s (%s ) manually... "
562
+ (format fmt eask--action-index)
563
+ (ansi-green name)
564
+ (ansi-yellow url))
565
+ (eask-with-verbosity 'debug
560
566
(if (url-file-exists-p url-file)
561
567
(progn
562
568
(ignore-errors (make-directory dir t ))
563
569
(url-copy-file url-file local-file t )
564
- (setq download-p t ))
565
- (eask-debug " No archive-contents found in `%s' " (ansi-green name))) ))
566
- ( cond (download-p " done ✓ " )
567
- (local-archive- p " skipped ✗ " )
568
- (t " failed ✗" )))))
569
- (when download-p (eask-pkg-init t ) ))))
570
+ (setq download-p t
571
+ one-download-p t ))
572
+ (eask-debug " No archive-contents found in `%s' " (ansi-green name))) )
573
+ ( cond (download- p " done ✓ " )
574
+ (t " failed ✗" )) )))))
575
+ (when one- download-p (eask-pkg-init t ))))
570
576
571
577
; ;
572
578
; ;; Package
@@ -1639,8 +1645,9 @@ argument COMMAND."
1639
1645
; ; On recipe
1640
1646
(when eask-depends-on-recipe-p
1641
1647
(eask-with-progress
1642
- (format " ✓ Checking local archives %s ... "
1643
- (ansi-magenta eask--local-archive-name))
1648
+ (concat (ansi-green " ✓ Checking local archives " )
1649
+ (ansi-magenta eask--local-archive-name)
1650
+ (ansi-green " ... " ))
1644
1651
(eask-with-verbosity 'debug
1645
1652
; ; Make sure can be customized by `source'
1646
1653
(unless (assoc eask--local-archive-name package-archives)
@@ -1652,7 +1659,7 @@ argument COMMAND."
1652
1659
; ; high number so user we always use the specified dependencies!
1653
1660
(add-to-list 'package-archive-priorities
1654
1661
`(, eask--local-archive-name . 90 ) t )))
1655
- " done!" )))
1662
+ (ansi-green " done!" ) )))
1656
1663
1657
1664
(add-hook 'eask-file-loaded-hook #'eask--setup-dependencies )
1658
1665
0 commit comments