From fdfe060ecff89e873a089f7222e7084106cfb1c7 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Tue, 24 Apr 2012 08:11:16 +0100 Subject: [PATCH] Check more strictly that -pkg files contain a single define-package expression (see #92) --- package-build.el | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/package-build.el b/package-build.el index 25f8f573..289b4145 100644 --- a/package-build.el +++ b/package-build.el @@ -402,15 +402,18 @@ FILES if non-nil. The file is written to (defun pb/get-pkg-file-info (file-path) "Get a vector of package info from \"-pkg.el\" file FILE-PATH." (when (file-exists-p file-path) - (let ((pkgfile-info (cdr (pb/read-from-file file-path)))) - (vector - (nth 0 pkgfile-info) - (mapcar - (lambda (elt) - (list (car elt) (version-to-list (cadr elt)))) - (eval (nth 3 pkgfile-info))) - (nth 2 pkgfile-info) - (nth 1 pkgfile-info))))) + (let ((package-def (pb/read-from-file file-path))) + (if (eq 'define-package (car package-def)) + (let ((pkgfile-info (cdr package-def))) + (vector + (nth 0 pkgfile-info) + (mapcar + (lambda (elt) + (list (car elt) (version-to-list (cadr elt)))) + (eval (nth 3 pkgfile-info))) + (nth 2 pkgfile-info) + (nth 1 pkgfile-info))) + (error "No define-package found in %s" file-path))))) (defun pb/expand-file-list (dir config) "In DIR, expand the :files for CONFIG, some of which may be