arggg.. how to *apply* patches in windows?

Questions or HOWTOs about the above? Post 'em here...
Post Reply
michaelh20
Private First Class
Private First Class
Posts: 57
Joined: Thu Dec 12, 2002 2:28 am
Location: MN USA

arggg.. how to *apply* patches in windows?

Post by michaelh20 »

Great I know how to make them, but I don't know how to apply them...

How does one actually apply the diff -u files to directories etc..?

This is windows I am speaking of.. I think the patch thing I was trying to use doesn't work.. perhaps I need a different version.
User avatar
Fiberchunks
Administrator
Administrator
Posts: 397
Joined: Tue Dec 03, 2002 5:58 am
Location: Groton, CT

Post by Fiberchunks »

look here, and see if this might help you...

http://www.codeproject.com/useritems/patch.asp

Although - had I to work with that lovely os, I would prob. just bite the bullet and grab cygwin, and related gnu tools (patch, etc.)

Anyway, that's all I could find, good luck!

Peace
michaelh20
Private First Class
Private First Class
Posts: 57
Joined: Thu Dec 12, 2002 2:28 am
Location: MN USA

Post by michaelh20 »

I got it, I just didn't have the parameters right, plus my patch was also full of cr/lf I think too

so the right command if you are in the directory to be patched is
patch -p1 < silenceflagt.diff


Can someone explain what the -p1 is doing ?
User avatar
Fiberchunks
Administrator
Administrator
Posts: 397
Joined: Tue Dec 03, 2002 5:58 am
Location: Groton, CT

simple answer..

Post by Fiberchunks »

-pX strips the leading number of slashes from the filename to be patched -- for example, given the file (in the patchfile or .diff):
/blah/foo/cruft/bogacious/froody

if you specify -p0 - the entire file is read as it /blah/foo ....

if you specify -p1 - the file : blah/foo.... (note the leading slash is gone).

and -p3

cruft/bogagcious/froody.

Here's an excerpt from the man page on my system, in case I mangled the above description:

-pnum or --strip=num
Strip the smallest prefix containing num leading slashes from each
file name found in the patch file. A sequence of one or more adja-
cent slashes is counted as a single slash. This controls how file
names found in the patch file are treated, in case you keep your
files in a different directory than the person who sent out the
patch.

Hope this helps.

Note that if you always patch from where the other person patched (in this case $HOME/bzflag/
then you should never need to specify anything but -p1

Peace
User avatar
EvilChickenNugget
Private First Class
Private First Class
Posts: 160
Joined: Tue Apr 22, 2003 1:35 am
Location: Highland, NY
Contact:

Post by EvilChickenNugget »

I'm trying to figure out how to apply a .diff file as a patch. I tried downloading the app in that link you gave, fiber, but it didn't work for the .diff file.

I'm on windows, of course
Image
User avatar
Fiberchunks
Administrator
Administrator
Posts: 397
Joined: Tue Dec 03, 2002 5:58 am
Location: Groton, CT

Post by Fiberchunks »

/me is no winderz guru -- I'm sure patlabor can help you out with it tho.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

I got it to work right only once.

1) make sure the patch is a windows format text file ( none of those unix style line endings)

2) use this version of patch

the rest kinda depends on the patch

basicly you need to look at the patch and see what folder is was generated from.

most patches should go in the bzflag root dir, and then you specify -p0 in the patch line. but sometimes they are difrnet. sometimes you have to tell the patcher to ignore parts of the paths in the diff file. like if the patch was made to refrence /usr/bzflag/..... you would use -p1 to tell it to ignore the first dir in those paths.

other then that you kinda have to play with it. There isn't a standard way to make patches, so sometimes you even have to edit the patch file.
Attachments
patch.zip
Patch for windows
(28.98 KiB) Downloaded 157 times
ImageJeffM
User avatar
EvilChickenNugget
Private First Class
Private First Class
Posts: 160
Joined: Tue Apr 22, 2003 1:35 am
Location: Highland, NY
Contact:

Post by EvilChickenNugget »

Great, thanks. I'll give it a shot when I get home from work.
Image
Qweet
Private
Private
Posts: 2
Joined: Sun Apr 04, 2004 6:33 pm

Post by Qweet »

Hello everyone... I've had BZflag for alittle while now, its pretty awesome!!!! Anyhoo, I'm working on Windows XP, and I'm totally perplexed as to how I am supposed to install these patches! I have no idea what you guys are talking about! :S I want to install the lazarus flag because it sounds pretty sweet, but I really have no clue how. Could you help me out with some clear instructions (for someone with no Linux experience! :( )

Thanks!
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

qweet, the first thing you must have is a way to compile and build the game on windows. This means ether a copy of Visual C++ or the mingw compiler.

Once you have that, you will need to make sure you can compile the game. Then get the patch util from right up there. Throw it in your path, and apply the patch from the Command line like it's shown aboove, then re-compile the game.
ImageJeffM
Qweet
Private
Private
Posts: 2
Joined: Sun Apr 04, 2004 6:33 pm

Post by Qweet »

I have visual studio.NET... I tried applying the lazarus.diff file, and i think 1 out of 9 Heaps were successful? :S and then I tried to compile, but got some errors. I'm fairly confused, lol... maybe I should try compiling without patching first. Any thoughts?

BTW thanks for the help (y)
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

to apply a dif you want to make sure you apply it against the version it was made against. Check the docs on the diff and see what is was made with and get that. or go fix those problems. The code is allways changing.
ImageJeffM
Post Reply