Frank Cox wrote:
I am attempting to create a rpm of the latest version of a program. The rpm for the previous version contains a number of patch files that make numerous changes various files in the tar.gz as downloaded from the project's website so it will work properly on Linux.
The latest version of the program has changed enough stuff that some of the patches now fail to apply. "1 out of 1 hunk FAILED" and so on. Upon comparing the previous version's files to the latest version, I see that the problem is that some of the files that need to be patched have had some stuff moved around a bit, just enough to (apparently) cause patch to fail.
By way of experimentation, I manually changed one of the files in the new version to match what the patch says it should be, then created a new patch file from that and it applies and appears to work fine. (I patched the previous version's file, compared the result to the original and made the same change in the new version's file.)
This method seems to work fine when the change is only one or two lines, but some of the patches are somewhat more involved than that.
It seems to me that there may be an automated way to handle this matter by somehow patching a into b, then compare a and b and make corresponding changes in c. Basically the same process that I just tried manually on a small patch file, without all of the labour and chance of a screw-up that would be involved in manually comparing the old files and rewriting the new file.
I have two questions:
First, am I going about this the right way? And if so, is there a way to automate the process as described in the previous paragraph?
Second, what is the proper convention for handling this in a rpm? The obvious solution seems to be to create new patch files and throw the old ones away, then build the rpm from that. Some of these patches appear to go back several versions, though, so is there a better or more proper way to handle this than just throwing them out and making a whole new set of patches?
I have learned a lot more about patch and diff tonight than I ever needed to know before. Very cool stuff, and very useful.
You probably can't automate this - but note that many of the patches included in RHEL/CentOS RPMs are to backport fixes from newer versions of the code without bringing in new/different features. So, if you start with newer base code you may not need many/most of the patches at all.