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; 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 , version
, recipe , recipe
, meta ? {} , meta ? {}
@ -35,7 +43,7 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
preUnpack = '' preUnpack = ''
mkdir -p "$NIX_BUILD_TOP/recipes" mkdir -p "$NIX_BUILD_TOP/recipes"
if [ -n "$recipe" ]; then if [ -n "$recipe" ]; then
cp "$recipe" "$NIX_BUILD_TOP/recipes/$pname" cp "$recipe" "$NIX_BUILD_TOP/recipes/$ename"
fi fi
ln -s "$melpa/package-build" "$NIX_BUILD_TOP/package-build" ln -s "$melpa/package-build" "$NIX_BUILD_TOP/package-build"
@ -45,7 +53,7 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
postUnpack = '' postUnpack = ''
mkdir -p "$NIX_BUILD_TOP/working" 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 = buildPhase =
@ -58,7 +66,7 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
-L "$melpa/package-build" \ -L "$melpa/package-build" \
-l "$melpa2nix" \ -l "$melpa2nix" \
-f melpa2nix-build-package \ -f melpa2nix-build-package \
$pname $version $ename $version
runHook postBuild runHook postBuild
''; '';
@ -66,9 +74,9 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
archive="$NIX_BUILD_TOP/packages/$pname-$version.el" archive="$NIX_BUILD_TOP/packages/$ename-$version.el"
if [ ! -f "$archive" ]; then if [ ! -f "$archive" ]; then
archive="$NIX_BUILD_TOP/packages/$pname-$version.tar" archive="$NIX_BUILD_TOP/packages/$ename-$version.tar"
fi fi
emacs --batch -Q \ emacs --batch -Q \