jimeh / build-emacs-for-macos

Somewhat hacky script to automate building of Emac.app on macOS.
484 stars 50 forks source link

Undefined method `gsub' for nil:NilClass when building native-comp #21

Closed valrus closed 3 years ago

valrus commented 4 years ago

Running the command

./build-emacs-for-macos --git-sha 7a8370ed0f

compiled Emacs successfully AFAICT but failed here:

==> INFO: Creating symlinks within Emacs.app needed for native-comp
==> INFO: Embedding libraries into Emacs.app
==> INFO: Embedding libgccjit into Emacs.app
./build-emacs-for-macos:369:in `archive_app': undefined method `gsub' for nil:NilClass (NoMethodError)
        from ./build-emacs-for-macos:104:in `build'
        from ./build-emacs-for-macos:814:in `<main>'

I was able to work around it with the following patch, but this is kludgy and probably not a desirable solution:

diff --git a/build-emacs-for-macos b/build-emacs-for-macos
index e22f413..c88ae60 100755
--- a/build-emacs-for-macos
+++ b/build-emacs-for-macos
@@ -366,14 +366,14 @@ class Build
     FileUtils.mkdir_p(builds_dir)

     metadata = [
-      ref.gsub(/\W/, '-'),
+      ref&.gsub(/\W/, '-'),
       meta[:date],
       meta[:sha][0..6],
       "macOS-#{OS.version}",
       OS.arch
     ]

-    filename = "Emacs.app-[#{metadata.join('][')}].tbz"
+    filename = "Emacs.app-[#{metadata.compact.join('][')}].tbz"
     target = "#{builds_dir}/#{filename}"

     app_base = File.basename(app)
SreenivasVRao commented 3 years ago

Having the same problem

jimeh commented 3 years ago

The --git-sha option was originally intended as a override, as the main argument can also be given a commit SHA. However it makes sense to avoid these kinds of errors. Thanks for the report :)