Use "last edited" timestamp when fetching from emacswiki, and figure out URL automatically

This commit is contained in:
Steve Purcell 2012-01-30 11:01:06 +00:00
parent 73062e6349
commit df77b0e0bf
2 changed files with 12 additions and 12 deletions

View file

@ -63,16 +63,19 @@
:group 'package-build :group 'package-build
:type 'string) :type 'string)
(defun package-build-checkout-wiki (repo dir) (defun package-build-checkout-wiki (filename dir)
"checkout a package from the wiki" "checkout a package from the wiki"
(with-current-buffer (get-buffer-create "*package-build-checkout*") (with-current-buffer (get-buffer-create "*package-build-checkout*")
(message dir) (message dir)
(unless (file-exists-p dir) (unless (file-exists-p dir)
(make-directory dir)) (make-directory dir))
(let ((default-directory dir) (let ((default-directory dir)
(filename (file-name-nondirectory repo))) (download-url (format "http://www.emacswiki.org/emacs/download/%s" filename))
(url-copy-file repo filename t) (wiki-url (format "http://www.emacswiki.org/emacs/%s" filename)))
(format-time-string "%Y%m%d" (current-time))))) (url-copy-file download-url filename t)
(with-current-buffer (url-retrieve-synchronously wiki-url)
(package-build-find-parse-time
"Last edited \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\} [A-Z]\\{3\\}\\)")))))
(defun package-build-find-parse-time (regex) (defun package-build-find-parse-time (regex)
"Find REGEX in current buffer and format as a proper time version." "Find REGEX in current buffer and format as a proper time version."
@ -255,7 +258,9 @@
(cond (cond
((eq repo-type 'wiki) ((eq repo-type 'wiki)
(print 'EmacsWiki) (print 'EmacsWiki)
(package-build-checkout-wiki repo-url pkg-cwd)) (package-build-checkout-wiki (or (car (plist-get cfg :files))
(concat file-name ".el"))
pkg-cwd))
((eq repo-type 'svn) ((eq repo-type 'svn)
(print 'Subversion) (print 'Subversion)
(package-build-checkout-svn repo-url pkg-cwd)) (package-build-checkout-svn repo-url pkg-cwd))

View file

@ -1,6 +1,5 @@
;; -*- mode: emacs-lisp -*- ;; -*- mode: emacs-lisp -*-
((ac-dabbrev ((ac-dabbrev
:url "http://www.emacswiki.org/emacs/download/ac-dabbrev.el"
:fetcher wiki) :fetcher wiki)
(browse-kill-ring (browse-kill-ring
:url "git://github.com/todesschaf/browse-kill-ring.git" :url "git://github.com/todesschaf/browse-kill-ring.git"
@ -30,9 +29,7 @@
:fetcher git :fetcher git
:files ("deft.el")) :files ("deft.el"))
(dired+ (dired+
:url "http://www.emacswiki.org/emacs/download/dired+.el" :fetcher wiki)
:fetcher wiki
:files ("dired+.el"))
(elisp-slime-nav (elisp-slime-nav
:url "https://github.com/purcell/elisp-slime-nav.git" :url "https://github.com/purcell/elisp-slime-nav.git"
:fetcher git :fetcher git
@ -120,9 +117,7 @@
:url "git://github.com/emacsmirror/pretty-mode.git" :url "git://github.com/emacsmirror/pretty-mode.git"
:fetcher git) :fetcher git)
(rainbow-delimiters (rainbow-delimiters
:url "http://www.emacswiki.org/emacs/download/rainbow-delimiters.el" :fetcher wiki)
:fetcher wiki
:files ("rainbow-delimiters.el"))
(rinari (rinari
:url "git://github.com/eschulte/rinari.git" :url "git://github.com/eschulte/rinari.git"
:fetcher git :fetcher git