From df77b0e0bf947ab240b292020f1416a70711c308 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Mon, 30 Jan 2012 11:01:06 +0000 Subject: [PATCH] Use "last edited" timestamp when fetching from emacswiki, and figure out URL automatically --- package-build.el | 15 ++++++++++----- pkglist | 9 ++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-build.el b/package-build.el index 5dfa7dcf..7690f4f5 100644 --- a/package-build.el +++ b/package-build.el @@ -63,16 +63,19 @@ :group 'package-build :type 'string) -(defun package-build-checkout-wiki (repo dir) +(defun package-build-checkout-wiki (filename dir) "checkout a package from the wiki" (with-current-buffer (get-buffer-create "*package-build-checkout*") (message dir) (unless (file-exists-p dir) (make-directory dir)) (let ((default-directory dir) - (filename (file-name-nondirectory repo))) - (url-copy-file repo filename t) - (format-time-string "%Y%m%d" (current-time))))) + (download-url (format "http://www.emacswiki.org/emacs/download/%s" filename)) + (wiki-url (format "http://www.emacswiki.org/emacs/%s" filename))) + (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) "Find REGEX in current buffer and format as a proper time version." @@ -255,7 +258,9 @@ (cond ((eq repo-type 'wiki) (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) (print 'Subversion) (package-build-checkout-svn repo-url pkg-cwd)) diff --git a/pkglist b/pkglist index fb5dae03..f7142217 100644 --- a/pkglist +++ b/pkglist @@ -1,6 +1,5 @@ ;; -*- mode: emacs-lisp -*- ((ac-dabbrev - :url "http://www.emacswiki.org/emacs/download/ac-dabbrev.el" :fetcher wiki) (browse-kill-ring :url "git://github.com/todesschaf/browse-kill-ring.git" @@ -30,9 +29,7 @@ :fetcher git :files ("deft.el")) (dired+ - :url "http://www.emacswiki.org/emacs/download/dired+.el" - :fetcher wiki - :files ("dired+.el")) + :fetcher wiki) (elisp-slime-nav :url "https://github.com/purcell/elisp-slime-nav.git" :fetcher git @@ -120,9 +117,7 @@ :url "git://github.com/emacsmirror/pretty-mode.git" :fetcher git) (rainbow-delimiters - :url "http://www.emacswiki.org/emacs/download/rainbow-delimiters.el" - :fetcher wiki - :files ("rainbow-delimiters.el")) + :fetcher wiki) (rinari :url "git://github.com/eschulte/rinari.git" :fetcher git