From 605b7a0ac79fb3e307893b00bad7413b7f5433be Mon Sep 17 00:00:00 2001 From: Donald Curtis Date: Tue, 3 Jul 2012 12:22:45 -0500 Subject: [PATCH] Search files for "-pkg.el" file. This will fix problems when the "-pkg.el" file is located in a subdirectory as long as that file is included in the ":files" list specified by the recipe, which *should* be the case anyways because you would want that file installed as part of the package. --- package-build.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/package-build.el b/package-build.el index bf5d6286..402e0a5e 100644 --- a/package-build.el +++ b/package-build.el @@ -522,6 +522,11 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs." "Prompt for a package name, returning a symbol." (intern (completing-read "Package: " package-build-alist))) +(defun pb/find-source-file (target files) + "Search for source of TARGET in FILES." + (let* ((entry (rassoc target files))) + (when entry (car entry)))) + ;;; Public interface (defun package-build-archive (name) "Build a package archive for package NAME." @@ -556,12 +561,13 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs." (pb/add-to-archive-contents pkg-info 'single))) ((< 1 (length files)) (let* ((pkg-dir (concat file-name "-" version)) - ;; TODO: What if the upstream "-pkg.el" file is in a subdir? (pkg-file (concat file-name "-pkg.el")) + (pkg-file-source (or (pb/find-source-file pkg-file files) + pkg-file)) (pkg-info (pb/merge-package-info (let ((default-directory pkg-cwd)) - (or (pb/get-pkg-file-info pkg-file) + (or (pb/get-pkg-file-info pkg-file-source) ;; some packages (like magit) provide name-pkg.el.in (pb/get-pkg-file-info (concat pkg-file ".in")) (pb/get-package-info (concat file-name ".el"))))