From b511b994ae5fc66d36a64f54eb71b87612463918 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 8 Mar 2011 13:58:40 +0100 Subject: [PATCH] * simple.el (shell-command-to-string): Use `process-file'. * emacs-lisp/package.el (package-tar-file-info): Handle also remote files. * emacs-lisp/package-x.el (package-upload-buffer-internal): Use `equal' for upload base check. --- lisp/ChangeLog | 10 +++++ lisp/emacs-lisp/package-x.el | 8 ++-- lisp/emacs-lisp/package.el | 77 +++++++++++++++++++----------------- lisp/simple.el | 2 +- 4 files changed, 55 insertions(+), 42 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6aa6993a70..ca21c9ebf2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2011-03-08 Michael Albinus + + * simple.el (shell-command-to-string): Use `process-file'. + + * emacs-lisp/package.el (package-tar-file-info): Handle also + remote files. + + * emacs-lisp/package-x.el (package-upload-buffer-internal): Use + `equal' for upload base check. + 2011-03-08 Arni Magnusson (tiny change) * textmodes/texinfo.el (texinfo-environments): diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el index 4de95f6570..cd4b5ee231 100644 --- a/lisp/emacs-lisp/package-x.el +++ b/lisp/emacs-lisp/package-x.el @@ -185,9 +185,9 @@ if it exists." (let ((package-archive-upload-base package-archive-upload-base)) ;; Check if `package-archive-upload-base' is valid. (when (or (not (stringp package-archive-upload-base)) - (eq package-archive-upload-base - (car-safe - (get 'package-archive-upload-base 'standard-value)))) + (equal package-archive-upload-base + (car-safe + (get 'package-archive-upload-base 'standard-value)))) (setq package-archive-upload-base (read-directory-name "Base directory for package archive: "))) @@ -306,4 +306,4 @@ This should be invoked from the gnus *Summary* buffer." (provide 'package-x) -;;; package.el ends here +;;; package-x.el ends here diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2552ad4eb6..397feb4563 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -911,43 +911,46 @@ boundaries." "Find package information for a tar file. FILE is the name of the tar file to examine. The return result is a vector like `package-buffer-info'." - (unless (string-match "^\\(.+\\)-\\([0-9.]+\\)\\.tar$" file) - (error "Invalid package name `%s'" file)) - (let* ((pkg-name (file-name-nondirectory (match-string-no-properties 1 file))) - (pkg-version (match-string-no-properties 2 file)) - ;; Extract the package descriptor. - (pkg-def-contents (shell-command-to-string - ;; Requires GNU tar. - (concat "tar -xOf " file " " - pkg-name "-" pkg-version "/" - pkg-name "-pkg.el"))) - (pkg-def-parsed (package-read-from-string pkg-def-contents))) - (unless (eq (car pkg-def-parsed) 'define-package) - (error "No `define-package' sexp is present in `%s-pkg.el'" pkg-name)) - (let ((name-str (nth 1 pkg-def-parsed)) - (version-string (nth 2 pkg-def-parsed)) - (docstring (nth 3 pkg-def-parsed)) - (requires (nth 4 pkg-def-parsed)) - (readme (shell-command-to-string - ;; Requires GNU tar. - (concat "tar -xOf " file " " - pkg-name "-" pkg-version "/README")))) - (unless (equal pkg-version version-string) - (error "Package has inconsistent versions")) - (unless (equal pkg-name name-str) - (error "Package has inconsistent names")) - ;; Kind of a hack. - (if (string-match ": Not found in archive" readme) - (setq readme nil)) - ;; Turn string version numbers into list form. - (if (eq (car requires) 'quote) - (setq requires (car (cdr requires)))) - (setq requires - (mapcar (lambda (elt) - (list (car elt) - (version-to-list (cadr elt)))) - requires)) - (vector pkg-name requires docstring version-string readme)))) + (let ((default-directory (file-name-directory file)) + (file (file-name-nondirectory file))) + (unless (string-match "^\\(.+\\)-\\([0-9.]+\\)\\.tar$" file) + (error "Invalid package name `%s'" file)) + (let* ((pkg-name (match-string-no-properties 1 file)) + (pkg-version (match-string-no-properties 2 file)) + ;; Extract the package descriptor. + (pkg-def-contents (shell-command-to-string + ;; Requires GNU tar. + (concat "tar -xOf " file " " + + pkg-name "-" pkg-version "/" + pkg-name "-pkg.el"))) + (pkg-def-parsed (package-read-from-string pkg-def-contents))) + (unless (eq (car pkg-def-parsed) 'define-package) + (error "No `define-package' sexp is present in `%s-pkg.el'" pkg-name)) + (let ((name-str (nth 1 pkg-def-parsed)) + (version-string (nth 2 pkg-def-parsed)) + (docstring (nth 3 pkg-def-parsed)) + (requires (nth 4 pkg-def-parsed)) + (readme (shell-command-to-string + ;; Requires GNU tar. + (concat "tar -xOf " file " " + pkg-name "-" pkg-version "/README")))) + (unless (equal pkg-version version-string) + (error "Package has inconsistent versions")) + (unless (equal pkg-name name-str) + (error "Package has inconsistent names")) + ;; Kind of a hack. + (if (string-match ": Not found in archive" readme) + (setq readme nil)) + ;; Turn string version numbers into list form. + (if (eq (car requires) 'quote) + (setq requires (car (cdr requires)))) + (setq requires + (mapcar (lambda (elt) + (list (car elt) + (version-to-list (cadr elt)))) + requires)) + (vector pkg-name requires docstring version-string readme))))) ;;;###autoload (defun package-install-from-buffer (pkg-info type) diff --git a/lisp/simple.el b/lisp/simple.el index a2dda5f04d..653501625b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2628,7 +2628,7 @@ specifies the value of ERROR-BUFFER." (with-output-to-string (with-current-buffer standard-output - (call-process shell-file-name nil t nil shell-command-switch command)))) + (process-file shell-file-name nil t nil shell-command-switch command)))) (defun process-file (program &optional infile buffer display &rest args) "Process files synchronously in a separate process. -- 2.20.1