Archive: NSIS patching (multiple patches in one file)


NSIS patching (multiple patches in one file)
I'm able to generate patch files from one version to another using NSIS' Vpatch. Let's say I have mydll.dll version 1, and I have a patch to update it to version 2. Then I have a new version again, thus I generate another patch to update it to version 3.

What bothers me though is, what if user cancels updating to version 2 and so forth. Then my latest version let's say is version 20. User decides to update to version 20. Is there a way to generate a patch that's like accumulative in nature? whereas user can jump from version any old version to the newest version (i.e ver 3 to ver 20) without passing through the versions in between?

I've read this line in vpatch's documentation ---> "if you want to be able to upgrade version 1 and 2 to version 3, you can put a 1 > 3 and 2 > 3 patch in one file." But how do I that?

What if I alread have like 30 versions. Does that mean I have to create a patch whose arguments are old files(versions 1-29) and new file(version20)?

Any help would be appreciated. Thanks...


I've read this line in vpatch's documentation ---> "if you want to be able to upgrade version 1 and 2 to version 3, you can put a 1 > 3 and 2 > 3 patch in one file." But how do I that?
Here is how I did it:
GenPat.exe file_v1 file_v5 big_patch.pat
GenPat.exe file_v2 file_v5 big_patch.pat
GenPat.exe file_v3 file_v5 big_patch.pat
GenPat.exe file_v4 file_v5 big_patch.pat
I created a simple batch file to do this.

What if I have an application with 20 files. Assuming I have to update 10 files per version, and I have reached 12 versions. Then I want to create the patch file for the 13th version. Does that mean I have to keep all 120 files (10 files x 12 versions) to create a new patch file?


Does that mean I have to keep all 120 files (10 files x 12 versions) to create a new patch file?
No. In my example "big_patch.pat" can patch any of file_v1 to file_v4 to make file_v5.

If I now need to update to file_v6 all I need is another patch file that will patch file_v5 to file_v6, e.g.
GenPat.exe file_v5 file_v6 extra_patch.pat
I can then use the big_patch.pat file to ensure the file has been updated to file_v5 and then use the extra_patch.pat file to upgrade the resulting file_v5 file to file_v6.

So all I need to do is keep the big_patch.pat file and worry about updating the result of applying it to the older files (i.e. worry about updating from file_v5 to a newer version)

So extra_patch.pat is exclusively for updating from file_v5 to file_v6, not from any older version to file_v6.

But if you want the user to be able to update from any old version to your latest version, let's say 15th version, your batch file would look something like this:


GenPat.exe file_v1 file_v15 big_patch.pat
GenPat.exe file_v2 file_v15 big_patch.pat
GenPat.exe file_v3 file_v15 big_patch.pat
GenPat.exe file_v4 file_v15 big_patch.pat
....
....
GenPat.exe file_v14 file_v15 big_patch.pat

Is that correct?

Yes, that is how I would make a patch file that could patch any of the 14 old versions of a file to make the new version.

One reason I use a batch file is to help me keep a record of what went into the patch file.

I am assuming there is a good reason you want to apply patches instead of just installing the latest version of the file.


Yes, that's right. We would like to minimize having the users reinstall the software as much as possible. For an application that's fairly big it's better to have updates for users' convenience.

I was thinking there could be another way. But I guess this is how as far as patching goes.

Thanks!