melpaBuild: accept recipeFile in lieu of fileSpecs

This commit is contained in:
Thomas Tuegel 2015-12-29 13:23:49 -06:00
parent 63bf2a551e
commit 7466e0f264
2 changed files with 20 additions and 0 deletions

View file

@ -8,6 +8,8 @@ with lib;
{ pname
, version
, recipeFile ? null
, files ? null
, fileSpecs ? [ "*.el" "*.el.in" "dir"
"*.info" "*.texi" "*.texinfo"
@ -43,8 +45,17 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
runHook preBuild
emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
${if recipeFile == null
then
''
-f melpa2nix-build-package \
${pname} ${version} ${targets}
''
else
''
-f melpa2nix-build-package-from-recipe \
${pname} ${version} ${recipeFile}
''}
runHook postBuild
'';

View file

@ -21,6 +21,15 @@
(`(,package ,version . ,files)
(melpa2nix-package-build-archive package version files))))
(defun melpa2nix-build-package-from-recipe ()
(if (not noninteractive)
(error "`melpa2nix-build-package' is to be used only with -batch"))
(pcase command-line-args-left
(`(,package ,version ,recipe-file)
(let* ((rcp (cdr (package-build--read-from-file recipe-file)))
(files (package-build--config-file-list rcp)))
(melpa2nix-package-build-archive package version files)))))
(defun melpa2nix-package-build-archive (name version files)
"Build a package archive for package NAME."
(package-build--message "\n;;; %s\n" name)