Embedding a patch to a custom Linuxbrew formula

1.1k Views Asked by At

I wanted to embed a patch to a custom Linuxbrew formula and I have been following the instructions from the formula-cookbook website: https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook

Unfortunately, I do not know how to continue the installation after I add an embedded patch to the local formula in interactive mode . On the command prompt it says to type 'exit' to continue, but that did not work as I expected.

$ brew install --interactive –-git urg.rb

==> Downloading http://downloads.sourceforge.net/project/urgnetwork/urg_library/urg_library-1.1.2.zip
Already downloaded: /home/chris/.cache/Homebrew/urg-1.1.2.zip
Initialized empty Git repository in /tmp/urg-w58G/urg_library-1.1.2/.git/
==> Entering interactive mode
Type `exit' to return and finalize the installation
Install to this prefix: /home/chris/.linuxbrew/Cellar/urg/1.1.2
This directory is now a git repo. Make your changes and then use:
  git diff | pbcopy
to copy the diff to the clipboard.

$ vi src/urg_serial_linux.c
→ Here I manually add the line: #include <sys/select.h>
$ git diff | xsel --clipboard --input
$ brew edit urg.rb

Alternatively, I am able manually add an embedded patch in the homebrew github repository using the information from the interactive mode, but the patch fails.

==> Downloading http://downloads.sourceforge.net/project/urgnetwork/urg_library/urg_library-1.1.2.zip
Already downloaded: /home/chris/.cache/Homebrew/urg-1.1.2.zip
==> Patching
patching file src/urg_serial_linux.c
Hunk #1 FAILED at 8.
1 out of 1 hunk FAILED -- saving rejects to file src/urg_serial_linux.c.rej

Could you tell me where Linuxbrew keeps .rej files or how I can continue the interactive mode? Thank you in advance.

-Chris

1

There are 1 best solutions below

0
On

You may run brew install --debug --git urg.rb. This way on first fail you will have ability to open a shell in build directory. .rej file should be accessible from there.