+(defcustom package-check-signature 'allow-unsigned
+ "Whether to check package signatures when installing."
+ :type '(choice (const nil :tag "Never")
+ (const allow-unsigned :tag "Allow unsigned")
+ (const t :tag "Check always"))
+ :risky t
+ :group 'package
+ :version "24.1")
+
+(defcustom package-unsigned-archives nil
+ "A list of archives which do not use package signature."
+ :type '(repeat (string :tag "Archive name"))
+ :risky t
+ :group 'package
+ :version "24.1")
+
+(defvar package--default-summary "No description available.")
+
+(cl-defstruct (package-desc
+ ;; Rename the default constructor from `make-package-desc'.
+ (:constructor package-desc-create)
+ ;; Has the same interface as the old `define-package',
+ ;; which is still used in the "foo-pkg.el" files. Extra
+ ;; options can be supported by adding additional keys.
+ (:constructor
+ package-desc-from-define
+ (name-string version-string &optional summary requirements
+ &rest rest-plist
+ &aux
+ (name (intern name-string))
+ (version (version-to-list version-string))
+ (reqs (mapcar #'(lambda (elt)
+ (list (car elt)
+ (version-to-list (cadr elt))))
+ (if (eq 'quote (car requirements))
+ (nth 1 requirements)
+ requirements)))
+ (kind (plist-get rest-plist :kind))
+ (archive (plist-get rest-plist :archive))
+ (extras (let (alist)
+ (while rest-plist
+ (unless (memq (car rest-plist) '(:kind :archive))
+ (let ((value (cadr rest-plist)))
+ (when value
+ (push (cons (car rest-plist)
+ (if (eq (car-safe value) 'quote)
+ (cdr value)
+ value))
+ alist))))
+ (setq rest-plist (cddr rest-plist)))
+ alist)))))
+ "Structure containing information about an individual package.
+Slots:
+
+`name' Name of the package, as a symbol.
+
+`version' Version of the package, as a version list.
+
+`summary' Short description of the package, typically taken from
+ the first line of the file.
+
+`reqs' Requirements of the package. A list of (PACKAGE
+ VERSION-LIST) naming the dependent package and the minimum
+ required version.
+
+`kind' The distribution format of the package. Currently, it is
+ either `single' or `tar'.
+
+`archive' The name of the archive (as a string) whence this
+ package came.
+
+`dir' The directory where the package is installed (if installed),
+ `builtin' if it is built-in, or nil otherwise.
+
+`extras' Optional alist of additional keyword-value pairs.
+
+`signed' Flag to indicate that the package is signed by provider."
+ name
+ version
+ (summary package--default-summary)
+ reqs
+ kind
+ archive
+ dir
+ extras
+ signed)
+
+;; Pseudo fields.
+(defun package-desc-full-name (pkg-desc)
+ (format "%s-%s"
+ (package-desc-name pkg-desc)
+ (package-version-join (package-desc-version pkg-desc))))
+
+(defun package-desc-suffix (pkg-desc)
+ (pcase (package-desc-kind pkg-desc)
+ (`single ".el")
+ (`tar ".tar")
+ (kind (error "Unknown package kind: %s" kind))))
+
+(defun package-desc--keywords (pkg-desc)
+ (let ((keywords (cdr (assoc :keywords (package-desc-extras pkg-desc)))))
+ (if (eq (car-safe keywords) 'quote)
+ (nth 1 keywords)
+ keywords)))
+
+;; Package descriptor format used in finder-inf.el and package--builtins.
+(cl-defstruct (package--bi-desc
+ (:constructor package-make-builtin (version summary))
+ (:type vector))
+ version
+ reqs
+ summary)
+