ibus-m17n in Fedora has applied several local patches in testing. Those patches sometimes conflict each other and do not apply cleanly. I used to adjust patches by editing them by hand (well actually with Emacs diff-mode, which is aware of hunk changes and updates header lines properly). Today I switched to use quilt as Debian people do.
Here are the steps I followed to migrate. First, download the tarball and patches in the git tree, extract unpatched source, and backup patches:
$ fedpkg srpm
$ tar xf ibus-m17n-1.3.2.tar.gz
$ mkdir backup
$ mv *.patch backup
Secondly, set up some envvars quilt respects:
$ export QUILT_PATCHES=..
$ export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
Finally, migrate patches into the quilt format. For the first patch (Patch0: ibus-m17n-HEAD.patch):
$ cd ibus-m17n-1.3.2
$ quilt new ibus-m17n-HEAD.patch
$ diffstat ../backup/ibus-m17n-HEAD.patch
Makefile.am | 2
configure.ac | 15 +++++
src/engine.c | 155 ++++++++++++++++++++++++-----------------------------------
3 files changed, 80 insertions(+), 92 deletions(-)
$ quilt add Makefile.am configure.ac src/engine.c
$ patch -p1 < ../backup/ibus-m17n-HEAD.patch
$ quilt refresh
Now I have ibus-m17n-HEAD.patch (in quilt format) in the upper directory. I could proceed to the next patch:
$ quilt new ibus-m17n-stsreq.patch
$ diffstat ...; quilt add ...; patch ...; quilt refresh
Once all patches are migrated, I could edit them individually:
$ quilt applied
../ibus-m17n-HEAD.patch
../ibus-m17n-stsreq.patch
../ibus-m17n-xkb-options.patch
../ibus-m17n-xx-icon-symbol.patch
../ibus-m17n-iok.patch
$ quilt pop
Removing patch ../patches/ibus-m17n-iok.patch
Restoring src/engine.c
Now at patch ../ibus-m17n-xx-icon-symbol.patch
$ vi src/m17nutil.c ... # edit the code
$ quilt refresh # refresh the patch
$ quilt push
Of course, the package builds without patch conflicts:
$ cd ..
$ fedpkg srpm
$ SHELL=/bin/sh mock -r fedora-rawhide-x86_64 --rebuild ibus-m17n-1.3.2-6.fc16.src.rpm
...
INFO: Done(ibus-m17n-1.3.2-6.fc16.src.rpm) Config(fedora-rawhide-x86_64) 2 minutes 23 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-rawhide-x86_64/result
State Changed: end
TIP: to keep series file (the quilt index file) after fedpkg import, mark it as SourceX in spec.