Skip to content

Adapting patches to a new upstream release

JimboJoe edited this page Feb 16, 2020 · 3 revisions

When upgrading the version of the package, check if the current patches needs to be updates (you get "Hunk #n failed" in the install log)

For each failing patch:

  • create a git clone of the upstream application
  • checkout the tag corresponding to the version you point to in the package
  • apply the current patch which is failing (patch -p1 < file.patch)
  • look at the .rej file created, and edit the file which couldn't be patched successfully
  • at this stage, you need to understand the upstream language, the patch code, and how to adapt it...
  • when the code is OK, then do a git diff > file.patch
  • then test again the package installation
  • ... then test the functionalities implemented by that patch (e.g. for Nextcloud, patch 00 implements log-out of YunoHost when you logout of Nextcloud)

Another option for git fans would be to create patch-specific branches in the upstream repository, commit the patch, use git format-patch, and git rebase for each new need of adaptation, but I guess the learning curve will be steeper for newcomers...

Clone this wiki locally