By modul on
Hi there,
I downloaded a patchfile to a certain module. I also downloaded the patch.exe program, part of the Unxutils. The thing is, how to use this? I found somewhere this code, to be executed at the command line:
patch some_nice_module.module < some_nice_module.patch
- Is that the correct thing to do?
- Then I upload my "new" some_nice_module.module to my site.
- And then what? Is there something else to do? Do I have to run "update.php" or something? I seem to have read that somewhere.
I'm a bit hesitant about this, so I'm asking it here.
Ludo (using Drupal 5.1)
Comments
Patching video
You may want to check out this video about applying patches in Drupal
Is patching THAT tough???
Hi Mango, I can't get the movie to display. Some Quicktime problem, I guess. Anyway, I was wondering why on earth a 12 minutes movie should be required, merely to APPLY a patch... Is it really That difficult??? And if that is the case, I don't understand why module makers publish a patch, and not the patched file, because that's what we're after, no? But I'm just saying this without having seen the movie, so I can be very wrong here.
With regard to my first post: could anyone tell me if I am doing the right thing? I'm a bit hesitant to start patching something without a prior nod of Someone Who Knows. And to avoid any misunderstanding: I'm not talking about Writing a patch, but about Applying one.
Thanks,
Ludo
Don't know
I haven't arrived at the stage of applying patches myself. Did spot the video, so thought that might be useful...
See Howto: Apply
See Howto: Apply patches.
You'll notice when things go wrong.
Of course
patch --helpgives you a nice overview of options.Note that most patches from Drupal.org have LF as end-of-line encoding. You'll need to convert those using unix2dos or a good text editor (not notepad, but pspad or notepad2) before they can be used with patch.
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
Yep, apparently I was doing
Yep, apparently I was doing it the right way:
- get "patch.exe" (from unxitils.zip)
- download the something.patch in the folder where the file to be patched is located.
- MAKE A BACKUP OF THE FILE YOU ARE ABOUT TO PATCH!!!!!!!!!
- give the command line command: patch < something.patch
- if there's a problem with "chunk something whatever", open the patch file in wordpad (not notepad!!) and save as .txt
- give the command line command again: patch < something.patch
- hope it works, and upload the patched file to your server.
There is still one question: why do people actually write and upload patches?? Why not simply post the patched file?? The effort would be the same. The only difference would be that users wouldn't have to go through this (in my opinion) rather arcane patching routine. It works, mind you, but I don't think it's very "ergonomic".
Ludo
...
Long answer ....
Because we use a concurrent versioning system to maintain and track code changes. Uploading the full module makes the module maintainer's life more difficult and less likely if at all that people who can commit these changes will do so. It also helps you easily revert those changes should things not work out.
It also makes it possible for hundreds and thousands of people to collaborate and share code effectively in a project as large as Drupal is.
CVS/SVN/Whatever, are tools that you will need to at least gain a passing familiarity with if you get serious about this stuff. Once you get over the curve a bit you will wonder how you ever worked without it. Additional information can be found in the handbook.
Short answer ...
Because in a large scale project like this it provides a standard tool to generate and receive code changes.
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
Insights that may help
I also use Unxutils (WinPort of Unix Utils from http://unxutils.sourceforge.net/). What you can do is follow these steps:
patch --binary filename.module patchfile.patchbut replace filename.module with your module's filename and also patchfile.patch with your patch file's filename before you hit Enter.Hope this helps and good luck.