├── .gitignore ├── Makefile ├── README.md ├── emacswiki-elpa.el └── todo.org /.gitignore: -------------------------------------------------------------------------------- 1 | /packages/ 2 | /working/ 3 | /epkg.sqlite 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # https://emacs-china.org/ 2 | .PHONY: all packages sync badge 3 | all: packages sync badge 4 | 5 | packages: 6 | @printf "Generating packages\n" 7 | emacs -Q --batch -L . -l emacswiki-elpa -f emacswiki-elpa 8 | 9 | sync: 10 | @printf "Syncing for web server\n" 11 | rsync -av packages/ /var/elpa/emacswiki 12 | @printf "Syncing for rsync\n" 13 | rsync -av packages/ /var/elpa-packages/emacswiki 14 | 15 | CURL = curl -fsSkL --retry 9 --retry-delay 9 16 | 17 | badge: 18 | @printf "Generating last-update.svg...\n" 19 | DATE=$(shell date -u | sed 's| |_|g') && \ 20 | $(CURL) "https://img.shields.io/badge/Last_Update-$$DATE-brightgreen.svg" -o last-update.svg && \ 21 | cp last-update.svg /var/elpa/emacswiki/ 22 | @printf "Generating last-update.svg...\n" 23 | COUNT=$(shell emacs -Q --batch --file packages/archive-contents --eval '(princ (length (cdr (read (current-buffer)))))') && \ 24 | $(CURL) "https://img.shields.io/badge/Total_Packages-$$COUNT-brightgreen.svg" -o count.svg && \ 25 | cp count.svg /var/elpa/emacswiki/ 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EmacsWiki ELPA [![Last Update Badge][badge1-link]][badge1-link] [![Total Packages Badge][badge2-link]][badge2-link] 2 | 3 | [badge1-link]: https://elpa.emacs-china.org/emacswiki/last-update.svg 4 | [badge2-link]: https://elpa.emacs-china.org/emacswiki/count.svg 5 | 6 | EmacsWiki ELPA is an Emacs Lisp Package Archive for packages on [EmacsWiki][emacswiki]. 7 | 8 | [emacswiki]: https://www.emacswiki.org/ 9 | 10 | It is available via HTTP, HTTPS and Rsync. 11 | 12 | - http://mirrors.tuna.tsinghua.edu.cn/elpa/emacswiki/ 13 | - https://mirrors.tuna.tsinghua.edu.cn/elpa/emacswiki/ 14 | - `rsync://mirrors.tuna.tsinghua.edu.cn/elpa/emacswiki/` 15 | 16 | ## `package.el` 17 | 18 | `package.el` supports HTTP and HTTPS, you should use HTTPS whenever possible. Adding the following to your Emacs init file such as `~/.emacs.d/init.el` 19 | 20 | ```elisp 21 | (require 'package) 22 | (add-to-list 23 | 'package-archives 24 | '("emacswiki" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/emacswiki/") t) 25 | ``` 26 | 27 | ## Acknowledgments 28 | 29 | - [Emacsmirror][emacsmirror] provides metadata and github mirrors for packages on EmacsWiki. 30 | - [MELPA][melpa] provides `package-build.el` for building ELPA from git repositories. 31 | - [Emacs China][emacs-china] provides VPS. 32 | - [清华大学开源软件镜像站][tuna-mirror] provides fast and reliable mirror service. 33 | 34 | [emacsmirror]: https://emacsmirror.net/ 35 | [melpa]: https://github.com/melpa/melpa/ 36 | [emacs-china]: https://emacs-china.org/ 37 | [tuna-mirror]: https://mirrors.tuna.tsinghua.edu.cn/ 38 | -------------------------------------------------------------------------------- /emacswiki-elpa.el: -------------------------------------------------------------------------------- 1 | ;;; emacswiki-elpa.el --- Emacswiki ELPA -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Xu Chunyang 4 | 5 | ;; Author: Xu Chunyang 6 | ;; Package-Requires: ((package-build "0.1")) 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; 24 | 25 | ;;; Code: 26 | 27 | (require 'package-build) 28 | (require 'cl-lib) 29 | 30 | (defconst emacswiki-elpa-pwd (file-name-directory (or load-file-name (buffer-file-name)))) 31 | 32 | (defun emacswiki-elpa-recipe-alist () 33 | (let (list) 34 | (let ((db (expand-file-name "epkg.sqlite" emacswiki-elpa-pwd))) 35 | ;; FIXME This file needs to be update. However, accessing github 36 | ;; from China is too slow. 37 | (unless (file-exists-p db) 38 | (url-copy-file "https://raw.githubusercontent.com/emacsmirror/epkgs/master/epkg.sqlite" db)) 39 | (with-temp-buffer 40 | (call-process "sqlite3" nil t nil 41 | db "-separator" " " "select name, mirror_url from packages where class='wiki'") 42 | (setq list (read (concat "(" (buffer-string) ")"))))) 43 | (cl-loop for (name url) on list by #'cddr 44 | collect `(,(intern name) :fetcher git :url ,url)))) 45 | 46 | (defun emacswiki-elpa () 47 | (let ((package-build-working-dir (expand-file-name "working/" emacswiki-elpa-pwd)) 48 | (package-build-archive-dir (expand-file-name "packages/" emacswiki-elpa-pwd)) 49 | (package-build--recipe-alist (emacswiki-elpa-recipe-alist))) 50 | (package-build-all))) 51 | 52 | (provide 'emacswiki-elpa) 53 | ;;; emacswiki-elpa.el ends here 54 | -------------------------------------------------------------------------------- /todo.org: -------------------------------------------------------------------------------- 1 | * TODO Use latest package-build.el 2 | * TODO Delete *.entry 3 | 4 | See https://mirrors.tuna.tsinghua.edu.cn/elpa/emacswiki/ 5 | 6 | * TODO Investigate build failed packages 7 | 8 | One possible reason is that the default "melpa recipe" don't work for ALL EmacsWiki packages. 9 | 10 | * DONE Badge for total packages 11 | 12 | ~package-build-archive-alist-as-json~ should be helpful. 13 | --------------------------------------------------------------------------------