use archive-file-name for find-package-file

removes some duplicated functionality
This commit is contained in:
Donald Curtis 2013-03-28 16:53:58 -05:00
parent 27a8d21c6f
commit d2de69278e

View file

@ -582,13 +582,13 @@ If PKG-INFO is nil, an empty one is created."
(defun pb/archive-file-name (archive-entry) (defun pb/archive-file-name (archive-entry)
"Return the path of the file in which the package for ARCHIVE-ENTRY is stored." "Return the path of the file in which the package for ARCHIVE-ENTRY is stored."
(expand-file-name (format "%s-%s.%s" (let* ((name (car archive-entry))
(car archive-entry) (pkg-info (cdr archive-entry))
(car (aref (cdr archive-entry) 0)) (version (package-version-join (aref pkg-info 0)))
(if (eq 'single (aref (cdr archive-entry) 3)) (flavour (aref pkg-info 3)))
"el" (expand-file-name
"tar")) (format "%s-%s.%s" name version (if (eq flavour 'single) "el" "tar"))
package-build-archive-dir)) package-build-archive-dir)))
(defun pb/remove-archive (archive-entry) (defun pb/remove-archive (archive-entry)
"Remove ARCHIVE-ENTRY from archive-contents, and delete associated file. "Remove ARCHIVE-ENTRY from archive-contents, and delete associated file.
@ -690,12 +690,7 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs."
(defun pb/find-package-file (name) (defun pb/find-package-file (name)
"Return the filename of the most recently built package of NAME." "Return the filename of the most recently built package of NAME."
(let* ((pkg-info (cdr (assoc name (package-build-archive-alist)))) (pb/archive-file-name (assoc name (package-build-archive-alist))))
(version (package-version-join (aref pkg-info 0)))
(flavour (aref pkg-info 3)))
(expand-file-name
(format "%s-%s.%s" name version (if (eq flavour 'single) "el" "tar"))
package-build-archive-dir)))
;;; Public interface ;;; Public interface