]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/package-x.el
Update copyright year to 2016
[gnu-emacs] / lisp / emacs-lisp / package-x.el
index 1d9d1a04668a965082f782ca022c5d233c9bece3..32070dba418ef1b35acd1e291d3b9bfed4d6f1ae 100644 (file)
@@ -1,6 +1,6 @@
 ;;; package-x.el --- Package extras
 
-;; Copyright (C) 2007-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2016 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <tromey@redhat.com>
 ;; Created: 10 Mar 2007
@@ -156,6 +156,7 @@ DESCRIPTION is the text of the news item."
                               archive-url))
 
 (declare-function lm-commentary "lisp-mnt" (&optional file))
+(defvar tar-data-buffer)
 
 (defun package-upload-buffer-internal (pkg-desc extension &optional archive-url)
   "Upload a package whose contents are in the current buffer.
@@ -207,6 +208,10 @@ if it exists."
               (pkg-version (package-version-join split-version))
               (pkg-buffer (current-buffer)))
 
+          ;; `package-upload-file' will error if given a directory,
+          ;; but we check it here as well just in case.
+          (when (eq 'dir file-type)
+            (user-error "Can't upload directory, tar it instead"))
          ;; Get archive-contents from ARCHIVE-URL if it's non-nil, or
          ;; from `package-archive-upload-base' otherwise.
          (let ((contents (or (package--archive-contents-from-url archive-url)
@@ -243,7 +248,7 @@ if it exists."
                             (concat (symbol-name pkg-name) "-readme.txt")
                             package-archive-upload-base)))
 
-           (set-buffer pkg-buffer)
+           (set-buffer (if (eq file-type 'tar) tar-data-buffer pkg-buffer))
            (write-region (point-min) (point-max)
                          (expand-file-name
                           (format "%s-%s.%s" pkg-name pkg-version extension)