Function: package-vc--unpack
package-vc--unpack is a byte-compiled function defined in
package-vc.el.gz.
Signature
(package-vc--unpack PKG-DESC PKG-SPEC &optional REV)
Documentation
Install the package described by PKG-DESC.
PKG-SPEC is a package specification, a property list describing
how to fetch and build the package. See package-vc--archive-spec-alists
for details. The optional argument REV specifies a specific revision to
checkout. This overrides the :branch attribute in PKG-SPEC.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/package-vc.el.gz
(defun package-vc--unpack (pkg-desc pkg-spec &optional rev)
"Install the package described by PKG-DESC.
PKG-SPEC is a package specification, a property list describing
how to fetch and build the package. See `package-vc--archive-spec-alists'
for details. The optional argument REV specifies a specific revision to
checkout. This overrides the `:branch' attribute in PKG-SPEC."
(unless (eq (package-desc-kind pkg-desc) 'vc)
(let ((copy (copy-package-desc pkg-desc)))
(setf (package-desc-kind copy) 'vc
pkg-desc copy)))
(let* ((name (package-desc-name pkg-desc))
(dirname (package-desc-full-name pkg-desc))
(pkg-dir (file-name-as-directory (expand-file-name dirname package-user-dir))))
(when (string-empty-p name)
(user-error "Empty package name"))
(setf (package-desc-dir pkg-desc) pkg-dir)
(when (file-exists-p pkg-dir)
(if (yes-or-no-p (format "Overwrite previous checkout for package `%s'?" name))
(package--delete-directory pkg-dir)
(error "There already exists a checkout for %s" name)))
(package-vc--clone pkg-desc pkg-spec pkg-dir rev)
(when (directory-empty-p pkg-dir)
(delete-directory pkg-dir)
(error "Empty checkout for %s" name))
(unless (seq-remove
(lambda (file)
(member (file-name-nondirectory file) package-vc-non-code-file-names))
(directory-files-recursively pkg-dir "\\.el\\'" nil))
(when (yes-or-no-p (format "No Emacs Lisp files found when fetching \"%s\", \
abort installation?" name))
(delete-directory pkg-dir t)
(user-error "Installation aborted")))
;; Ensure we have a copy of the package specification
(when (null (package-vc--desc->spec pkg-desc name))
(customize-save-variable
'package-vc-selected-packages
(cons (cons name pkg-spec)
(seq-remove (lambda (spec) (string= name (car spec)))
package-vc-selected-packages))))
(package-vc--unpack-1 pkg-desc)))