Ubuntu – “dpkg-source: unrepresentable changes to source” when trying to debuild a modified package

debuild

I downloaded the source to a package using:

$ apt-get source gkrellweather

I also made sure I had the compile dependencies:

$ sudo apt-get build-dep gkrellweather

And I tested that it could build fine:

$ cd gkrellweather-2.0.8
$ debuild

It built a .deb package in the folder above, which I could install using:

$ sudo dpkg -i ../gkrellweather*.deb

OK so everything is in place. Let's get started!

I opened up the source code in Vim and made some changes I wanted. Then I tried to rebuild:

$ debuild

But I got the following error:

...
dh_clean: Compatibility levels before 5 are deprecated (level 4 in use)
 dpkg-source -b gkrellweather-2.0.8
dpkg-source: warning: no source format specified in debian/source/format, see dpkg-source(1)
dpkg-source: info: using source format `1.0'
dpkg-source: info: building gkrellweather using existing gkrellweather_2.0.8.orig.tar.gz
dpkg-source: info: building gkrellweather in gkrellweather_2.0.8-2.diff.gz
dpkg-source: error: cannot represent change to gkrellweather-2.0.8/.gkrellweather.c.swp: binary file contents changed
dpkg-source: warning: the diff modifies the following upstream files: 
 GrabWeather
 Makefile
 gkrellweather.c
dpkg-source: info: use the '3.0 (quilt)' format to have separate and documented changes to upstream files, see dpkg-source(1)
dpkg-source: unrepresentable changes to source
dpkg-buildpackage: error: dpkg-source -b gkrellweather-2.0.8 gave error exit status 1
debuild: fatal error at line 1357:
dpkg-buildpackage -rfakeroot -D -us -uc failed

Why?

Best Answer

  • Thanks to joeytwiddle's answer as it gave me a great place to start in my solution to this issue.

    In my Python project that I attempted to create a debian package for, I am using:

    • pybuild to prepare the debian package before running debuild
    • git for version control
    • PyCharm IDE for the Python development

    git creates a .git directory, pybuild creates a .pybuild directory and PyCharm creates a .idea directory all in the root of my project.

    Because joeytwiddle mentioned that debuild didn't like a certain file (in his case a swp file) then I felt it probably had a fit about the hidden directories. I found out that for git, you can do: debuild -i and it ignores version control directories for as for the pybuild and idea directories, I have not found another option yet. So for my solution, I copied over my project to a blank directory, deleted .git, .idea, and .pybuild directories and success!

  • Related Question