Howto apply a patch/diff file

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Howto apply a patch/diff file

Post by Yexo »

You should probably create the directory /usr/src first
User avatar
kamnet
Moderator
Moderator
Posts: 8624
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Howto apply a patch/diff file

Post by kamnet »

Yep, that helped. Strange. I'll update the wiki to note that. NEXT ISSUE:

Code: Select all

Administrator@KAM-GIGABYTE /home/zlib-1.2.3/mingwPORT
$ ./mingwPORT.sh
Download file? (Yes) 
Download file URI? (http://www.zlib.net) 
Archive file type?
0) unknown
1) tar.gz
2) tgz
3) tar.bz2
4) tbz2
5) zip
Select a numeric value: (3) 
Archive file? (zlib-1.2.3.tar.bz2) 
Download to path? (/tmp) 
Source path? (/usr/src/zlib-1.2.3) 
Installation directory? (/mingw) 
CFLAGS (-O3 -s -mms-bitfields -march=i686) 
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = c:\tools\gnu\coreutils/etc/wgetrc
--2010-05-10 18:52:54--  http://www.zlib.net/zlib-1.2.3.tar.bz2
Resolving www.zlib.net... 69.73.181.135
Connecting to www.zlib.net|69.73.181.135|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2010-05-10 18:52:54 ERROR 404: Not Found.

tar (child): /tmp/zlib-1.2.3.tar.bz2: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -u3pr zlib-1.2.3/win32/Makefile.gcc zlib-1.2.3-mingwPORT/win32/Makefile.gcc
|--- zlib-1.2.3/win32/Makefile.gcc      Fri Aug  1 23:49:00 2003
|+++ zlib-1.2.3-mingwPORT/win32/Makefile.gcc    Wed Feb  1 11:48:04 2006
--------------------------
No file to patch.  Skipping patch.
3 out of 3 hunks ignored
/usr/src/zlib-1.2.3
make: win32/Makefile.gcc: No such file or directory
make: *** No rule to make target `win32/Makefile.gcc'.  Stop.
make: win32/Makefile.gcc: No such file or directory
make: *** No rule to make target `win32/Makefile.gcc'.  Stop.
make: win32/Makefile.gcc: No such file or directory
make: *** No rule to make target `win32/Makefile.gcc'.  Stop.

Administrator@KAM-GIGABYTE /home/zlib-1.2.3/mingwPORT
$ 
It appears that zlib-1.2.3 is no longer available from zlib.net (current version is 1.2.5). And the script is specifically looking for that version. I don't see an updated script on mingw's page either. Any idea what to do from here? I figured maybe editing the mingwPORT.ini file with the latest version would do it, but it appears everything is still failing at input line 4, so I'm at a loss now.
therealelvis
Engineer
Engineer
Posts: 2
Joined: 23 May 2010 10:25

Re: Howto apply a patch/diff file

Post by therealelvis »

Hi, does anyone know how to install a patch on a mac? For example the chunnels patch. I've looked through all the wikis and they haven't helped at all! Can anyone explain please?

Thanks:)
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Howto apply a patch/diff file

Post by Rubidium »

The first post of this topic has been written by the former Mac OS X porter/developer, so whatever is written there should also apply to Mac OS X.
therealelvis
Engineer
Engineer
Posts: 2
Joined: 23 May 2010 10:25

Re: Howto apply a patch/diff file

Post by therealelvis »

Ok thanks :D
Echo51
Engineer
Engineer
Posts: 37
Joined: 15 Nov 2009 11:16

Re: Howto apply a patch/diff file

Post by Echo51 »

I have trouble getting my personal .bat to function correctly, either it cant find the file, or subversion claims -p is not a valid option charecter

Code: Select all

subversion patch -p0 -i mestool.diff
also tried

Code: Select all

subversion patch -p0 < mestool.diff

It just wont work...
(win 7 32bit)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Howto apply a patch/diff file

Post by planetmaker »

subversion and patch are different programmes.
try without the 'subversion' part.
Echo51
Engineer
Engineer
Posts: 37
Joined: 15 Nov 2009 11:16

Re: Howto apply a patch/diff file

Post by Echo51 »

Forgot to add im using svn.exe, so not sure if i need something else?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Howto apply a patch/diff file

Post by planetmaker »

planetmaker wrote:subversion and patch are different programmes.
How else can I phrase that? Subversion won't help you with patching a single bit.
Echo51
Engineer
Engineer
Posts: 37
Joined: 15 Nov 2009 11:16

Re: Howto apply a patch/diff file

Post by Echo51 »

eh, my bad for not reading that proberly, i'll try :)
Quintus
Engineer
Engineer
Posts: 36
Joined: 13 Feb 2010 16:35
Location: Germany

Re: Howto apply a patch/diff file

Post by Quintus »

I want to try out some patches nevertheless I hadn't the courage to do that yet. For example, the daylength-patch. As advised by the wiki and the tutorials around here, I installed TortoiseSVN on my Windows 7 32bit OS and checked the latest OpenTTD-version out. Then I downloaded the patches and tried to apply them by using TortoiseSVN - but nothing happened (I followed the instructions on page 1 of this thread). Afterwards I read about a difference between SVN type and HG/GIT type patches - and the daylength-patch isn't obviously a SVN one. So how do I apply it anyway? The wikipage only describes the way by using TortoiseSVN or with the console for Linux users.

Edit: I'm not talking about compiling - just how to apply a HG/GIT type patch.

Edit#2: Done.
Quintus.
Eonwe
Engineer
Engineer
Posts: 3
Joined: 07 Aug 2010 12:49

Re: Howto apply a patch/diff file

Post by Eonwe »

how didi u do id? i am encountering the same problem atm
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Howto apply a patch/diff file

Post by Gremnon »

Use -p1 instead of -p0 when running patch.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Howto apply a patch/diff file

Post by Alberth »

Gremnon wrote:Use -p1 instead of -p0 when running patch.
That's with a normal patch program, but Eonwe is asking how to do it with TortoiseSVN.

(I don't know, unfortunately)
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Howto apply a patch/diff file

Post by Gremnon »

In that case, it can be solved by editing the .patch/diff file directly. Usually, I've found mercurial and git patches often have 'a/src...' and 'b/src...' instead of the normal lines, and by removing the a/ and b/ lines from it, it can be applied as per normal.
I've found one or two cases where it didn't work as expected even then, but it usually fixes it.
AppeL
Engineer
Engineer
Posts: 31
Joined: 30 Jul 2010 22:05

Re: Howto apply a patch/diff file

Post by AppeL »

hooray, i managed to compile OpenTTD with MinGW.. now I have a pile of patches (daylength, cargodist etc).. how cna i do that? tortoisesvn apparently works differently from the description on the first page, maybe its updated?

whats to do next?

edit: oh no, it still works the same.. it seems i have the same problem with the a/ and b/ lines.. i removed the +++ line and the --- line but there is another line at the very top, do i remove that aswell? i tried that but i can never apply a patch with tortoise, if i choose .diff file and the trunk directory and click "ok" nothing happens, that small window never opens :<


edit 2: right, i managed to edit the file to make it a svn patch, so i was able to use it with tortoisesvn (it was outdated tho, but thats another thing)

anyways, do i really need to go through ALL the cargodist git files and change the code to make them svn and that everytime i update cargodist? :O
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Howto apply a patch/diff file

Post by ChillCore »

AppeL wrote: anyways, do i really need to go through ALL the cargodist git files and change the code to make them svn and that everytime i update cargodist? :O
Yes, unless you apply the patch from the console.
In that case you use "patch -p1 < patch.diff" as command.
"patch -p0" is for svn patches.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
thefluffycontroller
Engineer
Engineer
Posts: 32
Joined: 05 May 2010 09:38

Re: Howto apply a patch/diff file

Post by thefluffycontroller »

Possibly seemingly obvious question, but not to me.
If i want to start compiling OTTD myself which of the instructions should i be using from here
http://wiki.openttd.org/Category:Compiling_OpenTTD
I assume i need to mention i am using windows XP as that will have some barring on which i use.

It would be useful for complete noobs like me if it pointed out somewhere which guide was appropriate for which operating system. :)
AppeL
Engineer
Engineer
Posts: 31
Joined: 30 Jul 2010 22:05

Re: Howto apply a patch/diff file

Post by AppeL »

ChillCore wrote:
AppeL wrote: anyways, do i really need to go through ALL the cargodist git files and change the code to make them svn and that everytime i update cargodist? :O
Yes, unless you apply the patch from the console.
In that case you use "patch -p1 < patch.diff" as command.
"patch -p0" is for svn patches.
is that possible in windows or only linux?
Eddi
Tycoon
Tycoon
Posts: 8279
Joined: 17 Jan 2007 00:14

Re: Howto apply a patch/diff file

Post by Eddi »

patch.exe is included in mingw/msys, with this it works on windows as well
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 5 guests