Add error message if the package cannot be found.

This commit is contained in:
Donald Ephraim Curtis 2012-01-22 11:51:49 -06:00
parent 5455a7696e
commit c1fdb43d59

View file

@ -162,9 +162,9 @@
(aref pkg-info 3) (aref pkg-info 3)
(aref pkg-info 2) (aref pkg-info 2)
(list 'quote (mapcar (list 'quote (mapcar
(lambda (elt) (lambda (elt)
(list (car elt) (package-version-join (cadr elt)))) (list (car elt) (package-version-join (cadr elt))))
(aref pkg-info 1)))))) (aref pkg-info 1))))))
(write-region (write-region
(concat (concat
@ -221,10 +221,10 @@
(defun package-build-get-package-info (file-name) (defun package-build-get-package-info (file-name)
(when (file-exists-p file-name) (when (file-exists-p file-name)
(ignore-errors (ignore-errors
(save-window-excursion (save-window-excursion
(find-file file-name) (find-file file-name)
(flet ((package-strip-rcs-id (str) "0")) (flet ((package-strip-rcs-id (str) "0"))
(package-buffer-info)))))) (package-buffer-info))))))
(defun package-build-get-pkg-file-info (file-name) (defun package-build-get-pkg-file-info (file-name)
(when (file-exists-p file-name) (when (file-exists-p file-name)
@ -249,85 +249,84 @@
(file-name-as-directory (file-name-as-directory
(expand-file-name file-name package-build-working-dir)))) (expand-file-name file-name package-build-working-dir))))
(when cfg (if cfg
(let* ((repo-type (plist-get cfg :fetcher)) (let* ((repo-type (plist-get cfg :fetcher))
(repo-url (plist-get cfg :url)) (repo-url (plist-get cfg :url))
(files (plist-get cfg :files)) (files (plist-get cfg :files))
(version (version
(cond (cond
((eq repo-type 'svn) ((eq repo-type 'svn)
(print 'Subversion) (print 'Subversion)
(package-build-checkout-svn repo-url pkg-cwd)) (package-build-checkout-svn repo-url pkg-cwd))
((eq repo-type 'git) ((eq repo-type 'git)
(print 'Git) (print 'Git)
(package-build-checkout-git repo-url pkg-cwd)) (package-build-checkout-git repo-url pkg-cwd))
((eq repo-type 'darcs) ((eq repo-type 'darcs)
(print 'Darcs) (print 'Darcs)
(package-build-checkout-darcs repo-url pkg-cwd)))) (package-build-checkout-darcs repo-url pkg-cwd))))
(default-directory package-build-working-dir)) (default-directory package-build-working-dir))
(cond (cond
((= 1 (length files)) ((= 1 (length files))
(let* ((pkgsrc (expand-file-name (car files) pkg-cwd)) (let* ((pkgsrc (expand-file-name (car files) pkg-cwd))
(pkgdst (expand-file-name (concat file-name "-" version ".el") (pkgdst (expand-file-name (concat file-name "-" version ".el")
package-build-archive-dir)) package-build-archive-dir))
(pkg-info (package-build-get-package-info pkgsrc))) (pkg-info (package-build-get-package-info pkgsrc)))
(unless pkg-info (unless pkg-info
(setq pkg-info (setq pkg-info
(vector file-name nil "No description available." version))) (vector file-name nil "No description available." version)))
(aset pkg-info 3 version) (aset pkg-info 3 version)
(aset pkg-info 0 (downcase (aref pkg-info 0))) (aset pkg-info 0 (downcase (aref pkg-info 0)))
(print pkg-info) (print pkg-info)
(if (file-exists-p pkgdst) (if (file-exists-p pkgdst)
(delete-file pkgdst t)) (delete-file pkgdst t))
(copy-file pkgsrc pkgdst) (copy-file pkgsrc pkgdst)
(package-build-add-to-archive-contents pkg-info 'single))) (package-build-add-to-archive-contents pkg-info 'single)))
(t (t
(let* ((pkg-dir (concat file-name "-" version)) (let* ((pkg-dir (concat file-name "-" version))
(pkg-file (concat file-name "-pkg.el")) (pkg-file (concat file-name "-pkg.el"))
(pkg-info (package-build-get-pkg-file-info (pkg-info (package-build-get-pkg-file-info
(expand-file-name pkg-file pkg-cwd)))) (expand-file-name pkg-file pkg-cwd))))
(copy-directory file-name pkg-dir) (copy-directory file-name pkg-dir)
(unless pkg-info (unless pkg-info
(setq pkg-info (package-build-get-package-info (setq pkg-info (package-build-get-package-info
(expand-file-name (concat file-name ".el") (expand-file-name (concat file-name ".el")
pkg-cwd)))) pkg-cwd))))
(unless pkg-info (unless pkg-info
(setq pkg-info (package-build-get-pkg-file-info (setq pkg-info (package-build-get-pkg-file-info
(expand-file-name (concat pkg-file ".in") (expand-file-name (concat pkg-file ".in")
pkg-cwd)))) pkg-cwd))))
(unless pkg-info (unless pkg-info
(setq pkg-info (setq pkg-info
(vector file-name nil "No description available." version))) (vector file-name nil "No description available." version)))
(aset pkg-info 3 version) (aset pkg-info 3 version)
(aset pkg-info 0 (downcase (aref pkg-info 0))) (aset pkg-info 0 (downcase (aref pkg-info 0)))
(print pkg-info) (print pkg-info)
(package-build-pkg-file (expand-file-name (package-build-pkg-file (expand-file-name
pkg-file pkg-file
(file-name-as-directory (file-name-as-directory
(expand-file-name (expand-file-name
pkg-dir pkg-dir
package-build-working-dir))) package-build-working-dir)))
pkg-info) pkg-info)
(when files (when files
(add-to-list 'files pkg-file)) (add-to-list 'files pkg-file))
(package-build-create-tar (package-build-create-tar
pkg-dir pkg-dir
(expand-file-name (expand-file-name
(concat file-name "-" version ".tar") package-build-archive-dir) (concat file-name "-" version ".tar") package-build-archive-dir)
files) files)
(delete-directory pkg-dir t nil) (delete-directory pkg-dir t nil)
(package-build-add-to-archive-contents pkg-info 'tar)) (package-build-add-to-archive-contents pkg-info 'tar))))
(package-build-dump-archive-contents))
))) (message "\nERROR: Cannot find package %s\n" file-name))))
(package-build-dump-archive-contents))))
(defvar package-build-alist (defvar package-build-alist