Helper script for patching
Closed this issue · 0 comments
rahulmutt commented
The instructions in the README can be converted to a script to make it easier for people to patch libraries.
Basic interface:
The hello-0.0.1
package will be the running example.
$ ./ghcvm-patch init
- Prompt the user to create a fork of
ghcvm-hackage
and take input to get the URL of the fork. - Clone the fork locally (by default in the
$HOME
directory) and pull any changes.
NOTE: The location of theghcvm-hackage
fork should be standardised and remembered for usage in the other commands.
$ ./ghcvm-patch start hello-0.0.1
- Download
hello-0.0.1
from package (viacabalvm get
for portability). - Extract the tarball into the current directory (should yield a single folder with name
hello-0.0.1
). - Initialise a git repository inside the
hello-0.0.1
directory. - Add & commit all the files in the
hello-0.0.1
directory. The name of the commit should be "First." - If an existing patch is there in
ghcvm-hackage
, - Notify the user that he can start patching inside the newly created directory.
$ ./ghcvm-patch commit
(Should be invoked in the root directory of the extracted package)
- Search for the
.cabal
file in the current directory and obtain the package name & version. - Add all the changes & commit automatically with the commit name "Patched."
- Invoke
git format-patch HEAD~ --stdout
and the output should be redirected to a file namedhello-0.0.1.patch
. - Check if
hello.cabal
has been changed since the last commit "First." If so, copy it with new name as `hello-0.0.1.cabal. If not, don't generate any new file. - The files generated from steps 3 & 4 should be copied to the
patches
directory of the local clone of the ghcvm-hackage fork. The changes should be committed & pushed automatically. Finally, a PR should automatically be sent upstream.
ghcvm-patch
should be ideally be a Haskell utility for easy installation, but if someone is willing to make a bash script, that works too.