Bug#485336: imlib: FTBFS when converted to new source format 3.0 (quilt): invalid patch
To prepare a possible switch to the new source package format "3.0
(quilt)" , I converted all source packages and tried to rebuild them.
Unfortunately, imlib failed, you can try yourself with those
commands (and dpkg-dev >= 1.14.19 ) :
$ apt-get source imlib
$ sed -i -e '/^Source:/ aFormat: 3.0 (quilt)' imlib-1.9.15/debian/control
$ dpkg-source -b imlib-1.9.15
$ dpkg-source -x imlib_1.9.15-7.dsc
$ cd imlib-1.9.15 && debuild -us -uc
In this process, if the .diff.gz contains changes to upstream files,
dpkg-source will have created a corresponding patch in
debian/patches/debian-changes-1.9.15-7 and will have registered that
patch in a quilt series (debian/patches/series, it is created if needed).
All the patches listed in the "series" file are applied directly during
the extraction (dpkg-source -x). quilt itself is used if available (and
will thus lead to the creation of the .pc directory), otherwise
dpkg-source applies the patches by itself. For more information about the
new source package format see the manual page dpkg-source(1).
In the case of imlib, the quilt series contains some invalid
patches. The stats in the headers (the line with @@) somehow do not
correspond to the reality of the patch below.
You can generally use quilt refresh to fix the broken patches (you might
want to refresh them all to be sure).
As a side note, you must also pay attention to the following points in
your quilt usage to guarantee compatibility with the new source package
- all your patches must be applicable with the "-p1" option of patch
(and you shouldn't use options in the series file to override this)
- the patches must be in debian/patches/ together with the "series" file
(you can use QUILT_PATCHES=debian/patches if needed)
- you should not override QUILT_PC to change the location of quilt's
internal directory (".pc" by default)
- your clean target must work even if the patches are already applied
- your build target must work with patches applied even if the clean
target is supposed to unapply them (because dpkg-source -b might
have applied them back)
 the upcoming dpkg-dev 1.14.20 is more tolerant with patches, you can
grab it here if you want to try with that version: