summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/package.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/package.el')
-rw-r--r--lisp/emacs-lisp/package.el59
1 files changed, 29 insertions, 30 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 4d7ed8f121c..10944f81534 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -289,7 +289,11 @@ contrast, `package-user-dir' contains packages for personal use."
:group 'package
:version "24.1")
-(defcustom package-check-signature 'allow-unsigned
+(defvar epg-gpg-program)
+
+(defcustom package-check-signature
+ (if (progn (require 'epg-config) (executable-find epg-gpg-program))
+ 'allow-unsigned)
"Non-nil means to check package signatures when installing.
The value `allow-unsigned' means to still install a package even if
it is unsigned.
@@ -689,11 +693,9 @@ untar into a directory named DIR; otherwise, signal an error."
(error "Package does not untar cleanly into directory %s/" dir)))))
(tar-untar-buffer))
-(defun package-generate-description-file (pkg-desc pkg-dir)
+(defun package-generate-description-file (pkg-desc pkg-file)
"Create the foo-pkg.el file for single-file packages."
- (let* ((name (package-desc-name pkg-desc))
- (pkg-file (expand-file-name (package--description-file pkg-dir)
- pkg-dir)))
+ (let* ((name (package-desc-name pkg-desc)))
(let ((print-level nil)
(print-quoted t)
(print-length nil))
@@ -714,25 +716,20 @@ untar into a directory named DIR; otherwise, signal an error."
(list (car elt)
(package-version-join (cadr elt))))
requires))))
- (let ((alist (package-desc-extras pkg-desc))
- flat)
- (while alist
- (let* ((pair (pop alist))
- (key (car pair))
- (val (cdr pair)))
- ;; Don't bother ‘quote’ing ‘key’; it is always a keyword.
- (push key flat)
- (push (if (and (not (consp val))
- (or (keywordp val)
- (not (symbolp val))
- (memq val '(nil t))))
- val
- `',val)
- flat)))
- (nreverse flat))))
+ (package--alist-to-plist-args
+ (package-desc-extras pkg-desc))))
"\n")
nil pkg-file nil 'silent))))
+(defun package--alist-to-plist-args (alist)
+ (mapcar (lambda (x)
+ (if (and (not (consp x))
+ (or (keywordp x)
+ (not (symbolp x))
+ (memq x '(nil t))))
+ x `',x))
+ (apply #'nconc
+ (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist))))
(defun package-unpack (pkg-desc)
"Install the contents of the current buffer as a package."
(let* ((name (package-desc-name pkg-desc))
@@ -764,9 +761,10 @@ untar into a directory named DIR; otherwise, signal an error."
(defun package--make-autoloads-and-stuff (pkg-desc pkg-dir)
"Generate autoloads, description file, etc.. for PKG-DESC installed at PKG-DIR."
(package-generate-autoloads (package-desc-name pkg-desc) pkg-dir)
- (let ((desc-file (package--description-file pkg-dir)))
+ (let ((desc-file (expand-file-name (package--description-file pkg-dir)
+ pkg-dir)))
(unless (file-exists-p desc-file)
- (package-generate-description-file pkg-desc pkg-dir)))
+ (package-generate-description-file pkg-desc desc-file)))
;; FIXME: Create foo.info and dir file from foo.texi?
)
@@ -1303,7 +1301,8 @@ similar to an entry in `package-alist'. Save the cached copy to
(setq file (expand-file-name file))
(let ((context (epg-make-context 'OpenPGP))
(homedir (expand-file-name "gnupg" package-user-dir)))
- (make-directory homedir t)
+ (with-file-modes 448
+ (make-directory homedir t))
(epg-context-set-home-directory context homedir)
(message "Importing %s..." (file-name-nondirectory file))
(epg-import-keys-from-file context file)
@@ -1320,12 +1319,12 @@ makes them available for download."
(make-directory package-user-dir t))
(let ((default-keyring (expand-file-name "package-keyring.gpg"
data-directory)))
- (if (file-exists-p default-keyring)
- (condition-case-unless-debug error
- (progn
- (epg-check-configuration (epg-configuration))
- (package-import-keyring default-keyring))
- (error (message "Cannot import default keyring: %S" (cdr error))))))
+ (when (and package-check-signature (file-exists-p default-keyring))
+ (condition-case-unless-debug error
+ (progn
+ (epg-check-configuration (epg-configuration))
+ (package-import-keyring default-keyring))
+ (error (message "Cannot import default keyring: %S" (cdr error))))))
(dolist (archive package-archives)
(condition-case-unless-debug nil
(package--download-one-archive archive "archive-contents")