Forcing gzip compression when building Debian packages

If you're building packages on a recent Debian-based distribution and are getting

dpkg-deb: file `blah.deb' contains ununderstood data member data.tar.xz     , giving up

when trying to install the package on an old system with dpkg version < 1.15.6, you can force the usage of the gzip compression algorithm by changing the dh_builddeb in debian/rules to:

dh_builddeb -- -Z gzip

If you do not have an old-style debian/rules files where all the dh_* calls are listed but only one generic stanza like

%:
        dh $@

then you can add

override_dh_builddeb:
        dh_builddeb -- -Zgzip

below that to set the option for dh_builddeb.