Skip navigation
2013

Set-up

 

To show how git can be used to patch binary installations I wrote up a small program that contains a piece of 'logic' and a configurable message at wolfc/junk-patch-dist · GitHub.

 

Using the junk-patch repository I created 4 binary distributions:

  1. dist-1.0-bin.zip
  2. dist-1.0-p1-bin.zip
  3. dist-1.0-p2-bin.zip
  4. dist-1.1-bin.zip

 

The 4 distributions I put into the wolfc/junk-patch-dist · GitHub repository.

 

Note that the 1.1 merge commit was made using all one-off patches together:

git merge --no-commit -s ours p1 p2

Care should be taken that all one-off patches are actually merged together.

The Normal Installation

 

Now I mimic what might have happened during the original installation:

  1. Unzip dist-1.0-bin.zip
  2. Modify conf/patch/logic/Greeter.properties
  3. Overwrite logic.jar with the one from p1 (support patch)

 

Effectively I'm now at 1.0-p1 with my own configuration, which I can verify with:

$ java -jar main.jar Mucker

 

Release 1.1

 

Now I would like to do an in-place upgrade to 1.1. Within the "dist-1.0-SNAPSHOT" directory I should do the following:

$ git init
$ git add .
$ git commit

This puts my entire installation in the master branch.

 

Now sync it with 1.0-p1

$ git remote add dist https://github.com/wolfc/junk-patch-dist.git
$ git fetch dist
$ git rebase dist/p1

Observe the conflict via:

$ git diff

This should show the change you made in the previous chapter.

 

Now the tricky bit is to resolve the conflict using your favourite conflict resolving tools (e.g. vim).

 

After that continue:

$ git add conf/patconf/patch/logic/Greeter.properties
$ git rebase --continue

 

You should now be on the track from version 1.0 through one-off patch #1 into your own setup.

 

The final step is rebasing it onto version 1.1:

$ git rebase 1.1

 

Just to show what will happen (and to make it an interesting exercise) version 1.1 contains an update of the configuration file as well. So resolve that conflict and you are on version 1.1.

 

Conclusion

 

This is just a small program, but I reckon it should also be doable with an EAP (/ WildFly / AS) installation.

Filter Blog

By date:
By tag: