typelead/eta-hackage

Helper script for patching

Closed this issue · 0 comments

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

  1. Prompt the user to create a fork of ghcvm-hackage and take input to get the URL of the fork.
  2. Clone the fork locally (by default in the $HOME directory) and pull any changes.
    NOTE: The location of the ghcvm-hackage fork should be standardised and remembered for usage in the other commands.

$ ./ghcvm-patch start hello-0.0.1

  1. Download hello-0.0.1 from package (via cabalvm get for portability).
  2. Extract the tarball into the current directory (should yield a single folder with name hello-0.0.1).
  3. Initialise a git repository inside the hello-0.0.1 directory.
  4. Add & commit all the files in the hello-0.0.1 directory. The name of the commit should be "First."
  5. If an existing patch is there in ghcvm-hackage,
  6. 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)

  1. Search for the .cabal file in the current directory and obtain the package name & version.
  2. Add all the changes & commit automatically with the commit name "Patched."
  3. Invoke git format-patch HEAD~ --stdout and the output should be redirected to a file named hello-0.0.1.patch.
  4. 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.
  5. The files generated from steps 3 & 4 should be copied to thepatches 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.