7

I just updated to dpkg 1.17 and it now defaults to compressing data.tar with xz instead of gzip. That creates a problem when I'm remastering CD's for older versions of ubuntu.

Is there a way to tell dpkg-buildpackage to create data.tar.gz instead of xz? I tried -Zgzip without success.


Related manpages:

dpkg-buildpackage

-z, -Z

Passed unchanged to dpkg-source. See its manual page.

dpkg-source

-Zcompression, --compression=compression

Specify the compression to use for created files (tarballs and diffs). Note that this option will not cause existing tarballs to be recompressed, it only affects new files. Supported values are: gzip, bzip2, lzma and xz. gzip is the default. xz is only supported since dpkg-dev 1.15.5.

1
  • Although an old question I believe that the answer from @c0ff3m4kr is correct and should be marked as such? I also suggest that the "Related manpages" in this questions should be removed as they are misleading to the OP's question.
    – bohrax
    Jan 12, 2016 at 16:16

2 Answers 2

11

I had the same problem while using newly build packages on an older server (hardy) which I couldn't update. The dpkg-source isn't responsible for creating a .deb package. It is only used to create the source package.

In fact dpkg-deb creates the packages witch is normally called by dh_builddeb in debian/rules. You can add change this command to dh_builddeb -- -Zgzip or call dpkg-deb -Zgzip directly.

If the command dh_builddeb isn't listed explicitly in the debian/rules file you can add the following lines to make it work:

override_dh_builddeb:
        dh_builddeb -- -Zgzip

Note that before the dh_builddeb option there is only one tab, not multiple spaces as this is a Makefile.

3
  • Makes sense, though I was unable to test it
    – Penz
    Jan 12, 2016 at 16:23
  • @Penz I just tested that giving -Z gzip to dpkg-buildpackage does not work - as this answer explains - and that using dh_builddeb in the rules file do in fact work.
    – bohrax
    Jan 12, 2016 at 18:51
  • This no longer works on Linux kernel 5.x builds - the debian/rules file is overwritten when running make deb-pkg
    – Sebazzz
    Jun 5, 2023 at 16:05
0

I don't know why it doesn't work for you, but in Debian it works as intended:

$ dpkg-buildpackage -Zgzip 
dpkg-buildpackage: source package lastfm
dpkg-buildpackage: source version 1:1.5.4.27091+dfsg1-1
dpkg-buildpackage: source distribution unstable
dpkg-buildpackage: source changed by John Stamp <[email protected]>
dpkg-buildpackage: host architecture i386
 dpkg-source -Zgzip --before-build lastfm-1.5.4.27091+dfsg1
dpkg-source: warning: unknown information field 'Dm-Upload-Allowed' in input data in general section of control info file

If I try to use anything else:

dpkg-buildpackage -Zgz  
dpkg-buildpackage: source package lastfm
dpkg-buildpackage: source version 1:1.5.4.27091+dfsg1-1
dpkg-buildpackage: source distribution unstable
dpkg-buildpackage: source changed by John Stamp <[email protected]>
dpkg-buildpackage: host architecture i386
 dpkg-source -Zgz --before-build lastfm-1.5.4.27091+dfsg1
dpkg-source: gz is not a supported compression

Use --help for program usage information.
dpkg-buildpackage: error: dpkg-source -Zgz --before-build lastfm-1.5.4.27091+dfsg1 gave error exit status 2

It err. You must make sure that you have gzip installed.

3
  • I do have gzip installed, and dpkg-buildpackage passes it to dpkg-source, but I still get data.tar.xz.
    – Penz
    Dec 27, 2013 at 12:38
  • Could you tell me which package?
    – Braiam
    Dec 27, 2013 at 12:49
  • ubuntu-keyring. Right now I'm using a script that extracts data.tar.xz, recompresses it with gzip and puts it back in deb.
    – Penz
    Dec 27, 2013 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .