I didn’t look at the ‘rbp’ patch series, just the ‘all’ patch series as that’s most likely to break. Let me walk you through an example.
I have cloned Kodi master:
git clone https://github.com/xbmc/xbmc --depth 1 -b master
I copied all my ‘all’ patches across, and tried to apply the first one:
git am all-001-system-info-display.patch
I got the following:
sam@sam-laptop:/tmp/xbmc$ git am all-001-system-info-display.patch
Applying: Cosmetic changes to the System Information dialog
error: patch failed: xbmc/windows/GUIWindowSystemInfo.cpp:56
error: xbmc/windows/GUIWindowSystemInfo.cpp: patch does not apply
So I need to update this patch. I now run:
git apply all-001-system-info-display.patch --reject
This will give me a xbmc/windows/GUIWindowSystemInfo.cpp.rej file. I can then open this to look for myself what hunks of the patch were rejected. Let’s look at a rejected hunk:
@@ -100,7 +99,6 @@ void CGUIWindowSystemInfo::FrameMove()
SetControlLabel(i++, "%s: %s", 12390, SYSTEM_UPTIME);
SetControlLabel(i++, "%s: %s", 12394, SYSTEM_TOTALUPTIME);
- SetControlLabel(i++, "%s: %s", 12395, SYSTEM_BATTERY_LEVEL);
Do you see the small ‘-’ at the beginning of the line? This means that in my patch I was removing this line. That’s because I don’t want OSMC showing battery status, when it’s often irrelevant (Pi, Vero, etc). But the position in xbmc/windows/GUIWindowSystemInfo.cpp has changed due to updates to the codebase since 15.0, so we must update the patch. So we edit xbmc/windows/GUIWindowSystemInfo.cpp and remove the line which sets
Let’s look at another hunk:
- SET_CONTROL_LABEL(52, CSysInfo::GetAppName() + " " + g_infoManager.GetLabel(SYSTEM_BUILD_VERSION).c_str() +
- " (Compiled: " + g_infoManager.GetLabel(SYSTEM_BUILD_DATE).c_str() +")");
+ SET_CONTROL_LABEL(52, "Open Source Media Center running " + CSysInfo::GetAppName() + " " + g_infoManager.GetLabel(SYSTEM_BUILD_VERSION).substr(0,4).c_str() + " (Compiled: " + g_infoManager.GetLabel(SYSTEM_BUILD_DATE).c_str() +")");
Here, you can see in my original patch I have removed two lines and added one. This is a cosmetic change and makes sure OSMC is displayed under the System Info dialog. The easiest way to fix the patch is to check for one of the lines I am deleting in the original file. Once you find it, you just need to remove it and add my line back in.
But you won’t find that line. It has changed to:
SET_CONTROL_LABEL(52, CSysInfo::GetAppName() + " " + CSysInfo::GetVersion());
I found that line by searching for ‘52’, which is the label ID in the new file. So you can change that line above to the one in the patch and that is again, another hunk resolved.
Eventually, you will resolve all of the issues. You can now run
git add xbmc/windowing/GUIWindowSystemInfo.cpp
git am --continue
This will now commit your changes, and retain the original commit message and author, which is great! To get that updated patch, you can run:
git format-patch HEAD~1..HEAD --stdout > all-001-system-info-display.patch
Copy that back in to your patches/ folder.
Well done – you just rebased a patch against the latest version of Kodi