Archive: Easy generating vpatch information for many files.


Easy generating vpatch information for many files.
In my installer I have to patch several dozens of files. How to automate creating of pat files ? It's annoying write something like
GENPAT oldfile.txt newfile.txt patch.pat
for each file :(
I have new files ( <filename>.* ) and old ones (<filename>.bak ). How to process all the files to generate <filename>.pat files ?
Maybe some bat-file? I just don't know how to make it process all the files in the folder(s)

Ideally, I want part of *nsi file generates automaticly :)
something like this:

vpatch::vpatchfile "$INSTDIR\<source dir>\<filename>.pat" "$INSTDIR\<source dir>\<filename>.*" "$INSTDIR\<source dir>\<filename>.*"
where <source dir> is the name of folder ( without full path ) where file is situated.
Any suggestions ? Did anyone solve such a problem ?

The easiest way is to create another NSIS installer which loops through all the files in a folder, and runs GENPAT on each one. It also writes to a seperate .nsi script vpatch lines which you !include in your main script.
The installer can be ran from the top of the main script with !execute or !system.

Example of this method:
http://nsis.sourceforge.net/archive/...instances=0,44

-Stu


Afrow UK
I made the following

Section "1"
;SetAutoClose true
Setoverwrite on
SetoutPath "$INSTDIR\"
File "genpat.exe"
FindFirst $3 $2 "*.p3d"
loop3:
FindNext $3 $2
DetailPrint "File: $2"
execDos::exec 'GENPAT old/$2 $2 $2.pat'
IfErrors 0 loop3
SectionEnd
It's worky and I have some ideas how to process all the subfolders ,but I have a question :
I need to run GENPAT only on files that has the old version in old folder. How to make a condition ?
And I still have a dream :) how to generate part of *.nsi ?

In other words I have several folders of files. I need to update the same files in the destination folders and add new ones. My installer is some kind of a patch and there're will be new versions, so I want to automate the process...


Yes! I did it. It's much easier then I thought :)
When ther's no old file GENPAt simply pass it through without error. Now I can easily generate vpatch info I need:)
What about autogeneration ? Any ideas ? What plugin can I use ?


When you mean autogeneration, do you mean by executing the compiled exe everytime you compile the script?
If so, just use !execute.

Your code will only work for files in a single folder. If you have files to patch in more subfolders, you can use Recursive Find:
http://nsis.sourceforge.net/archive/...877a216a60b753

-Stu


I am looking at doing something very similar. However, I have a very large project, but only a few files are likely to have changed between versions. I have notice that if you run genpat on two identical files it will still generate a patch file (all be it a small one).

Is there any easy way to find out if the files are identical before I call genpat. Or any way to test the results from genpat to see if the files were identical.

I just don't want the patch package to try to patch loads of idenitical files, it will just waste time and space.

I have tested the return value from genpat, but it returns zero in both cases. I have noticed it does show a warning message. I am going to see if a can capture the text output from getpat and search it for the warning message, but is in not very elegant. Any better ideas ???


Have you tried nsisPatchGen?


Thanks Kichik

Yes I have tried nsisPatchGen but I have had some difficulties (I have yet to get it to work for me). Anyway I have written a NSIS script that does most of what I want.

But to check is a file does require patching I am checking for a string message in the output from genpat, which is not very robust way to program, but I don't known of a better method.

Thanks again