Git, codereview, and patches -- Please help!
-
I'm trying to use git to get the qt source code for version qt version 4.8 and then apply the patch at https://codereview.qt-project.org/#change,28040,patchset=5. I'm very new to git, qt, and the process of applying patches, so I'm not sure what to try next. I'm not even sure I'm going about this the right way.
Here's what I've done so far:
@
git clone -b 4.8 git://gitorious.org/qt/qt4.git
git tag # showed me there was a tag called v4.8.0
git checkout v4.8.0
@Then I went to https://codereview.qt-project.org/#change,28040,patchset=5 and clicked on the "patch" button for patch "Patch Set 5" which then gives me the following long string which I assume I can then run to obtain the patch:
It gives me: @git fetch https://codereview.qt-project.org/p/qt/qt refs/changes/40/28040/5 && git format-patch -1 --stdout FETCH_HEAD@
which I change to @git fetch https://codereview.qt-project.org/p/qt/qt refs/changes/40/28040/5 && git format-patch -1 --stdout FETCH_HEAD > patch5@
After running the above command, and attempting to apply the patch I get the following:
@
% patch --dry-run -p1 < patch5
patching file src/gui/kernel/qdnd_x11.cpp
Hunk #1 succeeded at 1417 with fuzz 2 (offset -5 lines).
Hunk #2 succeeded at 1469 with fuzz 2 (offset 33 lines).
Hunk #3 FAILED at 1464.
Hunk #4 FAILED at 1474.
2 out of 4 hunks FAILED -- saving rejects to file src/gui/kernel/qdnd_x11.cpp.rej
@It seems to me that since the code was obtained straight from the qt git repository, and since I'm working from the 4.8 branch that the patch should just work. But obviously it doesn't and I can't figure out what I'm doing wrong.
I think the patch is fairly simple, and I could probably apply it manually myself, but I'm really attempting this as a learning experience, with the ultimate goal of compiling qt version 4.8 on my QNAP NAS.
Any ideas or pointers?
-
Hi and welcome to devnet,
AFAICS, this patch has been merged so it should already be in Qt. Now the question is why are you trying to use 4.8.0, since you are compiling Qt yourself you should use at least 4.8.5 or the latest stable git version
-
Thanks, SGaist, for the response. I want to compile the DVR application mythtv (mythtv.org) and run the backend server on my QNAP NAS (TS-219PII). Some people have successfully done this here:
http://forum.qnap.com/viewtopic.php?f=24&t=5384&start=180,
but with an older version of mythtv. I want to compile and run the latest version (mythtv v0.27). In the mythtv readme, it says qt version 4.8, or later is required. For some reason, can't remember why now, I ruled out using qt5. Part of my reasoning might have been that qt 4.8 has been out the longest, so I stand the best chances of a successful compile on the QNAP versus later versions. Through meandering back and forth among various websites, howtos, and readmes, I ended up with version qt v4.8.1 source code. That failed to compile due the bug referenced in my first post. So I tried to patch it and the patch failed to apply. I then tried the same against v4.8.0 with a similar failure.
As I said before, I wanted to do it for the learning experience. It seems like the patch was developed against version "4.8" according to the codereview URL (from my first post). If that's true, then shouldn't I be able to create the patch via patch set 5 on that page, apply the patch, then compile. It just seems like it should work. Maybe I'm assuming too much?
You're right, I don't need 4.8.0. In fact, since my post last night, I have successfully compiled v4.8.5. I'd just like to know why the patch failed to apply against v4.8.0.
-
It only says the patch has been applied on the 4.8 branch, it doesn't mean 4.8.0 version. Currently the 4.8 branch is 4.8.6
-
Also, that patch was created 6 months after Qt 4.8.0 was released (a few weeks after Qt 4.8.2 was released). Most probably, the relevant code has evolved too much since Qt 4.8.0 for that patch to apply successfully.
In cases like these, you'll have to manually modify the patch to account for the differences, and then try again: http://stackoverflow.com/questions/17879746/how-do-i-apply-rejected-hunks-after-fixing-them
P.S. A git cherry-pick is also slightly more intelligent than a patch when it comes to backporting a single commit: http://stackoverflow.com/questions/5156459/what-are-the-differences-between-git-cherry-pick-and-git-show-patch-p1