3
0
Fork 0
forked from mirrors/nixpkgs

emacsPackages.melpaBuild: Update package-build, avoid monkey-patch

This commit is contained in:
Tad Fisher 2022-05-23 12:52:17 -07:00
parent dfd82985c2
commit b4e4982e6c
No known key found for this signature in database
GPG key ID: 3A7425F7E7B22251
2 changed files with 16 additions and 6 deletions

View file

@ -38,8 +38,8 @@ import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; } ({
packageBuild = fetchFromGitHub {
owner = "melpa";
repo = "package-build";
rev = "047801d301a73d4932f33f768d94a8ed26b8d524";
sha256 = "0ygzkpg7xc3mjjbxg1kcyz6fwbkb0prvca499f0ffmhfaiv28h59";
rev = "35017a2d87376c70c3239f48bdbac7efca85aa10";
sha256 = "07hdmam85452v4r2vaabj1qfyami1hgbh0jgj9dcwbkpr0y1gvqj";
};
elpa2nix = ./elpa2nix.el;

View file

@ -11,12 +11,22 @@
;; Allow installing package tarfiles larger than 10MB
(setq large-file-warning-threshold nil)
(defun melpa2nix-build-package-1 (rcp version commit)
(let ((source-dir (package-recipe--working-tree rcp)))
(unwind-protect
(let ((files (package-build-expand-files-spec rcp t)))
(cond
((= (length files) 1)
(package-build--build-single-file-package
rcp version commit files source-dir))
((> (length files) 1)
(package-build--build-multi-file-package
rcp version commit files source-dir))
(t (error "Unable to find files matching recipe patterns")))))))
(defun melpa2nix-build-package ()
(if (not noninteractive)
(error "`melpa2nix-build-package' is to be used only with -batch"))
(pcase command-line-args-left
(`(,package ,version ,commit)
;; Monkey-patch package-build so it doesn't shell out to git/hg.
(defun package-build--get-commit (&rest _)
commit)
(package-build--package (package-recipe-lookup package) version))))
(melpa2nix-build-package-1 (package-recipe-lookup package) version commit))))