all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: emacs-devel@gnu.org
Subject: package.el support for file: URLs (was: Package.el merged)
Date: Sat, 14 Aug 2010 10:01:42 -0500	[thread overview]
Message-ID: <87sk2hdyqx.fsf_-_@lifelogs.com> (raw)
In-Reply-To: 87d3tmbc80.fsf@lifelogs.com

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]

On Fri, 13 Aug 2010 13:26:39 -0500 Ted Zlatanov <tzz@lifelogs.com> wrote: 

TZ> On Wed, 16 Jun 2010 22:39:18 -0400 Chong Yidong <cyd@stupidchicken.com> wrote: 
CY> Currently package.el is not in loadup.el; I am still unsure whether to
CY> add it, or use autoloads and juggle things so that it's not loaded
CY> unless the user installs a package.

TZ> I think autoloading package.el could create subtle problems later on,
TZ> especially for distros.  Putting it in loadup.el is probably safer.

Also, package.el assumes HTTP URLs so it breaks if you try to set up a
local ELPA repo.  I made it work with these changes to just two
functions.  The change introduces filep and uses it to determine if we
need to do:

        (package-handle-response)
        (re-search-forward "^$" nil 'move)
        (forward-char)

Patch attached, please review as I don't know package.el so well.  It
seems to work for me.

Ted


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: package.fileURLs.patch --]
[-- Type: text/x-diff, Size: 1709 bytes --]

=== modified file 'lisp/emacs-lisp/package.el'
--- lisp/emacs-lisp/package.el	2010-08-09 18:05:56 +0000
+++ lisp/emacs-lisp/package.el	2010-08-14 14:59:14 +0000
@@ -656,13 +656,15 @@
 
 (defun package-download-tar (name version)
   "Download and install a tar package."
-  (let ((tar-buffer (url-retrieve-synchronously
-		     (concat (package-archive-url name)
-			     (symbol-name name) "-" version ".tar"))))
+  (let* ((tar-url (concat (package-archive-url name)
+                          (symbol-name name) "-" version ".tar"))
+         (filep (equal "file" (url-type (url-generic-parse-url tar-url))))
+         (tar-buffer (url-retrieve-synchronously tar-url)))
     (with-current-buffer tar-buffer
-      (package-handle-response)
-      (re-search-forward "^$" nil 'move)
-      (forward-char)
+      (unless filep
+        (package-handle-response)
+        (re-search-forward "^$" nil 'move)
+        (forward-char))
       (package-unpack name version)
       (kill-buffer tar-buffer))))
 
@@ -995,11 +997,13 @@
          (archive-url  (cdr archive))
 	 (dir (expand-file-name "archives" package-user-dir))
 	 (dir (expand-file-name archive-name dir))
+         (filep (equal "file" (url-type (url-generic-parse-url archive-url))))
          (buffer (url-retrieve-synchronously (concat archive-url file))))
     (with-current-buffer buffer
-      (package-handle-response)
-      (re-search-forward "^$" nil 'move)
-      (forward-char)
+      (unless filep
+        (package-handle-response)
+        (re-search-forward "^$" nil 'move)
+        (forward-char))
       (delete-region (point-min) (point))
       (make-directory dir t)
       (setq buffer-file-name (expand-file-name file dir))


  reply	other threads:[~2010-08-14 15:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17  2:39 Package.el merged Chong Yidong
2010-06-17  5:42 ` joakim
     [not found] ` <AANLkTikn6YWhPHTSz9FqGgpkOLdYoTnfeWNIlhoxm9DP@mail.gmail.com>
2010-06-18  4:21   ` Fwd: " Phil Hagelberg
2010-06-18 16:30     ` Chong Yidong
2010-06-18 16:59       ` Juanma Barranquero
2010-07-19 19:36   ` Phil Hagelberg
2010-07-22 18:58     ` Chong Yidong
2010-07-28 18:57     ` Chong Yidong
2010-08-13 18:26 ` Ted Zlatanov
2010-08-14 15:01   ` Ted Zlatanov [this message]
2010-08-14 22:13     ` package.el support for file: URLs Chong Yidong
2010-08-15  2:11     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sk2hdyqx.fsf_-_@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.