melpaBuild: use Emacs package names to satisfy package-build

package-build expects the recipe file name to match the Emacs package
name. `melpaBuild` takes an extra argument `ename` for the Emacs package
name (default: `pname`, the Nix package name) which is used to name the recipe
file.

Fixes: #43893
See also: #43609
This commit is contained in:
Thomas Tuegel 2018-07-23 06:17:43 -05:00
parent 095e2f961f
commit 7131e353e6
No known key found for this signature in database
GPG key ID: 22CBF5249D4B4D59

View file

@ -5,7 +5,15 @@
with lib;
{ pname
{ /*
pname: Nix package name without special symbols and without version or
"emacs-" prefix.
*/
pname
/*
ename: Original Emacs package name, possibly containing special symbols.
*/
, ename ? pname
, version
, recipe
, meta ? {}
@ -35,7 +43,7 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
preUnpack = ''
mkdir -p "$NIX_BUILD_TOP/recipes"
if [ -n "$recipe" ]; then
cp "$recipe" "$NIX_BUILD_TOP/recipes/$pname"
cp "$recipe" "$NIX_BUILD_TOP/recipes/$ename"
fi
ln -s "$melpa/package-build" "$NIX_BUILD_TOP/package-build"
@ -45,7 +53,7 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
postUnpack = ''
mkdir -p "$NIX_BUILD_TOP/working"
ln -s "$NIX_BUILD_TOP/$sourceRoot" "$NIX_BUILD_TOP/working/$pname"
ln -s "$NIX_BUILD_TOP/$sourceRoot" "$NIX_BUILD_TOP/working/$ename"
'';
buildPhase =
@ -58,7 +66,7 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
-L "$melpa/package-build" \
-l "$melpa2nix" \
-f melpa2nix-build-package \
$pname $version
$ename $version
runHook postBuild
'';
@ -66,9 +74,9 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
installPhase = ''
runHook preInstall
archive="$NIX_BUILD_TOP/packages/$pname-$version.el"
archive="$NIX_BUILD_TOP/packages/$ename-$version.el"
if [ ! -f "$archive" ]; then
archive="$NIX_BUILD_TOP/packages/$pname-$version.tar"
archive="$NIX_BUILD_TOP/packages/$ename-$version.tar"
fi
emacs --batch -Q \