Skip to content

Commit

Permalink
Add an example of using git format-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Sep 9, 2024
1 parent 4a75e44 commit f665fcd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,25 @@ a series of patches.

Create a patch file using `git format-patch` and copy to `rpm_spec/patches/`. You will have to modify the path to be relative to the RPM BUILDDIR.

For example if we wanted to create a hotfix to apply a commit in radjabov `1286aa34992340cad7a0778df01a845f1772e561` we would run:
```sh
git format-patch 1286aa34992340cad7a0778df01a845f1772e561^..1286aa34992340cad7a0778df01a845f1772e561
```

Which will create a patch file: `0001-Merge-pull-request-23123-from-agrare-fix_miq_request.patch`

Next we have to change the file location to match the RPM BUILDDIR, for a patch in the core rpm this will be e.g. `manageiq-core-18.0-1`

```
diff --git a/manageiq-core-18.0-1/app/models/miq_provision_request_template.rb b/manageiq-core-18.0-1/app/models/miq_provision_request_template.rb
index 621f20b7e7..f62f454ac5 100644
--- a/manageiq-core-18.0-1/app/models/miq_provision_request_template.rb
+++ b/manageiq-core-18.0-1/app/models/miq_provision_request_template.rb
```

This ensures that the hotfix patch will apply correctly when it is run. Then move that patch
file to `rpm_spec/patches/` in the rpm_build repo.

`docker build --pull --tag $USER/rpm_build:radjabov-hotfix .`

Create a `BUILD/hotfix` directory and copy the .src.rpm for the release that you want to
Expand Down

0 comments on commit f665fcd

Please sign in to comment.