Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: How to apply patch to sourcode? (Linux)

How to apply patch to sourcode? (Linux) 6 months 3 days ago #6641

Hi, I've been compiling OpenTTD from the sources with each OpenTTD version for few years now and each time I used:
patch -p0 -i Diff.file

but now it doesn't seem to work any more.

It gives the following output:
au@howth:~/tmp/openttd-1.8.0$ patch -p0 -i BTPro_Client_1.8.0_B_180002_git.diff 
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/projects/generate_vs100.vcxproj b/projects/generate_vs100.vcxproj
|index 4417308..84f8f59 100644
|--- a/projects/generate_vs100.vcxproj
|+++ b/projects/generate_vs100.vcxproj
--------------------------
File to patch: 

There have been obviously some changes with OpenTTD development being moved to Git. But so far I didn't find out how to apply BTPro Client patch. Any idea? I also tried "git apply" but it gives the following:
au@howth:~/tmp/openttd-1.8.0$ git apply BTPro_Client_1.8.0_B_180002_git.diff
BTPro_Client_1.8.0_B_180002_git.diff:583: trailing whitespace.
/* 
BTPro_Client_1.8.0_B_180002_git.diff:614: trailing whitespace.
static const std::string base64_chars = 
BTPro_Client_1.8.0_B_180002_git.diff:985: trailing whitespace.
			NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_INCOME),SetMinimalSize(108, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),		
BTPro_Client_1.8.0_B_180002_git.diff:1164: trailing whitespace.
			case NIC_TOKEN_WEBSITE:	
BTPro_Client_1.8.0_B_180002_git.diff:1168: trailing whitespace.
			case NIC_TOKEN_WIKI:	
error: patch failed: projects/settingsgen_vs100.vcxproj:1
error: projects/settingsgen_vs100.vcxproj: patch does not apply
  • au
  • Topic Author
  • Offline
  • Junior BTPro Poster
  • Junior BTPro Poster
  • Posts: 35
  • Thank you received: 2

Please Log in or Create an account to join the conversation.

Last edit: by au.

How to apply patch to sourcode? (Linux) 6 months 3 days ago #6642

I figured it out, the command is:
git apply --stat BTPro_Client_1.8.0_B_180002_git.diff
The following user(s) said Thank You: ST2, tomb
  • au
  • Topic Author
  • Offline
  • Junior BTPro Poster
  • Junior BTPro Poster
  • Posts: 35
  • Thank you received: 2

Please Log in or Create an account to join the conversation.

How to apply patch to sourcode? (Linux) 6 months 3 days ago #6643

glad you figured it out. I was to suggest patch -p1 < file.diff but never tested it ^^

Enjoy the games :)
  • ST2
  • ST2's Avatar
  • Offline
  • BTPro Administrator
  • BTPro Administrator
  • Posts: 1170
  • Thank you received: 551

Please Log in or Create an account to join the conversation.

How to apply patch to sourcode? (Linux) 4 months 2 weeks ago #6693

au wrote: I figured it out, the command is:

git apply --stat BTPro_Client_1.8.0_B_180002_git.diff


That doesn't actually apply the patch for me. It in fact changes no files for me.

Instead I do this:
patch -p1 < BTPro_Client_1.8.0_B_180002_git.diff || true

The "|| true" is because one file fails to apply, however that is a VS file and we don't need VS on linux so it doesn't matter.
The following user(s) said Thank You: Frank
  • gentz
  • Offline
  • Fresh BTPro Poster
  • Fresh BTPro Poster
  • Posts: 6
  • Thank you received: 5

Please Log in or Create an account to join the conversation.

Last edit: by gentz.
  • Page:
  • 1
Time to create page: 0.071 seconds
Best hosting deal on hostgator coupon or play poker on party poker
Copyright 2018 How to apply patch to sourcode? (Linux) - BTPro - OpenTTD Community.